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" | |
| 24 #include "chrome/browser/ui/browser_window.h" | 23 #include "chrome/browser/ui/browser_window.h" |
| 25 #include "chrome/browser/ui/location_bar/location_bar.h" | 24 #include "chrome/browser/ui/location_bar/location_bar.h" |
| 26 #include "chrome/browser/ui/omnibox/clipboard_utils.h" | 25 #include "chrome/browser/ui/omnibox/clipboard_utils.h" |
| 27 #include "chrome/browser/ui/search/instant_search_prerenderer.h" | 26 #include "chrome/browser/ui/search/instant_search_prerenderer.h" |
| 28 #include "chrome/browser/ui/search/instant_tab.h" | 27 #include "chrome/browser/ui/search/instant_tab.h" |
| 29 #include "chrome/browser/ui/search/search_ipc_router_policy_impl.h" | 28 #include "chrome/browser/ui/search/search_ipc_router_policy_impl.h" |
| 30 #include "chrome/browser/ui/search/search_tab_helper_delegate.h" | 29 #include "chrome/browser/ui/search/search_tab_helper_delegate.h" |
| 31 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" | 30 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" |
| 32 #include "chrome/browser/ui/webui/ntp/ntp_user_data_logger.h" | 31 #include "chrome/browser/ui/webui/ntp/ntp_user_data_logger.h" |
| 33 #include "chrome/common/url_constants.h" | 32 #include "chrome/common/url_constants.h" |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 257 } | 256 } |
| 258 | 257 |
| 259 void SearchTabHelper::OnTabDeactivated() { | 258 void SearchTabHelper::OnTabDeactivated() { |
| 260 ipc_router_.OnTabDeactivated(); | 259 ipc_router_.OnTabDeactivated(); |
| 261 } | 260 } |
| 262 | 261 |
| 263 bool SearchTabHelper::IsSearchResultsPage() { | 262 bool SearchTabHelper::IsSearchResultsPage() { |
| 264 return model_.mode().is_origin_search(); | 263 return model_.mode().is_origin_search(); |
| 265 } | 264 } |
| 266 | 265 |
| 267 void SearchTabHelper::RenderViewCreated( | |
|
nasko
2016/07/25 15:56:41
Super happy to see this go! Thanks!
| |
| 268 content::RenderViewHost* render_view_host) { | |
| 269 ipc_router_.SetPromoInformation(IsAppLauncherEnabled()); | |
| 270 } | |
| 271 | |
| 272 void SearchTabHelper::DidStartNavigationToPendingEntry( | 266 void SearchTabHelper::DidStartNavigationToPendingEntry( |
| 273 const GURL& url, | 267 const GURL& url, |
| 274 content::NavigationController::ReloadType /* reload_type */) { | 268 content::NavigationController::ReloadType /* reload_type */) { |
| 275 if (search::IsNTPURL(url, profile())) { | 269 if (search::IsNTPURL(url, profile())) { |
| 276 // Set the title on any pending entry corresponding to the NTP. This | 270 // Set the title on any pending entry corresponding to the NTP. This |
| 277 // prevents any flickering of the tab title. | 271 // prevents any flickering of the tab title. |
| 278 content::NavigationEntry* entry = | 272 content::NavigationEntry* entry = |
| 279 web_contents_->GetController().GetPendingEntry(); | 273 web_contents_->GetController().GetPendingEntry(); |
| 280 if (entry) { | 274 if (entry) { |
| 281 web_contents_->UpdateTitleForEntry( | 275 web_contents_->UpdateTitleForEntry( |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 567 | 561 |
| 568 bool SearchTabHelper::IsInputInProgress() const { | 562 bool SearchTabHelper::IsInputInProgress() const { |
| 569 OmniboxView* omnibox = GetOmniboxView(); | 563 OmniboxView* omnibox = GetOmniboxView(); |
| 570 return !model_.mode().is_ntp() && omnibox && | 564 return !model_.mode().is_ntp() && omnibox && |
| 571 omnibox->model()->focus_state() == OMNIBOX_FOCUS_VISIBLE; | 565 omnibox->model()->focus_state() == OMNIBOX_FOCUS_VISIBLE; |
| 572 } | 566 } |
| 573 | 567 |
| 574 OmniboxView* SearchTabHelper::GetOmniboxView() const { | 568 OmniboxView* SearchTabHelper::GetOmniboxView() const { |
| 575 return delegate_ ? delegate_->GetOmniboxView() : NULL; | 569 return delegate_ ? delegate_->GetOmniboxView() : NULL; |
| 576 } | 570 } |
| OLD | NEW |