Chromium Code Reviews| 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 #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/content_settings/content_settings_provider.h" | 10 #include "chrome/browser/content_settings/content_settings_provider.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 54 void EnsureSearchTermsAreSet(content::WebContents* contents, | 54 void EnsureSearchTermsAreSet(content::WebContents* contents, |
| 55 const string16& search_terms) { | 55 const string16& search_terms) { |
| 56 content::NavigationController* controller = &contents->GetController(); | 56 content::NavigationController* controller = &contents->GetController(); |
| 57 | 57 |
| 58 // If search terms are already correct or there is already a transient entry | 58 // If search terms are already correct or there is already a transient entry |
| 59 // (there shouldn't be), bail out early. | 59 // (there shouldn't be), bail out early. |
| 60 if (chrome::GetSearchTerms(contents) == search_terms || | 60 if (chrome::GetSearchTerms(contents) == search_terms || |
| 61 controller->GetTransientEntry()) | 61 controller->GetTransientEntry()) |
| 62 return; | 62 return; |
| 63 | 63 |
| 64 const content::NavigationEntry* active_entry = controller->GetActiveEntry(); | 64 const content::NavigationEntry* entry = controller->GetVisibleEntry(); |
|
nasko
2013/11/08 23:52:03
Shouldn't this be LastCommitted?
jww
2013/11/11 19:18:51
Done.
| |
| 65 content::NavigationEntry* transient = controller->CreateNavigationEntry( | 65 content::NavigationEntry* transient = controller->CreateNavigationEntry( |
| 66 active_entry->GetURL(), | 66 entry->GetURL(), |
| 67 active_entry->GetReferrer(), | 67 entry->GetReferrer(), |
| 68 active_entry->GetTransitionType(), | 68 entry->GetTransitionType(), |
| 69 false, | 69 false, |
| 70 std::string(), | 70 std::string(), |
| 71 contents->GetBrowserContext()); | 71 contents->GetBrowserContext()); |
| 72 transient->SetExtraData(sessions::kSearchTermsKey, search_terms); | 72 transient->SetExtraData(sessions::kSearchTermsKey, search_terms); |
| 73 controller->SetTransientEntry(transient); | 73 controller->SetTransientEntry(transient); |
| 74 | 74 |
| 75 SearchTabHelper::FromWebContents(contents)->NavigationEntryUpdated(); | 75 SearchTabHelper::FromWebContents(contents)->NavigationEntryUpdated(); |
| 76 } | 76 } |
| 77 | 77 |
| 78 } // namespace | 78 } // namespace |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 303 content::PAGE_TRANSITION_SERVER_REDIRECT, | 303 content::PAGE_TRANSITION_SERVER_REDIRECT, |
| 304 std::string()); // No extra headers. | 304 std::string()); // No extra headers. |
| 305 // TODO(dcblack): Remove extraneous history entry caused by 404s. | 305 // TODO(dcblack): Remove extraneous history entry caused by 404s. |
| 306 // Note that the base case of a 204 being returned doesn't push a history | 306 // Note that the base case of a 204 being returned doesn't push a history |
| 307 // entry. | 307 // entry. |
| 308 } | 308 } |
| 309 | 309 |
| 310 InstantService* InstantController::GetInstantService() const { | 310 InstantService* InstantController::GetInstantService() const { |
| 311 return InstantServiceFactory::GetForProfile(profile()); | 311 return InstantServiceFactory::GetForProfile(profile()); |
| 312 } | 312 } |
| OLD | NEW |