| 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/ntp/new_tab_page_controller.h" | 5 #import "ios/chrome/browser/ui/ntp/new_tab_page_controller.h" |
| 6 | 6 |
| 7 #import <QuartzCore/QuartzCore.h> | 7 #import <QuartzCore/QuartzCore.h> |
| 8 | 8 |
| 9 #import "base/ios/weak_nsobject.h" | 9 #import "base/ios/weak_nsobject.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/mac/objc_property_releaser.h" | 11 #include "base/mac/objc_property_releaser.h" |
| 12 #include "base/metrics/user_metrics.h" | 12 #include "base/metrics/user_metrics.h" |
| 13 #include "base/metrics/user_metrics_action.h" | 13 #include "base/metrics/user_metrics_action.h" |
| 14 #include "components/prefs/pref_service.h" | 14 #include "components/prefs/pref_service.h" |
| 15 #include "components/search_engines/template_url_service.h" | 15 #include "components/search_engines/template_url_service.h" |
| 16 #include "components/strings/grit/components_strings.h" | 16 #include "components/strings/grit/components_strings.h" |
| 17 #include "components/sync_sessions/synced_session.h" | 17 #include "components/sync_sessions/synced_session.h" |
| 18 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" | 18 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" |
| 19 #include "ios/chrome/browser/pref_names.h" | 19 #include "ios/chrome/browser/pref_names.h" |
| 20 #include "ios/chrome/browser/search_engines/template_url_service_factory.h" | 20 #include "ios/chrome/browser/search_engines/template_url_service_factory.h" |
| 21 #include "ios/chrome/browser/sync/sync_setup_service.h" | 21 #include "ios/chrome/browser/sync/sync_setup_service.h" |
| 22 #include "ios/chrome/browser/sync/sync_setup_service_factory.h" | 22 #include "ios/chrome/browser/sync/sync_setup_service_factory.h" |
| 23 #import "ios/chrome/browser/tabs/tab_model.h" | 23 #import "ios/chrome/browser/tabs/tab_model.h" |
| 24 #import "ios/chrome/browser/ui/bookmarks/bookmark_controller_factory.h" | 24 #import "ios/chrome/browser/ui/bookmarks/bookmark_controller_factory.h" |
| 25 #import "ios/chrome/browser/ui/bookmarks/bookmark_home_tablet_ntp_controller.h" | 25 #import "ios/chrome/browser/ui/bookmarks/bookmark_home_tablet_ntp_controller.h" |
| 26 #import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h" | 26 #import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h" |
| 27 #import "ios/chrome/browser/ui/commands/generic_chrome_command.h" | 27 #import "ios/chrome/browser/ui/commands/generic_chrome_command.h" |
| 28 #include "ios/chrome/browser/ui/commands/ios_command_ids.h" | 28 #include "ios/chrome/browser/ui/commands/ios_command_ids.h" |
| 29 #import "ios/chrome/browser/ui/ntp/google_landing_controller.h" | |
| 30 #import "ios/chrome/browser/ui/ntp/google_landing_mediator.h" | 29 #import "ios/chrome/browser/ui/ntp/google_landing_mediator.h" |
| 30 #import "ios/chrome/browser/ui/ntp/google_landing_view_controller.h" |
| 31 #import "ios/chrome/browser/ui/ntp/incognito_panel_controller.h" | 31 #import "ios/chrome/browser/ui/ntp/incognito_panel_controller.h" |
| 32 #import "ios/chrome/browser/ui/ntp/new_tab_page_bar_item.h" | 32 #import "ios/chrome/browser/ui/ntp/new_tab_page_bar_item.h" |
| 33 #import "ios/chrome/browser/ui/ntp/new_tab_page_view.h" | 33 #import "ios/chrome/browser/ui/ntp/new_tab_page_view.h" |
| 34 #import "ios/chrome/browser/ui/ntp/recent_tabs/recent_tabs_panel_controller.h" | 34 #import "ios/chrome/browser/ui/ntp/recent_tabs/recent_tabs_panel_controller.h" |
| 35 #import "ios/chrome/browser/ui/rtl_geometry.h" | 35 #import "ios/chrome/browser/ui/rtl_geometry.h" |
| 36 #include "ios/chrome/browser/ui/toolbar/toolbar_model_ios.h" | 36 #include "ios/chrome/browser/ui/toolbar/toolbar_model_ios.h" |
| 37 #include "ios/chrome/browser/ui/ui_util.h" | 37 #include "ios/chrome/browser/ui/ui_util.h" |
| 38 #include "ios/chrome/grit/ios_strings.h" | 38 #include "ios/chrome/grit/ios_strings.h" |
| 39 #import "ios/web/web_state/ui/crw_swipe_recognizer_provider.h" | 39 #import "ios/web/web_state/ui/crw_swipe_recognizer_provider.h" |
| 40 #include "ui/base/l10n/l10n_util.h" | 40 #include "ui/base/l10n/l10n_util.h" |
| (...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 bookmarkController_.reset([[factory | 538 bookmarkController_.reset([[factory |
| 539 bookmarkPanelControllerForBrowserState:browserState_ | 539 bookmarkPanelControllerForBrowserState:browserState_ |
| 540 loader:loader_ | 540 loader:loader_ |
| 541 colorCache:dominantColorCache_] retain]); | 541 colorCache:dominantColorCache_] retain]); |
| 542 } | 542 } |
| 543 panelController = bookmarkController_; | 543 panelController = bookmarkController_; |
| 544 view = [bookmarkController_ view]; | 544 view = [bookmarkController_ view]; |
| 545 [bookmarkController_ setDelegate:self]; | 545 [bookmarkController_ setDelegate:self]; |
| 546 } else if (item.identifier == NewTabPage::kMostVisitedPanel) { | 546 } else if (item.identifier == NewTabPage::kMostVisitedPanel) { |
| 547 if (!googleLandingController_) { | 547 if (!googleLandingController_) { |
| 548 googleLandingController_.reset([[GoogleLandingController alloc] init]); | 548 googleLandingController_.reset( |
| 549 [[GoogleLandingViewController alloc] init]); |
| 549 [googleLandingController_ setDispatcher:self.dispatcher]; | 550 [googleLandingController_ setDispatcher:self.dispatcher]; |
| 550 googleLandingMediator_.reset([[GoogleLandingMediator alloc] | 551 googleLandingMediator_.reset([[GoogleLandingMediator alloc] |
| 551 initWithConsumer:googleLandingController_ | 552 initWithConsumer:googleLandingController_ |
| 552 browserState:browserState_ | 553 browserState:browserState_ |
| 553 dispatcher:self.dispatcher | 554 dispatcher:self.dispatcher |
| 554 webStateList:[tabModel_ webStateList]]); | 555 webStateList:[tabModel_ webStateList]]); |
| 555 [googleLandingController_ setDataSource:googleLandingMediator_]; | 556 [googleLandingController_ setDataSource:googleLandingMediator_]; |
| 556 } | 557 } |
| 557 panelController = googleLandingController_; | 558 panelController = googleLandingController_; |
| 558 view = [googleLandingController_ view]; | 559 view = [googleLandingController_ view]; |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 739 | 740 |
| 740 - (void)updateNtpBarShadowForPanelController: | 741 - (void)updateNtpBarShadowForPanelController: |
| 741 (id<NewTabPagePanelProtocol>)ntpPanelController { | 742 (id<NewTabPagePanelProtocol>)ntpPanelController { |
| 742 if (currentController_ != ntpPanelController) | 743 if (currentController_ != ntpPanelController) |
| 743 return; | 744 return; |
| 744 [self.ntpView.tabBar | 745 [self.ntpView.tabBar |
| 745 setShadowAlpha:[ntpPanelController alphaForBottomShadow]]; | 746 setShadowAlpha:[ntpPanelController alphaForBottomShadow]]; |
| 746 } | 747 } |
| 747 | 748 |
| 748 @end | 749 @end |
| OLD | NEW |