| 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/files/file_path.h" | 19 #include "base/files/file_path.h" |
| 20 #include "base/format_macros.h" | 20 #include "base/format_macros.h" |
| 21 #include "base/i18n/rtl.h" | 21 #include "base/i18n/rtl.h" |
| 22 #include "base/ios/block_types.h" | 22 #include "base/ios/block_types.h" |
| 23 #include "base/ios/ios_util.h" | 23 #include "base/ios/ios_util.h" |
| 24 #include "base/ios/weak_nsobject.h" | 24 #include "base/ios/weak_nsobject.h" |
| 25 #include "base/logging.h" | 25 #include "base/logging.h" |
| 26 #include "base/mac/bind_objc_block.h" | 26 #include "base/mac/bind_objc_block.h" |
| 27 #include "base/mac/bundle_locations.h" | 27 #include "base/mac/bundle_locations.h" |
| 28 #include "base/mac/foundation_util.h" | 28 #include "base/mac/foundation_util.h" |
| 29 #include "base/mac/objc_property_releaser.h" | 29 #include "base/mac/objc_release_properties.h" |
| 30 #import "base/mac/scoped_block.h" | 30 #import "base/mac/scoped_block.h" |
| 31 #import "base/mac/scoped_nsobject.h" | 31 #import "base/mac/scoped_nsobject.h" |
| 32 #include "base/macros.h" | 32 #include "base/macros.h" |
| 33 #include "base/memory/ptr_util.h" | 33 #include "base/memory/ptr_util.h" |
| 34 #include "base/metrics/histogram_macros.h" | 34 #include "base/metrics/histogram_macros.h" |
| 35 #include "base/metrics/user_metrics.h" | 35 #include "base/metrics/user_metrics.h" |
| 36 #include "base/metrics/user_metrics_action.h" | 36 #include "base/metrics/user_metrics_action.h" |
| 37 #include "base/strings/sys_string_conversions.h" | 37 #include "base/strings/sys_string_conversions.h" |
| 38 #include "components/bookmarks/browser/base_bookmark_model_observer.h" | 38 #include "components/bookmarks/browser/base_bookmark_model_observer.h" |
| 39 #include "components/bookmarks/browser/bookmark_model.h" | 39 #include "components/bookmarks/browser/bookmark_model.h" |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 base::scoped_nsobject<NSMapTable> _nativeControllersForTabIDs; | 488 base::scoped_nsobject<NSMapTable> _nativeControllersForTabIDs; |
| 489 | 489 |
| 490 // Notifies the toolbar menu of reading list changes. | 490 // Notifies the toolbar menu of reading list changes. |
| 491 base::scoped_nsobject<ReadingListMenuNotifier> _readingListMenuNotifier; | 491 base::scoped_nsobject<ReadingListMenuNotifier> _readingListMenuNotifier; |
| 492 | 492 |
| 493 // The sender for the last received IDC_VOICE_SEARCH command. | 493 // The sender for the last received IDC_VOICE_SEARCH command. |
| 494 base::WeakNSObject<UIView> _voiceSearchButton; | 494 base::WeakNSObject<UIView> _voiceSearchButton; |
| 495 | 495 |
| 496 // Coordinator for displaying alerts. | 496 // Coordinator for displaying alerts. |
| 497 base::scoped_nsobject<AlertCoordinator> _alertCoordinator; | 497 base::scoped_nsobject<AlertCoordinator> _alertCoordinator; |
| 498 | |
| 499 // Releaser for properties that aren't backed by scoped_nsobjects. | |
| 500 base::mac::ObjCPropertyReleaser _propertyReleaser_BrowserViewController; | |
| 501 } | 498 } |
| 502 | 499 |
| 503 // The browser's side swipe controller. Lazily instantiated on the first call. | 500 // The browser's side swipe controller. Lazily instantiated on the first call. |
| 504 @property(nonatomic, retain, readonly) SideSwipeController* sideSwipeController; | 501 @property(nonatomic, retain, readonly) SideSwipeController* sideSwipeController; |
| 505 // The browser's preload controller. | 502 // The browser's preload controller. |
| 506 @property(nonatomic, retain, readonly) PreloadController* preloadController; | 503 @property(nonatomic, retain, readonly) PreloadController* preloadController; |
| 507 // The dialog presenter for this BVC's tab model. | 504 // The dialog presenter for this BVC's tab model. |
| 508 @property(nonatomic, retain, readonly) DialogPresenter* dialogPresenter; | 505 @property(nonatomic, retain, readonly) DialogPresenter* dialogPresenter; |
| 509 // The object that manages keyboard commands on behalf of the BVC. | 506 // The object that manages keyboard commands on behalf of the BVC. |
| 510 @property(nonatomic, retain, readonly) KeyCommandsProvider* keyCommandsProvider; | 507 @property(nonatomic, retain, readonly) KeyCommandsProvider* keyCommandsProvider; |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 897 | 894 |
| 898 #pragma mark - Object lifecycle | 895 #pragma mark - Object lifecycle |
| 899 | 896 |
| 900 - (instancetype)initWithTabModel:(TabModel*)model | 897 - (instancetype)initWithTabModel:(TabModel*)model |
| 901 browserState:(ios::ChromeBrowserState*)browserState | 898 browserState:(ios::ChromeBrowserState*)browserState |
| 902 dependencyFactory: | 899 dependencyFactory: |
| 903 (BrowserViewControllerDependencyFactory*)factory { | 900 (BrowserViewControllerDependencyFactory*)factory { |
| 904 self = [super initWithNibName:nil bundle:base::mac::FrameworkBundle()]; | 901 self = [super initWithNibName:nil bundle:base::mac::FrameworkBundle()]; |
| 905 if (self) { | 902 if (self) { |
| 906 DCHECK(factory); | 903 DCHECK(factory); |
| 907 _propertyReleaser_BrowserViewController.Init(self, | |
| 908 [BrowserViewController class]); | |
| 909 _dependencyFactory.reset([factory retain]); | 904 _dependencyFactory.reset([factory retain]); |
| 910 _nativeControllersForTabIDs.reset( | 905 _nativeControllersForTabIDs.reset( |
| 911 [[NSMapTable strongToWeakObjectsMapTable] retain]); | 906 [[NSMapTable strongToWeakObjectsMapTable] retain]); |
| 912 _dialogPresenter.reset([[DialogPresenter alloc] initWithDelegate:self | 907 _dialogPresenter.reset([[DialogPresenter alloc] initWithDelegate:self |
| 913 presentingViewController:self]); | 908 presentingViewController:self]); |
| 914 _javaScriptDialogPresenter.reset( | 909 _javaScriptDialogPresenter.reset( |
| 915 new JavaScriptDialogPresenterImpl(_dialogPresenter)); | 910 new JavaScriptDialogPresenterImpl(_dialogPresenter)); |
| 916 _webStateDelegate.reset(new web::WebStateDelegateBridge(self)); | 911 _webStateDelegate.reset(new web::WebStateDelegateBridge(self)); |
| 917 // TODO(leng): Delay this. | 912 // TODO(leng): Delay this. |
| 918 [[UpgradeCenter sharedInstance] registerClient:self]; | 913 [[UpgradeCenter sharedInstance] registerClient:self]; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 945 if (_bookmarkModel) | 940 if (_bookmarkModel) |
| 946 _bookmarkModel->RemoveObserver(_bookmarkModelBridge.get()); | 941 _bookmarkModel->RemoveObserver(_bookmarkModelBridge.get()); |
| 947 [_model removeObserver:self]; | 942 [_model removeObserver:self]; |
| 948 [[UpgradeCenter sharedInstance] unregisterClient:self]; | 943 [[UpgradeCenter sharedInstance] unregisterClient:self]; |
| 949 [[NSNotificationCenter defaultCenter] removeObserver:self]; | 944 [[NSNotificationCenter defaultCenter] removeObserver:self]; |
| 950 [_toolbarController setDelegate:nil]; | 945 [_toolbarController setDelegate:nil]; |
| 951 if (_voiceSearchController.get()) | 946 if (_voiceSearchController.get()) |
| 952 _voiceSearchController->SetDelegate(nil); | 947 _voiceSearchController->SetDelegate(nil); |
| 953 [_rateThisAppDialog setDelegate:nil]; | 948 [_rateThisAppDialog setDelegate:nil]; |
| 954 [_model closeAllTabs]; | 949 [_model closeAllTabs]; |
| 950 base::mac::ReleaseProperties(self); |
| 955 [super dealloc]; | 951 [super dealloc]; |
| 956 } | 952 } |
| 957 | 953 |
| 958 #pragma mark - Accessibility | 954 #pragma mark - Accessibility |
| 959 | 955 |
| 960 - (BOOL)accessibilityPerformEscape { | 956 - (BOOL)accessibilityPerformEscape { |
| 961 [self dismissPopups]; | 957 [self dismissPopups]; |
| 962 return YES; | 958 return YES; |
| 963 } | 959 } |
| 964 | 960 |
| (...skipping 4032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4997 | 4993 |
| 4998 - (UIView*)voiceSearchButton { | 4994 - (UIView*)voiceSearchButton { |
| 4999 return _voiceSearchButton; | 4995 return _voiceSearchButton; |
| 5000 } | 4996 } |
| 5001 | 4997 |
| 5002 - (id<LogoAnimationControllerOwner>)logoAnimationControllerOwner { | 4998 - (id<LogoAnimationControllerOwner>)logoAnimationControllerOwner { |
| 5003 return [self currentLogoAnimationControllerOwner]; | 4999 return [self currentLogoAnimationControllerOwner]; |
| 5004 } | 5000 } |
| 5005 | 5001 |
| 5006 @end | 5002 @end |
| OLD | NEW |