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

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

Issue 1260033003: Partially componentize //chrome/browser/search/search.{h,cc} (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compilation on iOS Created 5 years, 4 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
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 "base/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "chrome/browser/chrome_notification_types.h" 9 #include "chrome/browser/chrome_notification_types.h"
10 #include "chrome/browser/platform_util.h" 10 #include "chrome/browser/platform_util.h"
(...skipping 29 matching lines...) Expand all
40 // Adds a transient NavigationEntry to the supplied |contents|'s 40 // Adds a transient NavigationEntry to the supplied |contents|'s
41 // NavigationController if the page's URL has not already been updated with the 41 // NavigationController if the page's URL has not already been updated with the
42 // supplied |search_terms|. Sets the |search_terms| on the transient entry for 42 // supplied |search_terms|. Sets the |search_terms| on the transient entry for
43 // search terms extraction to work correctly. 43 // search terms extraction to work correctly.
44 void EnsureSearchTermsAreSet(content::WebContents* contents, 44 void EnsureSearchTermsAreSet(content::WebContents* contents,
45 const base::string16& search_terms) { 45 const base::string16& search_terms) {
46 content::NavigationController* controller = &contents->GetController(); 46 content::NavigationController* controller = &contents->GetController();
47 47
48 // If search terms are already correct or there is already a transient entry 48 // If search terms are already correct or there is already a transient entry
49 // (there shouldn't be), bail out early. 49 // (there shouldn't be), bail out early.
50 if (chrome::GetSearchTerms(contents) == search_terms || 50 if (search::GetSearchTerms(contents) == search_terms ||
51 controller->GetTransientEntry()) 51 controller->GetTransientEntry())
52 return; 52 return;
53 53
54 const content::NavigationEntry* entry = controller->GetLastCommittedEntry(); 54 const content::NavigationEntry* entry = controller->GetLastCommittedEntry();
55 scoped_ptr<content::NavigationEntry> transient = 55 scoped_ptr<content::NavigationEntry> transient =
56 controller->CreateNavigationEntry( 56 controller->CreateNavigationEntry(
57 entry->GetURL(), 57 entry->GetURL(),
58 entry->GetReferrer(), 58 entry->GetReferrer(),
59 entry->GetTransitionType(), 59 entry->GetTransitionType(),
60 false, 60 false,
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 } 101 }
102 102
103 void InstantController::ActiveTabChanged() { 103 void InstantController::ActiveTabChanged() {
104 LOG_INSTANT_DEBUG_EVENT(this, "ActiveTabChanged"); 104 LOG_INSTANT_DEBUG_EVENT(this, "ActiveTabChanged");
105 ResetInstantTab(); 105 ResetInstantTab();
106 } 106 }
107 107
108 void InstantController::TabDeactivated(content::WebContents* contents) { 108 void InstantController::TabDeactivated(content::WebContents* contents) {
109 // If user is deactivating an NTP tab, log the number of mouseovers for this 109 // If user is deactivating an NTP tab, log the number of mouseovers for this
110 // NTP session. 110 // NTP session.
111 if (chrome::IsInstantNTP(contents)) 111 if (search::IsInstantNTP(contents))
112 InstantTab::EmitNtpStatistics(contents); 112 InstantTab::EmitNtpStatistics(contents);
113 } 113 }
114 114
115 void InstantController::LogDebugEvent(const std::string& info) const { 115 void InstantController::LogDebugEvent(const std::string& info) const {
116 DVLOG(1) << info; 116 DVLOG(1) << info;
117 117
118 debug_events_.push_front(std::make_pair( 118 debug_events_.push_front(std::make_pair(
119 base::Time::Now().ToInternalValue(), info)); 119 base::Time::Now().ToInternalValue(), info));
120 static const size_t kMaxDebugEventSize = 2000; 120 static const size_t kMaxDebugEventSize = 2000;
121 if (debug_events_.size() > kMaxDebugEventSize) 121 if (debug_events_.size() > kMaxDebugEventSize)
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 if (instant_service) { 189 if (instant_service) {
190 instant_service->UpdateThemeInfo(); 190 instant_service->UpdateThemeInfo();
191 instant_service->UpdateMostVisitedItemsInfo(); 191 instant_service->UpdateMostVisitedItemsInfo();
192 } 192 }
193 } 193 }
194 } 194 }
195 195
196 InstantService* InstantController::GetInstantService() const { 196 InstantService* InstantController::GetInstantService() const {
197 return InstantServiceFactory::GetForProfile(profile()); 197 return InstantServiceFactory::GetForProfile(profile());
198 } 198 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/omnibox/chrome_omnibox_client.cc ('k') | chrome/browser/ui/search/instant_extended_interactive_uitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698