OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #import "ios/chrome/browser/ui/browser_view_controller.h" | 5 #import "ios/chrome/browser/ui/browser_view_controller.h" |
6 | 6 |
7 #import <AssetsLibrary/AssetsLibrary.h> | 7 #import <AssetsLibrary/AssetsLibrary.h> |
8 #import <MobileCoreServices/MobileCoreServices.h> | 8 #import <MobileCoreServices/MobileCoreServices.h> |
9 #import <PassKit/PassKit.h> | 9 #import <PassKit/PassKit.h> |
10 #import <Photos/Photos.h> | 10 #import <Photos/Photos.h> |
(...skipping 1773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1784 } | 1784 } |
1785 | 1785 |
1786 // Create the toolbar model and controller. | 1786 // Create the toolbar model and controller. |
1787 _toolbarModelDelegate.reset( | 1787 _toolbarModelDelegate.reset( |
1788 new ToolbarModelDelegateIOS([_model webStateList])); | 1788 new ToolbarModelDelegateIOS([_model webStateList])); |
1789 _toolbarModelIOS.reset([_dependencyFactory | 1789 _toolbarModelIOS.reset([_dependencyFactory |
1790 newToolbarModelIOSWithDelegate:_toolbarModelDelegate.get()]); | 1790 newToolbarModelIOSWithDelegate:_toolbarModelDelegate.get()]); |
1791 _toolbarController = [_dependencyFactory | 1791 _toolbarController = [_dependencyFactory |
1792 newWebToolbarControllerWithDelegate:self | 1792 newWebToolbarControllerWithDelegate:self |
1793 urlLoader:self | 1793 urlLoader:self |
1794 preloadProvider:_preloadController]; | 1794 preloadProvider:_preloadController |
| 1795 dispatcher:self.browserCommandDispatcher]; |
1795 [_dispatcher startDispatchingToTarget:_toolbarController | 1796 [_dispatcher startDispatchingToTarget:_toolbarController |
1796 forProtocol:@protocol(OmniboxFocuser)]; | 1797 forProtocol:@protocol(OmniboxFocuser)]; |
1797 [_toolbarController setTabCount:[_model count]]; | 1798 [_toolbarController setTabCount:[_model count]]; |
1798 if (_voiceSearchController) | 1799 if (_voiceSearchController) |
1799 _voiceSearchController->SetDelegate(_toolbarController); | 1800 _voiceSearchController->SetDelegate(_toolbarController); |
1800 | 1801 |
1801 // If needed, create the tabstrip. | 1802 // If needed, create the tabstrip. |
1802 if (IsIPadIdiom()) { | 1803 if (IsIPadIdiom()) { |
1803 _tabStripController = | 1804 _tabStripController = |
1804 [_dependencyFactory newTabStripControllerWithTabModel:_model]; | 1805 [_dependencyFactory newTabStripControllerWithTabModel:_model]; |
(...skipping 2200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4005 CGRect cardFrame = {frame.origin, cardSize}; | 4006 CGRect cardFrame = {frame.origin, cardSize}; |
4006 | 4007 |
4007 CardView* card = | 4008 CardView* card = |
4008 [[CardView alloc] initWithFrame:cardFrame isIncognito:_isOffTheRecord]; | 4009 [[CardView alloc] initWithFrame:cardFrame isIncognito:_isOffTheRecord]; |
4009 card.closeButtonSide = IsPortrait() ? CardCloseButtonSide::TRAILING | 4010 card.closeButtonSide = IsPortrait() ? CardCloseButtonSide::TRAILING |
4010 : CardCloseButtonSide::LEADING; | 4011 : CardCloseButtonSide::LEADING; |
4011 [_contentArea addSubview:card]; | 4012 [_contentArea addSubview:card]; |
4012 return card; | 4013 return card; |
4013 } | 4014 } |
4014 | 4015 |
| 4016 #pragma mark - BrowserCommands |
| 4017 |
| 4018 - (void)goBack { |
| 4019 [[_model currentTab] goBack]; |
| 4020 } |
| 4021 |
| 4022 - (void)goForward { |
| 4023 [[_model currentTab] goForward]; |
| 4024 } |
| 4025 |
4015 #pragma mark - Command Handling | 4026 #pragma mark - Command Handling |
4016 | 4027 |
4017 - (IBAction)chromeExecuteCommand:(id)sender { | 4028 - (IBAction)chromeExecuteCommand:(id)sender { |
4018 NSInteger command = [sender tag]; | 4029 NSInteger command = [sender tag]; |
4019 | 4030 |
4020 if (!_model || !_browserState) | 4031 if (!_model || !_browserState) |
4021 return; | 4032 return; |
4022 Tab* currentTab = [_model currentTab]; | 4033 Tab* currentTab = [_model currentTab]; |
4023 | 4034 |
4024 switch (command) { | 4035 switch (command) { |
4025 case IDC_BACK: | |
4026 [[_model currentTab] goBack]; | |
4027 break; | |
4028 case IDC_BOOKMARK_PAGE: | 4036 case IDC_BOOKMARK_PAGE: |
4029 [self initializeBookmarkInteractionController]; | 4037 [self initializeBookmarkInteractionController]; |
4030 [_bookmarkInteractionController | 4038 [_bookmarkInteractionController |
4031 presentBookmarkForTab:[_model currentTab] | 4039 presentBookmarkForTab:[_model currentTab] |
4032 currentlyBookmarked:_toolbarModelIOS->IsCurrentTabBookmarkedByUser() | 4040 currentlyBookmarked:_toolbarModelIOS->IsCurrentTabBookmarkedByUser() |
4033 inView:[_toolbarController bookmarkButtonView] | 4041 inView:[_toolbarController bookmarkButtonView] |
4034 originRect:[_toolbarController bookmarkButtonAnchorRect]]; | 4042 originRect:[_toolbarController bookmarkButtonAnchorRect]]; |
4035 break; | 4043 break; |
4036 case IDC_FIND: | 4044 case IDC_FIND: |
4037 [self initFindBarForTab]; | 4045 [self initFindBarForTab]; |
(...skipping 15 matching lines...) Expand all Loading... |
4053 [_findBarController updateResultsCount:model]; | 4061 [_findBarController updateResultsCount:model]; |
4054 }); | 4062 }); |
4055 break; | 4063 break; |
4056 } | 4064 } |
4057 case IDC_FIND_CLOSE: | 4065 case IDC_FIND_CLOSE: |
4058 [self closeFindInPage]; | 4066 [self closeFindInPage]; |
4059 break; | 4067 break; |
4060 case IDC_FIND_UPDATE: | 4068 case IDC_FIND_UPDATE: |
4061 [self searchFindInPage]; | 4069 [self searchFindInPage]; |
4062 break; | 4070 break; |
4063 case IDC_FORWARD: | |
4064 [[_model currentTab] goForward]; | |
4065 break; | |
4066 case IDC_FULLSCREEN: | 4071 case IDC_FULLSCREEN: |
4067 NOTIMPLEMENTED(); | 4072 NOTIMPLEMENTED(); |
4068 break; | 4073 break; |
4069 case IDC_HELP_PAGE_VIA_MENU: | 4074 case IDC_HELP_PAGE_VIA_MENU: |
4070 [self showHelpPage]; | 4075 [self showHelpPage]; |
4071 break; | 4076 break; |
4072 case IDC_NEW_TAB: | 4077 case IDC_NEW_TAB: |
4073 if (_isOffTheRecord) { | 4078 if (_isOffTheRecord) { |
4074 // Not for this browser state, send it on its way. | 4079 // Not for this browser state, send it on its way. |
4075 [super chromeExecuteCommand:sender]; | 4080 [super chromeExecuteCommand:sender]; |
(...skipping 1151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5227 | 5232 |
5228 - (UIView*)voiceSearchButton { | 5233 - (UIView*)voiceSearchButton { |
5229 return _voiceSearchButton; | 5234 return _voiceSearchButton; |
5230 } | 5235 } |
5231 | 5236 |
5232 - (id<LogoAnimationControllerOwner>)logoAnimationControllerOwner { | 5237 - (id<LogoAnimationControllerOwner>)logoAnimationControllerOwner { |
5233 return [self currentLogoAnimationControllerOwner]; | 5238 return [self currentLogoAnimationControllerOwner]; |
5234 } | 5239 } |
5235 | 5240 |
5236 @end | 5241 @end |
OLD | NEW |