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

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

Issue 2232863002: Remove search::GetSearchTerms since it always returns empty string (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove_query_extract
Patch Set: Android Created 4 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 <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 16 matching lines...) Expand all
27 27
28 namespace { 28 namespace {
29 29
30 bool IsContentsFrom(const InstantTab* page, 30 bool IsContentsFrom(const InstantTab* page,
31 const content::WebContents* contents) { 31 const content::WebContents* contents) {
32 return page && (page->web_contents() == contents); 32 return page && (page->web_contents() == contents);
33 } 33 }
34 34
35 // Adds a transient NavigationEntry to the supplied |contents|'s 35 // Adds a transient NavigationEntry to the supplied |contents|'s
36 // NavigationController if the page's URL has not already been updated with the 36 // NavigationController if the page's URL has not already been updated with the
37 // supplied |search_terms|. Sets the |search_terms| on the transient entry for 37 // supplied |search_terms|.
38 // search terms extraction to work correctly. 38 // TODO(treib): Is it safe to completely remove this? crbug.com/627747
39 void EnsureSearchTermsAreSet(content::WebContents* contents, 39 void EnsureSearchTermsAreSet(content::WebContents* contents,
40 const base::string16& search_terms) { 40 const base::string16& search_terms) {
41 content::NavigationController* controller = &contents->GetController(); 41 content::NavigationController* controller = &contents->GetController();
42 42
43 // If search terms are already correct or there is already a transient entry 43 // If search terms are already correct or there is already a transient entry
44 // (there shouldn't be), bail out early. 44 // (there shouldn't be), bail out early.
45 if (search::GetSearchTerms(contents) == search_terms || 45 if (search_terms.empty() || controller->GetTransientEntry())
46 controller->GetTransientEntry())
47 return; 46 return;
48 47
49 const content::NavigationEntry* entry = controller->GetLastCommittedEntry(); 48 const content::NavigationEntry* entry = controller->GetLastCommittedEntry();
50 std::unique_ptr<content::NavigationEntry> transient = 49 std::unique_ptr<content::NavigationEntry> transient =
51 controller->CreateNavigationEntry( 50 controller->CreateNavigationEntry(
52 entry->GetURL(), entry->GetReferrer(), entry->GetTransitionType(), 51 entry->GetURL(), entry->GetReferrer(), entry->GetTransitionType(),
53 false, std::string(), contents->GetBrowserContext()); 52 false, std::string(), contents->GetBrowserContext());
54 transient->SetExtraData(sessions::kSearchTermsKey, search_terms);
55 controller->SetTransientEntry(std::move(transient)); 53 controller->SetTransientEntry(std::move(transient));
56 54
57 SearchTabHelper::FromWebContents(contents)->NavigationEntryUpdated(); 55 SearchTabHelper::FromWebContents(contents)->NavigationEntryUpdated();
58 } 56 }
59 57
60 } // namespace 58 } // namespace
61 59
62 InstantController::InstantController(BrowserInstantController* browser) 60 InstantController::InstantController(BrowserInstantController* browser)
63 : browser_(browser) { 61 : browser_(browser) {
64 } 62 }
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 if (instant_service) { 167 if (instant_service) {
170 instant_service->UpdateThemeInfo(); 168 instant_service->UpdateThemeInfo();
171 instant_service->UpdateMostVisitedItemsInfo(); 169 instant_service->UpdateMostVisitedItemsInfo();
172 } 170 }
173 } 171 }
174 } 172 }
175 173
176 InstantService* InstantController::GetInstantService() const { 174 InstantService* InstantController::GetInstantService() const {
177 return InstantServiceFactory::GetForProfile(browser_->profile()); 175 return InstantServiceFactory::GetForProfile(browser_->profile());
178 } 176 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm ('k') | chrome/browser/ui/search/search_tab_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698