| 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> |
| 11 #import <QuartzCore/QuartzCore.h> | 11 #import <QuartzCore/QuartzCore.h> |
| 12 | 12 |
| 13 #include <stdint.h> | 13 #include <stdint.h> |
| 14 #include <cmath> | 14 #include <cmath> |
| 15 #include <memory> | 15 #include <memory> |
| 16 | 16 |
| 17 #include "base/base64.h" | 17 #include "base/base64.h" |
| 18 #include "base/command_line.h" | 18 #include "base/command_line.h" |
| 19 #include "base/format_macros.h" | 19 #include "base/format_macros.h" |
| 20 #include "base/i18n/rtl.h" | 20 #include "base/i18n/rtl.h" |
| 21 #include "base/ios/block_types.h" | 21 #include "base/ios/block_types.h" |
| 22 #include "base/ios/ios_util.h" | 22 #include "base/ios/ios_util.h" |
| 23 #include "base/ios/weak_nsobject.h" | 23 #include "base/ios/weak_nsobject.h" |
| 24 #include "base/logging.h" | 24 #include "base/logging.h" |
| 25 #include "base/mac/bind_objc_block.h" | 25 #include "base/mac/bind_objc_block.h" |
| 26 #include "base/mac/bundle_locations.h" | 26 #include "base/mac/bundle_locations.h" |
| 27 #include "base/mac/foundation_util.h" | 27 #include "base/mac/foundation_util.h" |
| 28 #include "base/mac/objc_property_releaser.h" | 28 #include "base/mac/objc_release_properties.h" |
| 29 #import "base/mac/scoped_block.h" | 29 #import "base/mac/scoped_block.h" |
| 30 #import "base/mac/scoped_nsobject.h" | 30 #import "base/mac/scoped_nsobject.h" |
| 31 #include "base/macros.h" | 31 #include "base/macros.h" |
| 32 #include "base/memory/ptr_util.h" | 32 #include "base/memory/ptr_util.h" |
| 33 #include "base/metrics/histogram.h" | 33 #include "base/metrics/histogram.h" |
| 34 #include "base/metrics/user_metrics.h" | 34 #include "base/metrics/user_metrics.h" |
| 35 #include "base/metrics/user_metrics_action.h" | 35 #include "base/metrics/user_metrics_action.h" |
| 36 #include "base/strings/sys_string_conversions.h" | 36 #include "base/strings/sys_string_conversions.h" |
| 37 #include "components/bookmarks/browser/base_bookmark_model_observer.h" | 37 #include "components/bookmarks/browser/base_bookmark_model_observer.h" |
| 38 #include "components/bookmarks/browser/bookmark_model.h" | 38 #include "components/bookmarks/browser/bookmark_model.h" |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 base::scoped_nsobject<NSMapTable> _nativeControllersForTabIDs; | 476 base::scoped_nsobject<NSMapTable> _nativeControllersForTabIDs; |
| 477 | 477 |
| 478 // Notifies the toolbar menu of reading list changes. | 478 // Notifies the toolbar menu of reading list changes. |
| 479 base::scoped_nsobject<ReadingListMenuNotifier> _readingListMenuNotifier; | 479 base::scoped_nsobject<ReadingListMenuNotifier> _readingListMenuNotifier; |
| 480 | 480 |
| 481 // The sender for the last received IDC_VOICE_SEARCH command. | 481 // The sender for the last received IDC_VOICE_SEARCH command. |
| 482 base::WeakNSObject<UIView> _voiceSearchButton; | 482 base::WeakNSObject<UIView> _voiceSearchButton; |
| 483 | 483 |
| 484 // Coordinator for displaying alerts. | 484 // Coordinator for displaying alerts. |
| 485 base::scoped_nsobject<AlertCoordinator> _alertCoordinator; | 485 base::scoped_nsobject<AlertCoordinator> _alertCoordinator; |
| 486 | |
| 487 // Releaser for properties that aren't backed by scoped_nsobjects. | |
| 488 base::mac::ObjCPropertyReleaser _propertyReleaser_BrowserViewController; | |
| 489 } | 486 } |
| 490 | 487 |
| 491 // The browser's side swipe controller. Lazily instantiated on the first call. | 488 // The browser's side swipe controller. Lazily instantiated on the first call. |
| 492 @property(nonatomic, retain, readonly) SideSwipeController* sideSwipeController; | 489 @property(nonatomic, retain, readonly) SideSwipeController* sideSwipeController; |
| 493 // The browser's preload controller. | 490 // The browser's preload controller. |
| 494 @property(nonatomic, retain, readonly) PreloadController* preloadController; | 491 @property(nonatomic, retain, readonly) PreloadController* preloadController; |
| 495 // The dialog presenter for this BVC's tab model. | 492 // The dialog presenter for this BVC's tab model. |
| 496 @property(nonatomic, retain, readonly) DialogPresenter* dialogPresenter; | 493 @property(nonatomic, retain, readonly) DialogPresenter* dialogPresenter; |
| 497 // The object that manages keyboard commands on behalf of the BVC. | 494 // The object that manages keyboard commands on behalf of the BVC. |
| 498 @property(nonatomic, retain, readonly) KeyCommandsProvider* keyCommandsProvider; | 495 @property(nonatomic, retain, readonly) KeyCommandsProvider* keyCommandsProvider; |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 893 | 890 |
| 894 #pragma mark - Object lifecycle | 891 #pragma mark - Object lifecycle |
| 895 | 892 |
| 896 - (instancetype)initWithTabModel:(TabModel*)model | 893 - (instancetype)initWithTabModel:(TabModel*)model |
| 897 browserState:(ios::ChromeBrowserState*)browserState | 894 browserState:(ios::ChromeBrowserState*)browserState |
| 898 dependencyFactory: | 895 dependencyFactory: |
| 899 (BrowserViewControllerDependencyFactory*)factory { | 896 (BrowserViewControllerDependencyFactory*)factory { |
| 900 self = [super initWithNibName:nil bundle:base::mac::FrameworkBundle()]; | 897 self = [super initWithNibName:nil bundle:base::mac::FrameworkBundle()]; |
| 901 if (self) { | 898 if (self) { |
| 902 DCHECK(factory); | 899 DCHECK(factory); |
| 903 _propertyReleaser_BrowserViewController.Init(self, | |
| 904 [BrowserViewController class]); | |
| 905 _imageFetcher = base::MakeUnique<web::ImageDataFetcher>( | 900 _imageFetcher = base::MakeUnique<web::ImageDataFetcher>( |
| 906 web::WebThread::GetBlockingPool()); | 901 web::WebThread::GetBlockingPool()); |
| 907 _dependencyFactory.reset([factory retain]); | 902 _dependencyFactory.reset([factory retain]); |
| 908 _nativeControllersForTabIDs.reset( | 903 _nativeControllersForTabIDs.reset( |
| 909 [[NSMapTable strongToWeakObjectsMapTable] retain]); | 904 [[NSMapTable strongToWeakObjectsMapTable] retain]); |
| 910 _dialogPresenter.reset([[DialogPresenter alloc] initWithDelegate:self | 905 _dialogPresenter.reset([[DialogPresenter alloc] initWithDelegate:self |
| 911 presentingViewController:self]); | 906 presentingViewController:self]); |
| 912 _javaScriptDialogPresenter.reset( | 907 _javaScriptDialogPresenter.reset( |
| 913 new JavaScriptDialogPresenterImpl(_dialogPresenter)); | 908 new JavaScriptDialogPresenterImpl(_dialogPresenter)); |
| 914 _webStateDelegate.reset(new web::WebStateDelegateBridge(self)); | 909 _webStateDelegate.reset(new web::WebStateDelegateBridge(self)); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 944 BrowserListIOS::RemoveBrowser(self); | 939 BrowserListIOS::RemoveBrowser(self); |
| 945 _bookmarkModel->RemoveObserver(_bookmarkModelBridge.get()); | 940 _bookmarkModel->RemoveObserver(_bookmarkModelBridge.get()); |
| 946 [_model removeObserver:self]; | 941 [_model removeObserver:self]; |
| 947 [[UpgradeCenter sharedInstance] unregisterClient:self]; | 942 [[UpgradeCenter sharedInstance] unregisterClient:self]; |
| 948 [[NSNotificationCenter defaultCenter] removeObserver:self]; | 943 [[NSNotificationCenter defaultCenter] removeObserver:self]; |
| 949 [_toolbarController setDelegate:nil]; | 944 [_toolbarController setDelegate:nil]; |
| 950 if (_voiceSearchController.get()) | 945 if (_voiceSearchController.get()) |
| 951 _voiceSearchController->SetDelegate(nil); | 946 _voiceSearchController->SetDelegate(nil); |
| 952 [_rateThisAppDialog setDelegate:nil]; | 947 [_rateThisAppDialog setDelegate:nil]; |
| 953 [_model closeAllTabs]; | 948 [_model closeAllTabs]; |
| 949 base::mac::ReleaseProperties(self); |
| 954 [super dealloc]; | 950 [super dealloc]; |
| 955 } | 951 } |
| 956 | 952 |
| 957 #pragma mark - Accessibility | 953 #pragma mark - Accessibility |
| 958 | 954 |
| 959 - (BOOL)accessibilityPerformEscape { | 955 - (BOOL)accessibilityPerformEscape { |
| 960 [self dismissPopups]; | 956 [self dismissPopups]; |
| 961 return YES; | 957 return YES; |
| 962 } | 958 } |
| 963 | 959 |
| (...skipping 4133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5097 | 5093 |
| 5098 - (UIView*)voiceSearchButton { | 5094 - (UIView*)voiceSearchButton { |
| 5099 return _voiceSearchButton; | 5095 return _voiceSearchButton; |
| 5100 } | 5096 } |
| 5101 | 5097 |
| 5102 - (id<LogoAnimationControllerOwner>)logoAnimationControllerOwner { | 5098 - (id<LogoAnimationControllerOwner>)logoAnimationControllerOwner { |
| 5103 return [self currentLogoAnimationControllerOwner]; | 5099 return [self currentLogoAnimationControllerOwner]; |
| 5104 } | 5100 } |
| 5105 | 5101 |
| 5106 @end | 5102 @end |
| OLD | NEW |