OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/omnibox/omnibox_current_page_delegate_impl.h" | 5 #include "chrome/browser/ui/omnibox/omnibox_current_page_delegate_impl.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "chrome/browser/autocomplete/autocomplete_match.h" | 8 #include "chrome/browser/autocomplete/autocomplete_match.h" |
9 #include "chrome/browser/extensions/api/omnibox/omnibox_api.h" | 9 #include "chrome/browser/extensions/api/omnibox/omnibox_api.h" |
10 #include "chrome/browser/predictors/autocomplete_action_predictor.h" | 10 #include "chrome/browser/predictors/autocomplete_action_predictor.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 } | 33 } |
34 | 34 |
35 const GURL& OmniboxCurrentPageDelegateImpl::GetURL() const { | 35 const GURL& OmniboxCurrentPageDelegateImpl::GetURL() const { |
36 return controller_->GetWebContents()->GetURL(); | 36 return controller_->GetWebContents()->GetURL(); |
37 } | 37 } |
38 | 38 |
39 bool OmniboxCurrentPageDelegateImpl::IsInstantNTP() const { | 39 bool OmniboxCurrentPageDelegateImpl::IsInstantNTP() const { |
40 return chrome::IsInstantNTP(controller_->GetWebContents()); | 40 return chrome::IsInstantNTP(controller_->GetWebContents()); |
41 } | 41 } |
42 | 42 |
| 43 bool OmniboxCurrentPageDelegateImpl::IsSearchResultsPage() const { |
| 44 SearchTabHelper* search_tab_helper = |
| 45 SearchTabHelper::FromWebContents(controller_->GetWebContents()); |
| 46 return (search_tab_helper && |
| 47 search_tab_helper->model()->mode().is_search_results()); |
| 48 } |
| 49 |
43 bool OmniboxCurrentPageDelegateImpl::IsLoading() const { | 50 bool OmniboxCurrentPageDelegateImpl::IsLoading() const { |
44 return controller_->GetWebContents()->IsLoading(); | 51 return controller_->GetWebContents()->IsLoading(); |
45 } | 52 } |
46 | 53 |
47 content::NavigationController& | 54 content::NavigationController& |
48 OmniboxCurrentPageDelegateImpl::GetNavigationController() const { | 55 OmniboxCurrentPageDelegateImpl::GetNavigationController() const { |
49 return controller_->GetWebContents()->GetController(); | 56 return controller_->GetWebContents()->GetController(); |
50 } | 57 } |
51 | 58 |
52 const SessionID& OmniboxCurrentPageDelegateImpl::GetSessionID() const { | 59 const SessionID& OmniboxCurrentPageDelegateImpl::GetSessionID() const { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 const AutocompleteMatch& match) { | 93 const AutocompleteMatch& match) { |
87 content::WebContents* web_contents = controller_->GetWebContents(); | 94 content::WebContents* web_contents = controller_->GetWebContents(); |
88 gfx::Rect container_bounds; | 95 gfx::Rect container_bounds; |
89 web_contents->GetView()->GetContainerBounds(&container_bounds); | 96 web_contents->GetView()->GetContainerBounds(&container_bounds); |
90 predictors::AutocompleteActionPredictorFactory::GetForProfile(profile_)-> | 97 predictors::AutocompleteActionPredictorFactory::GetForProfile(profile_)-> |
91 StartPrerendering( | 98 StartPrerendering( |
92 match.destination_url, | 99 match.destination_url, |
93 web_contents->GetController().GetSessionStorageNamespaceMap(), | 100 web_contents->GetController().GetSessionStorageNamespaceMap(), |
94 container_bounds.size()); | 101 container_bounds.size()); |
95 } | 102 } |
OLD | NEW |