| 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4199 | 4208 |
| 4200 [_printController dismissAnimated:YES]; | 4209 [_printController dismissAnimated:YES]; |
| 4201 _printController.reset(); | 4210 _printController.reset(); |
| 4202 if (_noTabsController.get()) | 4211 if (_noTabsController.get()) |
| 4203 [_noTabsController dismissToolsMenuPopup]; | 4212 [_noTabsController dismissToolsMenuPopup]; |
| 4204 else | 4213 else |
| 4205 [_toolbarController dismissToolsMenuPopup]; | 4214 [_toolbarController dismissToolsMenuPopup]; |
| 4206 [_contextMenuCoordinator stop]; | 4215 [_contextMenuCoordinator stop]; |
| 4207 [self dismissRateThisAppDialog]; | 4216 [self dismissRateThisAppDialog]; |
| 4208 | 4217 |
| 4218 [_suggestionsCoordinator stop]; |
| 4219 |
| 4209 if (self.presentedViewController) { | 4220 if (self.presentedViewController) { |
| 4210 // Dismisses any other modal controllers that may be present, e.g. Recent | 4221 // Dismisses any other modal controllers that may be present, e.g. Recent |
| 4211 // Tabs. | 4222 // Tabs. |
| 4212 // Note that currently, some controllers like the bookmark ones were already | 4223 // Note that currently, some controllers like the bookmark ones were already |
| 4213 // dismissed (in this example in -dismissBookmarkModalControllerAnimated:), | 4224 // dismissed (in this example in -dismissBookmarkModalControllerAnimated:), |
| 4214 // but are still reported as the presentedViewController. The result is that | 4225 // but are still reported as the presentedViewController. The result is that |
| 4215 // this will call -dismissViewControllerAnimated:completion: a second time | 4226 // this will call -dismissViewControllerAnimated:completion: a second time |
| 4216 // on it. It is not per se an issue, as it is a no-op. The problem is that | 4227 // on it. It is not per se an issue, as it is a no-op. The problem is that |
| 4217 // in such a case, the completion block is not called. | 4228 // in such a case, the completion block is not called. |
| 4218 // To ensure the completion is called, nil is passed here, and the | 4229 // To ensure the completion is called, nil is passed here, and the |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4358 | 4369 |
| 4359 - (void)showQRScanner { | 4370 - (void)showQRScanner { |
| 4360 _qrScannerViewController.reset( | 4371 _qrScannerViewController.reset( |
| 4361 [[QRScannerViewController alloc] initWithDelegate:_toolbarController]); | 4372 [[QRScannerViewController alloc] initWithDelegate:_toolbarController]); |
| 4362 [self presentViewController:[_qrScannerViewController | 4373 [self presentViewController:[_qrScannerViewController |
| 4363 getViewControllerToPresent] | 4374 getViewControllerToPresent] |
| 4364 animated:YES | 4375 animated:YES |
| 4365 completion:nil]; | 4376 completion:nil]; |
| 4366 } | 4377 } |
| 4367 | 4378 |
| 4379 - (void)showSuggestionsUI { |
| 4380 if (!_suggestionsCoordinator) { |
| 4381 _suggestionsCoordinator.reset( |
| 4382 [[SuggestionsCoordinator alloc] initWithBaseViewController:self]); |
| 4383 } |
| 4384 [_suggestionsCoordinator start]; |
| 4385 } |
| 4386 |
| 4368 - (void)showNTPPanel:(NewTabPage::PanelIdentifier)panel { | 4387 - (void)showNTPPanel:(NewTabPage::PanelIdentifier)panel { |
| 4369 DCHECK(self.visible || self.dismissingModal); | 4388 DCHECK(self.visible || self.dismissingModal); |
| 4370 GURL url(kChromeUINewTabURL); | 4389 GURL url(kChromeUINewTabURL); |
| 4371 std::string fragment(NewTabPage::FragmentFromIdentifier(panel)); | 4390 std::string fragment(NewTabPage::FragmentFromIdentifier(panel)); |
| 4372 if (fragment != "") { | 4391 if (fragment != "") { |
| 4373 GURL::Replacements replacement; | 4392 GURL::Replacements replacement; |
| 4374 replacement.SetRefStr(fragment); | 4393 replacement.SetRefStr(fragment); |
| 4375 url = url.ReplaceComponents(replacement); | 4394 url = url.ReplaceComponents(replacement); |
| 4376 } | 4395 } |
| 4377 Tab* tab = [_model currentTab]; | 4396 Tab* tab = [_model currentTab]; |
| (...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5141 | 5160 |
| 5142 - (UIView*)voiceSearchButton { | 5161 - (UIView*)voiceSearchButton { |
| 5143 return _voiceSearchButton; | 5162 return _voiceSearchButton; |
| 5144 } | 5163 } |
| 5145 | 5164 |
| 5146 - (id<LogoAnimationControllerOwner>)logoAnimationControllerOwner { | 5165 - (id<LogoAnimationControllerOwner>)logoAnimationControllerOwner { |
| 5147 return [self currentLogoAnimationControllerOwner]; | 5166 return [self currentLogoAnimationControllerOwner]; |
| 5148 } | 5167 } |
| 5149 | 5168 |
| 5150 @end | 5169 @end |
| OLD | NEW |