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 <set> | 7 #include <set> |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 bool OmniboxHasFocus(OmniboxView* omnibox) { | 149 bool OmniboxHasFocus(OmniboxView* omnibox) { |
150 return omnibox && omnibox->model()->has_focus(); | 150 return omnibox && omnibox->model()->has_focus(); |
151 } | 151 } |
152 | 152 |
153 } // namespace | 153 } // namespace |
154 | 154 |
155 SearchTabHelper::SearchTabHelper(content::WebContents* web_contents) | 155 SearchTabHelper::SearchTabHelper(content::WebContents* web_contents) |
156 : WebContentsObserver(web_contents), | 156 : WebContentsObserver(web_contents), |
157 is_search_enabled_(chrome::IsInstantExtendedAPIEnabled()), | 157 is_search_enabled_(chrome::IsInstantExtendedAPIEnabled()), |
158 web_contents_(web_contents), | 158 web_contents_(web_contents), |
159 ipc_router_(web_contents, this, | 159 ipc_router_(web_contents, |
160 make_scoped_ptr(new SearchIPCRouterPolicyImpl(web_contents)) | 160 this, |
161 .PassAs<SearchIPCRouter::Policy>()), | 161 make_scoped_ptr(new SearchIPCRouterPolicyImpl(web_contents))), |
162 instant_service_(NULL), | 162 instant_service_(NULL), |
163 delegate_(NULL), | 163 delegate_(NULL), |
164 omnibox_has_focus_fn_(&OmniboxHasFocus) { | 164 omnibox_has_focus_fn_(&OmniboxHasFocus) { |
165 if (!is_search_enabled_) | 165 if (!is_search_enabled_) |
166 return; | 166 return; |
167 | 167 |
168 instant_service_ = | 168 instant_service_ = |
169 InstantServiceFactory::GetForProfile( | 169 InstantServiceFactory::GetForProfile( |
170 Profile::FromBrowserContext(web_contents_->GetBrowserContext())); | 170 Profile::FromBrowserContext(web_contents_->GetBrowserContext())); |
171 if (instant_service_) | 171 if (instant_service_) |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
628 | 628 |
629 bool SearchTabHelper::IsInputInProgress() const { | 629 bool SearchTabHelper::IsInputInProgress() const { |
630 OmniboxView* omnibox = GetOmniboxView(); | 630 OmniboxView* omnibox = GetOmniboxView(); |
631 return !model_.mode().is_ntp() && omnibox && | 631 return !model_.mode().is_ntp() && omnibox && |
632 omnibox->model()->focus_state() == OMNIBOX_FOCUS_VISIBLE; | 632 omnibox->model()->focus_state() == OMNIBOX_FOCUS_VISIBLE; |
633 } | 633 } |
634 | 634 |
635 OmniboxView* SearchTabHelper::GetOmniboxView() const { | 635 OmniboxView* SearchTabHelper::GetOmniboxView() const { |
636 return delegate_ ? delegate_->GetOmniboxView() : NULL; | 636 return delegate_ ? delegate_->GetOmniboxView() : NULL; |
637 } | 637 } |
OLD | NEW |