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

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

Issue 22882007: Remove GetActiveEntry usage from chrome/browser/ui. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased on ToT. Created 7 years, 2 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 | Annotate | Revision Log
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/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "chrome/browser/chrome_notification_types.h" 10 #include "chrome/browser/chrome_notification_types.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 void EnsureSearchTermsAreSet(content::WebContents* contents, 82 void EnsureSearchTermsAreSet(content::WebContents* contents,
83 const string16& search_terms) { 83 const string16& search_terms) {
84 content::NavigationController* controller = &contents->GetController(); 84 content::NavigationController* controller = &contents->GetController();
85 85
86 // If search terms are already correct or there is already a transient entry 86 // If search terms are already correct or there is already a transient entry
87 // (there shouldn't be), bail out early. 87 // (there shouldn't be), bail out early.
88 if (chrome::GetSearchTerms(contents) == search_terms || 88 if (chrome::GetSearchTerms(contents) == search_terms ||
89 controller->GetTransientEntry()) 89 controller->GetTransientEntry())
90 return; 90 return;
91 91
92 const content::NavigationEntry* active_entry = controller->GetActiveEntry(); 92 const content::NavigationEntry* active_entry = controller->GetVisibleEntry();
93 content::NavigationEntry* transient = controller->CreateNavigationEntry( 93 content::NavigationEntry* transient = controller->CreateNavigationEntry(
94 active_entry->GetURL(), 94 active_entry->GetURL(),
95 active_entry->GetReferrer(), 95 active_entry->GetReferrer(),
96 active_entry->GetTransitionType(), 96 active_entry->GetTransitionType(),
97 false, 97 false,
98 std::string(), 98 std::string(),
99 contents->GetBrowserContext()); 99 contents->GetBrowserContext());
100 transient->SetExtraData(sessions::kSearchTermsKey, search_terms); 100 transient->SetExtraData(sessions::kSearchTermsKey, search_terms);
101 controller->SetTransientEntry(transient); 101 controller->SetTransientEntry(transient);
102 102
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 content::PAGE_TRANSITION_SERVER_REDIRECT, 366 content::PAGE_TRANSITION_SERVER_REDIRECT,
367 std::string()); // No extra headers. 367 std::string()); // No extra headers.
368 // TODO(dcblack): Remove extraneous history entry caused by 404s. 368 // TODO(dcblack): Remove extraneous history entry caused by 404s.
369 // Note that the base case of a 204 being returned doesn't push a history 369 // Note that the base case of a 204 being returned doesn't push a history
370 // entry. 370 // entry.
371 } 371 }
372 372
373 InstantService* InstantController::GetInstantService() const { 373 InstantService* InstantController::GetInstantService() const {
374 return InstantServiceFactory::GetForProfile(profile()); 374 return InstantServiceFactory::GetForProfile(profile());
375 } 375 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/applescript/tab_applescript.mm ('k') | chrome/browser/ui/search/instant_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698