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/ntp/new_tab_page_toolbar_controller.mm

Issue 2829003002: Add CommandDispatcher to BrowserViewController. (Closed)
Patch Set: Cleaner 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
Index: ios/chrome/browser/ui/ntp/new_tab_page_toolbar_controller.mm
diff --git a/ios/chrome/browser/ui/ntp/new_tab_page_toolbar_controller.mm b/ios/chrome/browser/ui/ntp/new_tab_page_toolbar_controller.mm
index 5b91724b4bedb85f69880c1f3e457a1e14dedf56..48df1af307f2d7cdb99ede1675ec2d5353dea782 100644
--- a/ios/chrome/browser/ui/ntp/new_tab_page_toolbar_controller.mm
+++ b/ios/chrome/browser/ui/ntp/new_tab_page_toolbar_controller.mm
@@ -13,6 +13,7 @@
#import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h"
#import "ios/chrome/browser/ui/commands/generic_chrome_command.h"
#include "ios/chrome/browser/ui/commands/ios_command_ids.h"
+#import "ios/chrome/browser/ui/ntp/google_landing_commands.h"
#import "ios/chrome/browser/ui/ntp/google_landing_data_source.h"
#import "ios/chrome/browser/ui/rtl_geometry.h"
#include "ios/chrome/browser/ui/toolbar/toolbar_resource_macros.h"
@@ -43,19 +44,17 @@ enum {
base::scoped_nsobject<UIButton> _backButton;
base::scoped_nsobject<UIButton> _forwardButton;
base::scoped_nsobject<UIButton> _omniboxFocuser;
-
- base::WeakNSProtocol<id<GoogleLandingDataSource>> _dataSource;
}
@end
@implementation NewTabPageToolbarController
-- (instancetype)initWithToolbarDataSource:
- (id<GoogleLandingDataSource>)dataSource {
+@synthesize dispatcher = _dispatcher;
+
+- (instancetype)initWithToolbar {
self = [super initWithStyle:ToolbarControllerStyleLightMode];
if (self) {
- _dataSource.reset(dataSource);
[self.backgroundView setHidden:YES];
CGFloat boundingWidth = self.view.bounds.size.width;
@@ -201,18 +200,18 @@ enum {
- (void)hideViewsForNewTabPage:(BOOL)hide {
[super hideViewsForNewTabPage:hide];
// Show the back/forward buttons if there is forward history.
- BOOL forwardEnabled = [_dataSource canGoForward];
+ BOOL forwardEnabled = [self.dispatcher canGoForward];
[_backButton setHidden:!forwardEnabled && hide];
- [_backButton setEnabled:[_dataSource canGoBack]];
+ [_backButton setEnabled:[self.dispatcher canGoBack]];
[_forwardButton setHidden:!forwardEnabled && hide];
}
- (void)focusOmnibox:(id)sender {
- [_dataSource focusFakebox];
+ [self.dispatcher focusFakebox];
}
- (IBAction)stackButtonTouchDown:(id)sender {
- [_dataSource prepareToEnterTabSwitcher:self];
+ [self.dispatcher prepareToEnterTabSwitcher:self];
}
@end

Powered by Google App Engine
This is Rietveld 408576698