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/search_tab_helper.h" | 5 #include "chrome/browser/ui/search/search_tab_helper.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 12 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
| 13 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
| 14 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
| 15 #include "build/build_config.h" | 15 #include "build/build_config.h" |
| 16 #include "chrome/browser/chrome_notification_types.h" | 16 #include "chrome/browser/chrome_notification_types.h" |
| 17 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 18 #include "chrome/browser/search/instant_service.h" | 18 #include "chrome/browser/search/instant_service.h" |
| 19 #include "chrome/browser/search/instant_service_factory.h" | 19 #include "chrome/browser/search/instant_service_factory.h" |
| 20 #include "chrome/browser/search/search.h" | 20 #include "chrome/browser/search/search.h" |
| 21 #include "chrome/browser/signin/signin_manager_factory.h" | 21 #include "chrome/browser/signin/signin_manager_factory.h" |
| 22 #include "chrome/browser/sync/profile_sync_service_factory.h" | 22 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 23 #include "chrome/browser/ui/app_list/app_list_util.h" | 23 #include "chrome/browser/ui/app_list/app_list_util.h" |
|
Jered
2016/07/25 14:46:08
You can remove this now.
Marc Treib
2016/07/25 15:00:48
Done.
| |
| 24 #include "chrome/browser/ui/browser_window.h" | 24 #include "chrome/browser/ui/browser_window.h" |
| 25 #include "chrome/browser/ui/location_bar/location_bar.h" | 25 #include "chrome/browser/ui/location_bar/location_bar.h" |
| 26 #include "chrome/browser/ui/omnibox/clipboard_utils.h" | 26 #include "chrome/browser/ui/omnibox/clipboard_utils.h" |
| 27 #include "chrome/browser/ui/search/instant_search_prerenderer.h" | 27 #include "chrome/browser/ui/search/instant_search_prerenderer.h" |
| 28 #include "chrome/browser/ui/search/instant_tab.h" | 28 #include "chrome/browser/ui/search/instant_tab.h" |
| 29 #include "chrome/browser/ui/search/search_ipc_router_policy_impl.h" | 29 #include "chrome/browser/ui/search/search_ipc_router_policy_impl.h" |
| 30 #include "chrome/browser/ui/search/search_tab_helper_delegate.h" | 30 #include "chrome/browser/ui/search/search_tab_helper_delegate.h" |
| 31 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" | 31 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" |
| 32 #include "chrome/browser/ui/webui/ntp/ntp_user_data_logger.h" | 32 #include "chrome/browser/ui/webui/ntp/ntp_user_data_logger.h" |
| 33 #include "chrome/common/url_constants.h" | 33 #include "chrome/common/url_constants.h" |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 257 } | 257 } |
| 258 | 258 |
| 259 void SearchTabHelper::OnTabDeactivated() { | 259 void SearchTabHelper::OnTabDeactivated() { |
| 260 ipc_router_.OnTabDeactivated(); | 260 ipc_router_.OnTabDeactivated(); |
| 261 } | 261 } |
| 262 | 262 |
| 263 bool SearchTabHelper::IsSearchResultsPage() { | 263 bool SearchTabHelper::IsSearchResultsPage() { |
| 264 return model_.mode().is_origin_search(); | 264 return model_.mode().is_origin_search(); |
| 265 } | 265 } |
| 266 | 266 |
| 267 void SearchTabHelper::RenderViewCreated( | |
| 268 content::RenderViewHost* render_view_host) { | |
| 269 ipc_router_.SetPromoInformation(IsAppLauncherEnabled()); | |
| 270 } | |
| 271 | |
| 272 void SearchTabHelper::DidStartNavigationToPendingEntry( | 267 void SearchTabHelper::DidStartNavigationToPendingEntry( |
| 273 const GURL& url, | 268 const GURL& url, |
| 274 content::NavigationController::ReloadType /* reload_type */) { | 269 content::NavigationController::ReloadType /* reload_type */) { |
| 275 if (search::IsNTPURL(url, profile())) { | 270 if (search::IsNTPURL(url, profile())) { |
| 276 // Set the title on any pending entry corresponding to the NTP. This | 271 // Set the title on any pending entry corresponding to the NTP. This |
| 277 // prevents any flickering of the tab title. | 272 // prevents any flickering of the tab title. |
| 278 content::NavigationEntry* entry = | 273 content::NavigationEntry* entry = |
| 279 web_contents_->GetController().GetPendingEntry(); | 274 web_contents_->GetController().GetPendingEntry(); |
| 280 if (entry) | 275 if (entry) |
| 281 entry->SetTitle(l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE)); | 276 entry->SetTitle(l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE)); |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 564 | 559 |
| 565 bool SearchTabHelper::IsInputInProgress() const { | 560 bool SearchTabHelper::IsInputInProgress() const { |
| 566 OmniboxView* omnibox = GetOmniboxView(); | 561 OmniboxView* omnibox = GetOmniboxView(); |
| 567 return !model_.mode().is_ntp() && omnibox && | 562 return !model_.mode().is_ntp() && omnibox && |
| 568 omnibox->model()->focus_state() == OMNIBOX_FOCUS_VISIBLE; | 563 omnibox->model()->focus_state() == OMNIBOX_FOCUS_VISIBLE; |
| 569 } | 564 } |
| 570 | 565 |
| 571 OmniboxView* SearchTabHelper::GetOmniboxView() const { | 566 OmniboxView* SearchTabHelper::GetOmniboxView() const { |
| 572 return delegate_ ? delegate_->GetOmniboxView() : NULL; | 567 return delegate_ ? delegate_->GetOmniboxView() : NULL; |
| 573 } | 568 } |
| OLD | NEW |