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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
68 #include "ios/chrome/browser/pref_names.h" | 68 #include "ios/chrome/browser/pref_names.h" |
69 #include "ios/chrome/browser/reading_list/reading_list_model_factory.h" | 69 #include "ios/chrome/browser/reading_list/reading_list_model_factory.h" |
70 #include "ios/chrome/browser/search_engines/template_url_service_factory.h" | 70 #include "ios/chrome/browser/search_engines/template_url_service_factory.h" |
71 #include "ios/chrome/browser/sessions/ios_chrome_tab_restore_service_factory.h" | 71 #include "ios/chrome/browser/sessions/ios_chrome_tab_restore_service_factory.h" |
72 #include "ios/chrome/browser/sessions/tab_restore_service_delegate_impl_ios.h" | 72 #include "ios/chrome/browser/sessions/tab_restore_service_delegate_impl_ios.h" |
73 #include "ios/chrome/browser/sessions/tab_restore_service_delegate_impl_ios_fact ory.h" | 73 #include "ios/chrome/browser/sessions/tab_restore_service_delegate_impl_ios_fact ory.h" |
74 #import "ios/chrome/browser/snapshots/snapshot_cache.h" | 74 #import "ios/chrome/browser/snapshots/snapshot_cache.h" |
75 #import "ios/chrome/browser/snapshots/snapshot_overlay.h" | 75 #import "ios/chrome/browser/snapshots/snapshot_overlay.h" |
76 #import "ios/chrome/browser/snapshots/snapshot_overlay_provider.h" | 76 #import "ios/chrome/browser/snapshots/snapshot_overlay_provider.h" |
77 #import "ios/chrome/browser/storekit_launcher.h" | 77 #import "ios/chrome/browser/storekit_launcher.h" |
78 #import "ios/chrome/browser/suggestions/suggestions_coordinator.h" | |
78 #import "ios/chrome/browser/tabs/tab.h" | 79 #import "ios/chrome/browser/tabs/tab.h" |
79 #import "ios/chrome/browser/tabs/tab_dialog_delegate.h" | 80 #import "ios/chrome/browser/tabs/tab_dialog_delegate.h" |
80 #import "ios/chrome/browser/tabs/tab_headers_delegate.h" | 81 #import "ios/chrome/browser/tabs/tab_headers_delegate.h" |
81 #import "ios/chrome/browser/tabs/tab_model.h" | 82 #import "ios/chrome/browser/tabs/tab_model.h" |
82 #import "ios/chrome/browser/tabs/tab_model_observer.h" | 83 #import "ios/chrome/browser/tabs/tab_model_observer.h" |
83 #import "ios/chrome/browser/tabs/tab_snapshotting_delegate.h" | 84 #import "ios/chrome/browser/tabs/tab_snapshotting_delegate.h" |
84 #import "ios/chrome/browser/ui/activity_services/share_protocol.h" | 85 #import "ios/chrome/browser/ui/activity_services/share_protocol.h" |
85 #import "ios/chrome/browser/ui/activity_services/share_to_data.h" | 86 #import "ios/chrome/browser/ui/activity_services/share_to_data.h" |
86 #import "ios/chrome/browser/ui/alert_coordinator/alert_coordinator.h" | 87 #import "ios/chrome/browser/ui/alert_coordinator/alert_coordinator.h" |
87 #import "ios/chrome/browser/ui/authentication/re_signin_infobar_delegate.h" | 88 #import "ios/chrome/browser/ui/authentication/re_signin_infobar_delegate.h" |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
380 | 381 |
381 // Used to display the Page Info UI. Nil if not visible. | 382 // Used to display the Page Info UI. Nil if not visible. |
382 base::scoped_nsobject<PageInfoViewController> _pageInfoController; | 383 base::scoped_nsobject<PageInfoViewController> _pageInfoController; |
383 | 384 |
384 // Used to display the Voice Search UI. Nil if not visible. | 385 // Used to display the Voice Search UI. Nil if not visible. |
385 scoped_refptr<VoiceSearchController> _voiceSearchController; | 386 scoped_refptr<VoiceSearchController> _voiceSearchController; |
386 | 387 |
387 // Used to display the QR Scanner UI. Nil if not visible. | 388 // Used to display the QR Scanner UI. Nil if not visible. |
388 base::scoped_nsobject<QRScannerViewController> _qrScannerViewController; | 389 base::scoped_nsobject<QRScannerViewController> _qrScannerViewController; |
389 | 390 |
391 // Used to display the Suggestions. | |
392 base::scoped_nsobject<SuggestionsCoordinator> _suggestionsCoordinator; | |
393 | |
390 // Used to display the Find In Page UI. Nil if not visible. | 394 // Used to display the Find In Page UI. Nil if not visible. |
391 base::scoped_nsobject<FindBarControllerIOS> _findBarController; | 395 base::scoped_nsobject<FindBarControllerIOS> _findBarController; |
392 | 396 |
393 // Used to display the No-Tabs UI for iPads. Nil if not visible. | 397 // Used to display the No-Tabs UI for iPads. Nil if not visible. |
394 base::scoped_nsobject<NoTabsController> _noTabsController; | 398 base::scoped_nsobject<NoTabsController> _noTabsController; |
395 | 399 |
396 // Used to display the Print UI. Nil if not visible. | 400 // Used to display the Print UI. Nil if not visible. |
397 base::scoped_nsobject<PrintController> _printController; | 401 base::scoped_nsobject<PrintController> _printController; |
398 | 402 |
399 // Records the set of domains for which full screen alert has already been | 403 // Records the set of domains for which full screen alert has already been |
(...skipping 3694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4094 // before sending the command up the responder chain. | 4098 // before sending the command up the responder chain. |
4095 if ([sender isKindOfClass:[UIView class]]) | 4099 if ([sender isKindOfClass:[UIView class]]) |
4096 _voiceSearchButton.reset(sender); | 4100 _voiceSearchButton.reset(sender); |
4097 [super chromeExecuteCommand:sender]; | 4101 [super chromeExecuteCommand:sender]; |
4098 break; | 4102 break; |
4099 case IDC_SHOW_QR_SCANNER: | 4103 case IDC_SHOW_QR_SCANNER: |
4100 if (experimental_flags::IsQRCodeReaderEnabled()) { | 4104 if (experimental_flags::IsQRCodeReaderEnabled()) { |
4101 [self showQRScanner]; | 4105 [self showQRScanner]; |
4102 } | 4106 } |
4103 break; | 4107 break; |
4108 case IDC_SHOW_SUGGESTIONS_UI: | |
4109 if (experimental_flags::IsSuggestionsUIEnabled()) { | |
4110 [self showSuggestionsUI]; | |
4111 } | |
4112 break; | |
4104 default: | 4113 default: |
4105 // Unknown commands get sent up the responder chain. | 4114 // Unknown commands get sent up the responder chain. |
4106 [super chromeExecuteCommand:sender]; | 4115 [super chromeExecuteCommand:sender]; |
4107 break; | 4116 break; |
4108 } | 4117 } |
4109 } | 4118 } |
4110 | 4119 |
4111 - (void)closeCurrentTab { | 4120 - (void)closeCurrentTab { |
4112 Tab* currentTab = [_model currentTab]; | 4121 Tab* currentTab = [_model currentTab]; |
4113 NSUInteger tabIndex = [_model indexOfTab:currentTab]; | 4122 NSUInteger tabIndex = [_model indexOfTab:currentTab]; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4172 CGRect fromRect = [_toolbarController shareButtonAnchorRect]; | 4181 CGRect fromRect = [_toolbarController shareButtonAnchorRect]; |
4173 UIView* inView = [_toolbarController shareButtonView]; | 4182 UIView* inView = [_toolbarController shareButtonView]; |
4174 [controller shareWithData:data | 4183 [controller shareWithData:data |
4175 controller:self | 4184 controller:self |
4176 browserState:_browserState | 4185 browserState:_browserState |
4177 shareToDelegate:self | 4186 shareToDelegate:self |
4178 fromRect:fromRect | 4187 fromRect:fromRect |
4179 inView:inView]; | 4188 inView:inView]; |
4180 } | 4189 } |
4181 | 4190 |
4182 - (void)clearPresentedStateWithCompletion:(ProceduralBlock)completion { | 4191 - (void)clearPresentedStateWithCompletion:(ProceduralBlock)completion { |
lpromero
2017/01/18 13:32:15
You probably need to add a call to stop there (or
gambard
2017/01/18 14:34:47
Done.
| |
4183 [[_dependencyFactory shareControllerInstance] cancelShareAnimated:NO]; | 4192 [[_dependencyFactory shareControllerInstance] cancelShareAnimated:NO]; |
4184 [_bookmarkInteractionController dismissBookmarkModalControllerAnimated:NO]; | 4193 [_bookmarkInteractionController dismissBookmarkModalControllerAnimated:NO]; |
4185 [_bookmarkInteractionController dismissSnackbar]; | 4194 [_bookmarkInteractionController dismissSnackbar]; |
4186 [_toolbarController cancelOmniboxEdit]; | 4195 [_toolbarController cancelOmniboxEdit]; |
4187 [_dialogPresenter cancelAllDialogs]; | 4196 [_dialogPresenter cancelAllDialogs]; |
4188 [self hidePageInfoPopupForView:nil]; | 4197 [self hidePageInfoPopupForView:nil]; |
4189 if (_voiceSearchController) | 4198 if (_voiceSearchController) |
4190 _voiceSearchController->DismissMicPermissionsHelp(); | 4199 _voiceSearchController->DismissMicPermissionsHelp(); |
4191 [[_model currentTab] dismissModals]; | 4200 [[_model currentTab] dismissModals]; |
4192 [[_model currentTab].findInPageController | 4201 [[_model currentTab].findInPageController |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4358 | 4367 |
4359 - (void)showQRScanner { | 4368 - (void)showQRScanner { |
4360 _qrScannerViewController.reset( | 4369 _qrScannerViewController.reset( |
4361 [[QRScannerViewController alloc] initWithDelegate:_toolbarController]); | 4370 [[QRScannerViewController alloc] initWithDelegate:_toolbarController]); |
4362 [self presentViewController:[_qrScannerViewController | 4371 [self presentViewController:[_qrScannerViewController |
4363 getViewControllerToPresent] | 4372 getViewControllerToPresent] |
4364 animated:YES | 4373 animated:YES |
4365 completion:nil]; | 4374 completion:nil]; |
4366 } | 4375 } |
4367 | 4376 |
4377 - (void)showSuggestionsUI { | |
lpromero
2017/01/18 13:32:15
This could be called twice in a row (for example w
gambard
2017/01/18 14:34:47
Fixed in the coordinator.
| |
4378 if (!_suggestionsCoordinator) { | |
4379 _suggestionsCoordinator.reset( | |
4380 [[SuggestionsCoordinator alloc] initWithBaseViewController:self]); | |
4381 } | |
4382 [_suggestionsCoordinator start]; | |
4383 } | |
4384 | |
4368 - (void)showNTPPanel:(NewTabPage::PanelIdentifier)panel { | 4385 - (void)showNTPPanel:(NewTabPage::PanelIdentifier)panel { |
4369 DCHECK(self.visible || self.dismissingModal); | 4386 DCHECK(self.visible || self.dismissingModal); |
4370 GURL url(kChromeUINewTabURL); | 4387 GURL url(kChromeUINewTabURL); |
4371 std::string fragment(NewTabPage::FragmentFromIdentifier(panel)); | 4388 std::string fragment(NewTabPage::FragmentFromIdentifier(panel)); |
4372 if (fragment != "") { | 4389 if (fragment != "") { |
4373 GURL::Replacements replacement; | 4390 GURL::Replacements replacement; |
4374 replacement.SetRefStr(fragment); | 4391 replacement.SetRefStr(fragment); |
4375 url = url.ReplaceComponents(replacement); | 4392 url = url.ReplaceComponents(replacement); |
4376 } | 4393 } |
4377 Tab* tab = [_model currentTab]; | 4394 Tab* tab = [_model currentTab]; |
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5141 | 5158 |
5142 - (UIView*)voiceSearchButton { | 5159 - (UIView*)voiceSearchButton { |
5143 return _voiceSearchButton; | 5160 return _voiceSearchButton; |
5144 } | 5161 } |
5145 | 5162 |
5146 - (id<LogoAnimationControllerOwner>)logoAnimationControllerOwner { | 5163 - (id<LogoAnimationControllerOwner>)logoAnimationControllerOwner { |
5147 return [self currentLogoAnimationControllerOwner]; | 5164 return [self currentLogoAnimationControllerOwner]; |
5148 } | 5165 } |
5149 | 5166 |
5150 @end | 5167 @end |
OLD | NEW |