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 <stddef.h> | 7 #include <stddef.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 const base::string16& search_terms) { | 48 const base::string16& search_terms) { |
49 content::NavigationController* controller = &contents->GetController(); | 49 content::NavigationController* controller = &contents->GetController(); |
50 | 50 |
51 // If search terms are already correct or there is already a transient entry | 51 // If search terms are already correct or there is already a transient entry |
52 // (there shouldn't be), bail out early. | 52 // (there shouldn't be), bail out early. |
53 if (search::GetSearchTerms(contents) == search_terms || | 53 if (search::GetSearchTerms(contents) == search_terms || |
54 controller->GetTransientEntry()) | 54 controller->GetTransientEntry()) |
55 return; | 55 return; |
56 | 56 |
57 const content::NavigationEntry* entry = controller->GetLastCommittedEntry(); | 57 const content::NavigationEntry* entry = controller->GetLastCommittedEntry(); |
58 scoped_ptr<content::NavigationEntry> transient = | 58 std::unique_ptr<content::NavigationEntry> transient = |
59 controller->CreateNavigationEntry( | 59 controller->CreateNavigationEntry( |
60 entry->GetURL(), | 60 entry->GetURL(), entry->GetReferrer(), entry->GetTransitionType(), |
61 entry->GetReferrer(), | 61 false, std::string(), contents->GetBrowserContext()); |
62 entry->GetTransitionType(), | |
63 false, | |
64 std::string(), | |
65 contents->GetBrowserContext()); | |
66 transient->SetExtraData(sessions::kSearchTermsKey, search_terms); | 62 transient->SetExtraData(sessions::kSearchTermsKey, search_terms); |
67 controller->SetTransientEntry(std::move(transient)); | 63 controller->SetTransientEntry(std::move(transient)); |
68 | 64 |
69 SearchTabHelper::FromWebContents(contents)->NavigationEntryUpdated(); | 65 SearchTabHelper::FromWebContents(contents)->NavigationEntryUpdated(); |
70 } | 66 } |
71 | 67 |
72 } // namespace | 68 } // namespace |
73 | 69 |
74 InstantController::InstantController(BrowserInstantController* browser) | 70 InstantController::InstantController(BrowserInstantController* browser) |
75 : browser_(browser) { | 71 : browser_(browser) { |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 if (instant_service) { | 188 if (instant_service) { |
193 instant_service->UpdateThemeInfo(); | 189 instant_service->UpdateThemeInfo(); |
194 instant_service->UpdateMostVisitedItemsInfo(); | 190 instant_service->UpdateMostVisitedItemsInfo(); |
195 } | 191 } |
196 } | 192 } |
197 } | 193 } |
198 | 194 |
199 InstantService* InstantController::GetInstantService() const { | 195 InstantService* InstantController::GetInstantService() const { |
200 return InstantServiceFactory::GetForProfile(profile()); | 196 return InstantServiceFactory::GetForProfile(profile()); |
201 } | 197 } |
OLD | NEW |