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

Side by Side Diff: chrome/browser/ui/search/instant_controller.cc

Issue 2847083002: Remove InstantController::InstantSupportChanged (Closed)
Patch Set: Created 3 years, 7 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/search/instant_controller.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "chrome/browser/ui/search/instant_controller.h" 5 #include "chrome/browser/ui/search/instant_controller.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 base::Time::Now().ToInternalValue(), info)); 55 base::Time::Now().ToInternalValue(), info));
56 static const size_t kMaxDebugEventSize = 2000; 56 static const size_t kMaxDebugEventSize = 2000;
57 if (debug_events_.size() > kMaxDebugEventSize) 57 if (debug_events_.size() > kMaxDebugEventSize)
58 debug_events_.pop_back(); 58 debug_events_.pop_back();
59 } 59 }
60 60
61 void InstantController::ClearDebugEvents() { 61 void InstantController::ClearDebugEvents() {
62 debug_events_.clear(); 62 debug_events_.clear();
63 } 63 }
64 64
65 void InstantController::InstantSupportChanged(
66 InstantSupportState instant_support) {
67 // Handle INSTANT_SUPPORT_YES here because InstantTab is not hooked up to the
68 // active tab. Search model changed listener in InstantTab will handle other
69 // cases.
70 if (instant_support != INSTANT_SUPPORT_YES)
71 return;
72
73 ResetInstantTab();
74 }
75
76 void InstantController::InstantTabAboutToNavigateMainFrame( 65 void InstantController::InstantTabAboutToNavigateMainFrame(
77 const content::WebContents* contents, 66 const content::WebContents* contents,
78 const GURL& url) { 67 const GURL& url) {
79 DCHECK(IsContentsFrom(instant_tab_.get(), contents)); 68 DCHECK(IsContentsFrom(instant_tab_.get(), contents));
80 69
81 // The Instant tab navigated. Send it the data it needs to display 70 // The Instant tab navigated. Send it the data it needs to display
82 // properly. 71 // properly.
72 // TODO(treib): Doesn't seem to be necessary. crbug.com/627747
83 UpdateInfoForInstantTab(); 73 UpdateInfoForInstantTab();
84 } 74 }
85 75
86 void InstantController::ResetInstantTab() { 76 void InstantController::ResetInstantTab() {
87 if (search_mode_.is_origin_ntp()) { 77 if (search_mode_.is_origin_ntp()) {
88 content::WebContents* active_tab = browser_->GetActiveWebContents(); 78 content::WebContents* active_tab = browser_->GetActiveWebContents();
89 if (!instant_tab_ || active_tab != instant_tab_->web_contents()) { 79 if (!instant_tab_ || active_tab != instant_tab_->web_contents()) {
90 instant_tab_.reset(new InstantTab(this, active_tab)); 80 instant_tab_.reset(new InstantTab(this, active_tab));
91 instant_tab_->Init(); 81 instant_tab_->Init();
92 UpdateInfoForInstantTab(); 82 UpdateInfoForInstantTab();
93 } 83 }
94 } else { 84 } else {
95 instant_tab_.reset(); 85 instant_tab_.reset();
96 } 86 }
97 } 87 }
98 88
99 void InstantController::UpdateInfoForInstantTab() { 89 void InstantController::UpdateInfoForInstantTab() {
100 if (instant_tab_) { 90 DCHECK(instant_tab_);
101 // Update theme details. 91 InstantService* instant_service = GetInstantService();
102 InstantService* instant_service = GetInstantService(); 92 if (instant_service) {
103 if (instant_service) { 93 instant_service->UpdateThemeInfo();
104 instant_service->UpdateThemeInfo(); 94 instant_service->UpdateMostVisitedItemsInfo();
105 instant_service->UpdateMostVisitedItemsInfo();
106 }
107 } 95 }
108 } 96 }
109 97
110 InstantService* InstantController::GetInstantService() const { 98 InstantService* InstantController::GetInstantService() const {
111 return InstantServiceFactory::GetForProfile(browser_->profile()); 99 return InstantServiceFactory::GetForProfile(browser_->profile());
112 } 100 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/search/instant_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698