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/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 #include "chrome/common/url_constants.h" | 29 #include "chrome/common/url_constants.h" |
30 #include "chrome/grit/generated_resources.h" | 30 #include "chrome/grit/generated_resources.h" |
31 #include "components/browser_sync/browser/profile_sync_service.h" | 31 #include "components/browser_sync/browser/profile_sync_service.h" |
32 #include "components/google/core/browser/google_util.h" | 32 #include "components/google/core/browser/google_util.h" |
33 #include "components/omnibox/browser/omnibox_edit_model.h" | 33 #include "components/omnibox/browser/omnibox_edit_model.h" |
34 #include "components/omnibox/browser/omnibox_popup_model.h" | 34 #include "components/omnibox/browser/omnibox_popup_model.h" |
35 #include "components/omnibox/browser/omnibox_view.h" | 35 #include "components/omnibox/browser/omnibox_view.h" |
36 #include "components/search/search.h" | 36 #include "components/search/search.h" |
37 #include "components/signin/core/browser/signin_manager.h" | 37 #include "components/signin/core/browser/signin_manager.h" |
38 #include "components/strings/grit/components_strings.h" | 38 #include "components/strings/grit/components_strings.h" |
39 #include "content/public/browser/navigation_controller.h" | |
40 #include "content/public/browser/navigation_details.h" | 39 #include "content/public/browser/navigation_details.h" |
41 #include "content/public/browser/navigation_entry.h" | 40 #include "content/public/browser/navigation_entry.h" |
42 #include "content/public/browser/notification_service.h" | 41 #include "content/public/browser/notification_service.h" |
43 #include "content/public/browser/notification_source.h" | 42 #include "content/public/browser/notification_source.h" |
44 #include "content/public/browser/render_frame_host.h" | 43 #include "content/public/browser/render_frame_host.h" |
45 #include "content/public/browser/render_process_host.h" | 44 #include "content/public/browser/render_process_host.h" |
46 #include "content/public/browser/user_metrics.h" | 45 #include "content/public/browser/user_metrics.h" |
47 #include "content/public/browser/web_contents.h" | 46 #include "content/public/browser/web_contents.h" |
48 #include "content/public/common/referrer.h" | 47 #include "content/public/common/referrer.h" |
49 #include "google_apis/gaia/gaia_auth_util.h" | 48 #include "google_apis/gaia/gaia_auth_util.h" |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 NTPUserDataLogger::GetOrCreateFromWebContents(web_contents_); | 211 NTPUserDataLogger::GetOrCreateFromWebContents(web_contents_); |
213 } | 212 } |
214 } | 213 } |
215 | 214 |
216 void SearchTabHelper::OnTabDeactivated() { | 215 void SearchTabHelper::OnTabDeactivated() { |
217 ipc_router_.OnTabDeactivated(); | 216 ipc_router_.OnTabDeactivated(); |
218 } | 217 } |
219 | 218 |
220 void SearchTabHelper::DidStartNavigationToPendingEntry( | 219 void SearchTabHelper::DidStartNavigationToPendingEntry( |
221 const GURL& url, | 220 const GURL& url, |
222 content::NavigationController::ReloadType /* reload_type */) { | 221 content::ReloadType /* reload_type */) { |
223 if (search::IsNTPURL(url, profile())) { | 222 if (search::IsNTPURL(url, profile())) { |
224 // Set the title on any pending entry corresponding to the NTP. This | 223 // Set the title on any pending entry corresponding to the NTP. This |
225 // prevents any flickering of the tab title. | 224 // prevents any flickering of the tab title. |
226 content::NavigationEntry* entry = | 225 content::NavigationEntry* entry = |
227 web_contents_->GetController().GetPendingEntry(); | 226 web_contents_->GetController().GetPendingEntry(); |
228 if (entry) { | 227 if (entry) { |
229 web_contents_->UpdateTitleForEntry( | 228 web_contents_->UpdateTitleForEntry( |
230 entry, l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE)); | 229 entry, l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE)); |
231 } | 230 } |
232 } | 231 } |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 | 500 |
502 bool SearchTabHelper::IsInputInProgress() const { | 501 bool SearchTabHelper::IsInputInProgress() const { |
503 OmniboxView* omnibox = GetOmniboxView(); | 502 OmniboxView* omnibox = GetOmniboxView(); |
504 return !model_.mode().is_ntp() && omnibox && | 503 return !model_.mode().is_ntp() && omnibox && |
505 omnibox->model()->focus_state() == OMNIBOX_FOCUS_VISIBLE; | 504 omnibox->model()->focus_state() == OMNIBOX_FOCUS_VISIBLE; |
506 } | 505 } |
507 | 506 |
508 OmniboxView* SearchTabHelper::GetOmniboxView() const { | 507 OmniboxView* SearchTabHelper::GetOmniboxView() const { |
509 return delegate_ ? delegate_->GetOmniboxView() : NULL; | 508 return delegate_ ? delegate_->GetOmniboxView() : NULL; |
510 } | 509 } |
OLD | NEW |