| 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/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "chrome/browser/search_engines/template_url_service.h" | 21 #include "chrome/browser/search_engines/template_url_service.h" |
| 22 #include "chrome/browser/search_engines/template_url_service_factory.h" | 22 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 23 #include "chrome/browser/ui/browser_instant_controller.h" | 23 #include "chrome/browser/ui/browser_instant_controller.h" |
| 24 #include "chrome/browser/ui/search/instant_ntp.h" | 24 #include "chrome/browser/ui/search/instant_ntp.h" |
| 25 #include "chrome/browser/ui/search/instant_overlay.h" | 25 #include "chrome/browser/ui/search/instant_overlay.h" |
| 26 #include "chrome/browser/ui/search/instant_tab.h" | 26 #include "chrome/browser/ui/search/instant_tab.h" |
| 27 #include "chrome/browser/ui/search/search_tab_helper.h" | 27 #include "chrome/browser/ui/search/search_tab_helper.h" |
| 28 #include "chrome/common/chrome_notification_types.h" | 28 #include "chrome/common/chrome_notification_types.h" |
| 29 #include "chrome/common/chrome_switches.h" | 29 #include "chrome/common/chrome_switches.h" |
| 30 #include "chrome/common/url_constants.h" | 30 #include "chrome/common/url_constants.h" |
| 31 #include "components/sessions/serialized_navigation_entry.h" |
| 31 #include "content/public/browser/navigation_entry.h" | 32 #include "content/public/browser/navigation_entry.h" |
| 32 #include "content/public/browser/notification_service.h" | 33 #include "content/public/browser/notification_service.h" |
| 33 #include "content/public/browser/render_process_host.h" | 34 #include "content/public/browser/render_process_host.h" |
| 34 #include "content/public/browser/render_widget_host_view.h" | 35 #include "content/public/browser/render_widget_host_view.h" |
| 35 #include "content/public/browser/user_metrics.h" | 36 #include "content/public/browser/user_metrics.h" |
| 36 #include "content/public/browser/web_contents.h" | 37 #include "content/public/browser/web_contents.h" |
| 37 #include "content/public/browser/web_contents_view.h" | 38 #include "content/public/browser/web_contents_view.h" |
| 38 #include "net/base/escape.h" | 39 #include "net/base/escape.h" |
| 39 #include "third_party/icu/public/common/unicode/normalizer2.h" | 40 #include "third_party/icu/public/common/unicode/normalizer2.h" |
| 40 | 41 |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 return; | 185 return; |
| 185 | 186 |
| 186 const content::NavigationEntry* active_entry = controller->GetActiveEntry(); | 187 const content::NavigationEntry* active_entry = controller->GetActiveEntry(); |
| 187 content::NavigationEntry* transient = controller->CreateNavigationEntry( | 188 content::NavigationEntry* transient = controller->CreateNavigationEntry( |
| 188 active_entry->GetURL(), | 189 active_entry->GetURL(), |
| 189 active_entry->GetReferrer(), | 190 active_entry->GetReferrer(), |
| 190 active_entry->GetTransitionType(), | 191 active_entry->GetTransitionType(), |
| 191 false, | 192 false, |
| 192 std::string(), | 193 std::string(), |
| 193 contents->GetBrowserContext()); | 194 contents->GetBrowserContext()); |
| 194 transient->SetExtraData(chrome::kInstantExtendedSearchTermsKey, search_terms); | 195 transient->SetExtraData(components::kSearchTermsKey, search_terms); |
| 195 controller->SetTransientEntry(transient); | 196 controller->SetTransientEntry(transient); |
| 196 | 197 |
| 197 SearchTabHelper::FromWebContents(contents)->NavigationEntryUpdated(); | 198 SearchTabHelper::FromWebContents(contents)->NavigationEntryUpdated(); |
| 198 } | 199 } |
| 199 | 200 |
| 200 bool GetURLForMostVisitedItemID(Profile* profile, | 201 bool GetURLForMostVisitedItemID(Profile* profile, |
| 201 InstantRestrictedID most_visited_item_id, | 202 InstantRestrictedID most_visited_item_id, |
| 202 GURL* url) { | 203 GURL* url) { |
| 203 InstantService* instant_service = | 204 InstantService* instant_service = |
| 204 InstantServiceFactory::GetForProfile(profile); | 205 InstantServiceFactory::GetForProfile(profile); |
| (...skipping 1475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1680 return false; | 1681 return false; |
| 1681 | 1682 |
| 1682 // If this is not window startup, switch. | 1683 // If this is not window startup, switch. |
| 1683 // TODO(shishir): This is not completely reliable. Find a better way to detect | 1684 // TODO(shishir): This is not completely reliable. Find a better way to detect |
| 1684 // startup time. | 1685 // startup time. |
| 1685 if (browser_->GetActiveWebContents()) | 1686 if (browser_->GetActiveWebContents()) |
| 1686 return true; | 1687 return true; |
| 1687 | 1688 |
| 1688 return chrome::IsAggressiveLocalNTPFallbackEnabled(); | 1689 return chrome::IsAggressiveLocalNTPFallbackEnabled(); |
| 1689 } | 1690 } |
| OLD | NEW |