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

Unified Diff: ios/chrome/browser/ui/ntp/google_landing_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/google_landing_controller.mm
diff --git a/ios/chrome/browser/ui/ntp/google_landing_controller.mm b/ios/chrome/browser/ui/ntp/google_landing_controller.mm
index 8c675207dace2884bd99c9ab57b365f7bb2e9087..a0e9fe48a5c23b903ed9c36b5dfb230d7915aa1a 100644
--- a/ios/chrome/browser/ui/ntp/google_landing_controller.mm
+++ b/ios/chrome/browser/ui/ntp/google_landing_controller.mm
@@ -14,6 +14,7 @@
#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/context_menu/context_menu_coordinator.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/ntp/most_visited_cell.h"
#import "ios/chrome/browser/ui/ntp/most_visited_layout.h"
@@ -21,6 +22,7 @@
#import "ios/chrome/browser/ui/ntp/new_tab_page_header_view.h"
#import "ios/chrome/browser/ui/ntp/whats_new_header_view.h"
#import "ios/chrome/browser/ui/overscroll_actions/overscroll_actions_controller.h"
+#import "ios/chrome/browser/ui/toolbar/web_toolbar_controller.h"
#include "ios/chrome/browser/ui/ui_util.h"
#import "ios/chrome/browser/ui/uikit_ui_util.h"
#include "ios/chrome/common/string_util.h"
@@ -229,6 +231,7 @@ const CGFloat kMostVisitedPaddingIPadFavicon = 24;
@synthesize dataSource = _dataSource;
// Property declared in NewTabPagePanelProtocol.
@synthesize delegate = _delegate;
+@synthesize dispatcher = _dispatcher;
@synthesize isOffTheRecord = _isOffTheRecord;
@synthesize logoIsShowing = _logoIsShowing;
@synthesize promoText = _promoText;
@@ -755,7 +758,7 @@ const CGFloat kMostVisitedPaddingIPadFavicon = 24;
if (_scrolledToTop) {
_animateHeader = NO;
if (!IsIPadIdiom()) {
- [self.dataSource onFakeboxAnimationComplete];
+ [self.dispatcher onFakeboxAnimationComplete];
[_headerView fadeOutShadow];
[_searchTapTarget setHidden:YES];
}
@@ -764,12 +767,12 @@ const CGFloat kMostVisitedPaddingIPadFavicon = 24;
}
- (void)searchFieldTapped:(id)sender {
- [self.dataSource focusFakebox];
+ [self.dispatcher focusFakebox];
}
- (void)blurOmnibox {
if (_omniboxFocused) {
- [self.dataSource cancelOmniboxEdit];
+ [self.dispatcher cancelOmniboxEdit];
} else {
[self locationBarResignsFirstResponder];
}
@@ -792,7 +795,7 @@ const CGFloat kMostVisitedPaddingIPadFavicon = 24;
_scrolledToTop = NO;
if (!IsIPadIdiom()) {
[_searchTapTarget setHidden:NO];
- [self.dataSource onFakeboxBlur];
+ [self.dispatcher onFakeboxBlur];
}
// Reload most visited sites in case the number of placeholder cells needs to
@@ -940,8 +943,8 @@ const CGFloat kMostVisitedPaddingIPadFavicon = 24;
const NSUInteger visitedIndex = indexPath.row;
[self blurOmnibox];
DCHECK(visitedIndex < [self numberOfItems]);
- [self.dataSource logMostVisitedClick:visitedIndex tileType:cell.tileType];
- [self.dataSource loadURL:[self urlForIndex:visitedIndex]
+ [self.dispatcher logMostVisitedClick:visitedIndex tileType:cell.tileType];
+ [self.dispatcher loadURL:[self urlForIndex:visitedIndex]
referrer:web::Referrer()
transition:ui::PAGE_TRANSITION_AUTO_BOOKMARK
rendererInitiated:NO];
@@ -971,7 +974,8 @@ const CGFloat kMostVisitedPaddingIPadFavicon = 24;
if (!IsIPadIdiom()) {
// iPhone header also contains a toolbar since the normal toolbar is
// hidden.
- [_headerView addToolbarWithDataSource:self.dataSource];
+ [_headerView addToolbarWithDataSource:self.dataSource
+ dispatcher:self.dispatcher];
[_headerView setToolbarTabCount:self.tabCount];
}
[_supplementaryViews addObject:_headerView];
@@ -991,7 +995,7 @@ const CGFloat kMostVisitedPaddingIPadFavicon = 24;
if (self.promoCanShow) {
[_promoHeaderView setText:self.promoText];
[_promoHeaderView setIcon:self.promoIcon];
- [self.dataSource promoViewed];
+ [self.dispatcher promoViewed];
}
[_supplementaryViews addObject:_promoHeaderView];
}
@@ -1100,9 +1104,9 @@ const CGFloat kMostVisitedPaddingIPadFavicon = 24;
if (!strongSelf)
return;
MostVisitedCell* cell = (MostVisitedCell*)sender.view;
- [strongSelf.get().dataSource logMostVisitedClick:index
+ [strongSelf.get().dispatcher logMostVisitedClick:index
tileType:cell.tileType];
- [strongSelf.get().dataSource webPageOrderedOpen:url
+ [strongSelf.get().dispatcher webPageOrderedOpen:url
referrer:web::Referrer()
inBackground:YES
appendTo:kCurrentTab];
@@ -1120,9 +1124,9 @@ const CGFloat kMostVisitedPaddingIPadFavicon = 24;
if (!strongSelf)
return;
MostVisitedCell* cell = (MostVisitedCell*)sender.view;
- [strongSelf.get().dataSource logMostVisitedClick:index
+ [strongSelf.get().dispatcher logMostVisitedClick:index
tileType:cell.tileType];
- [strongSelf.get().dataSource webPageOrderedOpen:url
+ [strongSelf.get().dispatcher webPageOrderedOpen:url
referrer:web::Referrer()
inIncognito:YES
inBackground:NO
@@ -1144,7 +1148,7 @@ const CGFloat kMostVisitedPaddingIPadFavicon = 24;
if (!strongSelf)
return;
base::RecordAction(UserMetricsAction("MostVisited_UrlBlacklisted"));
- [strongSelf.get().dataSource addBlacklistedURL:url];
+ [strongSelf.get().dispatcher addBlacklistedURL:url];
[strongSelf showMostVisitedUndoForURL:net::NSURLWithGURL(url)];
};
[_contextMenuCoordinator addItemWithTitle:title action:action];
@@ -1167,7 +1171,7 @@ const CGFloat kMostVisitedPaddingIPadFavicon = 24;
[weakSelf retain]);
if (!strongSelf)
return;
- [strongSelf.get().dataSource
+ [strongSelf.get().dispatcher
removeBlacklistedURL:net::GURLWithNSURL(_deletedUrl)];
};
action.title = l10n_util::GetNSString(IDS_NEW_TAB_UNDO_THUMBNAIL_REMOVE);
@@ -1183,10 +1187,10 @@ const CGFloat kMostVisitedPaddingIPadFavicon = 24;
}
- (void)onPromoLabelTapped {
- [self.dataSource cancelOmniboxEdit];
+ [self.dispatcher cancelOmniboxEdit];
[_promoHeaderView setHidden:YES];
[self.view setNeedsLayout];
- [self.dataSource promoTapped];
+ [self.dispatcher promoTapped];
}
// Returns the Y value to use for the scroll view's contentOffset when scrolling
@@ -1280,7 +1284,7 @@ const CGFloat kMostVisitedPaddingIPadFavicon = 24;
CGFloat pinnedOffsetY = [self pinnedOffsetY];
if (_omniboxFocused && scrollView.dragging &&
scrollView.contentOffset.y < pinnedOffsetY) {
- [self.dataSource cancelOmniboxEdit];
+ [self.dispatcher cancelOmniboxEdit];
}
if (IsIPadIdiom()) {

Powered by Google App Engine
This is Rietveld 408576698