Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Unified Diff: ios/chrome/browser/ui/browser_view_controller.mm

Issue 2829003002: Add CommandDispatcher to BrowserViewController. (Closed)
Patch Set: rohit comments Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/chrome/browser/ui/BUILD.gn ('k') | ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/ui/browser_view_controller.mm
diff --git a/ios/chrome/browser/ui/browser_view_controller.mm b/ios/chrome/browser/ui/browser_view_controller.mm
index 1c37fbc1a769f21af80830a4e505b8549a07ccd0..f9c0d98cb20e905a94d91ae4521d314f2dc2ea45 100644
--- a/ios/chrome/browser/ui/browser_view_controller.mm
+++ b/ios/chrome/browser/ui/browser_view_controller.mm
@@ -169,6 +169,7 @@
#include "ios/public/provider/chrome/browser/voice/voice_search_controller.h"
#include "ios/public/provider/chrome/browser/voice/voice_search_controller_delegate.h"
#include "ios/public/provider/chrome/browser/voice/voice_search_provider.h"
+#import "ios/shared/chrome/browser/ui/commands/command_dispatcher.h"
#import "ios/shared/chrome/browser/ui/tools_menu/tools_menu_configuration.h"
#include "ios/web/public/active_state_manager.h"
#include "ios/web/public/navigation_item.h"
@@ -400,6 +401,9 @@ NSString* const kNativeControllerTemporaryKey = @"NativeControllerTemporaryKey";
// Handles presentation of JavaScript dialogs.
std::unique_ptr<JavaScriptDialogPresenterImpl> _javaScriptDialogPresenter;
+ // Handles command dispatching.
+ CommandDispatcher* _dispatcher;
+
// Keyboard commands provider. It offloads most of the keyboard commands
// management off of the BVC.
KeyCommandsProvider* _keyCommandsProvider;
@@ -948,6 +952,14 @@ class BrowserBookmarkModelBridge : public bookmarks::BookmarkModelObserver {
_nativeControllersForTabIDs = [NSMapTable strongToWeakObjectsMapTable];
_dialogPresenter = [[DialogPresenter alloc] initWithDelegate:self
presentingViewController:self];
+ _dispatcher = [[CommandDispatcher alloc] init];
+ [_dispatcher startDispatchingToTarget:self
+ forProtocol:@protocol(UrlLoader)];
+ [_dispatcher startDispatchingToTarget:self
+ forProtocol:@protocol(WebToolbarDelegate)];
+ [_dispatcher startDispatchingToTarget:self
+ forSelector:@selector(chromeExecuteCommand:)];
+
_javaScriptDialogPresenter.reset(
new JavaScriptDialogPresenterImpl(_dialogPresenter));
_webStateDelegate.reset(new web::WebStateDelegateBridge(self));
@@ -1716,6 +1728,8 @@ class BrowserBookmarkModelBridge : public bookmarks::BookmarkModelObserver {
// The file remover needs the browser state, so needs to be destroyed now.
_externalFileRemover = nil;
_browserState = nullptr;
+ [_dispatcher stopDispatchingToTarget:self];
+ _dispatcher = nil;
}
- (void)installFakeStatusBar {
@@ -1762,6 +1776,8 @@ class BrowserBookmarkModelBridge : public bookmarks::BookmarkModelObserver {
newWebToolbarControllerWithDelegate:self
urlLoader:self
preloadProvider:_preloadController];
+ [_dispatcher startDispatchingToTarget:_toolbarController
+ forProtocol:@protocol(OmniboxFocuser)];
[_toolbarController setTabCount:[_model count]];
if (_voiceSearchController)
_voiceSearchController->SetDelegate(_toolbarController);
@@ -3028,7 +3044,8 @@ class BrowserBookmarkModelBridge : public bookmarks::BookmarkModelObserver {
colorCache:_dominantColorCache
webToolbarDelegate:self
tabModel:_model
- parentViewController:self];
+ parentViewController:self
+ dispatcher:_dispatcher];
pageController.swipeRecognizerProvider = self.sideSwipeController;
// Panel is always NTP for iPhone.
« no previous file with comments | « ios/chrome/browser/ui/BUILD.gn ('k') | ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698