| 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 "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
| 8 #include "chrome/browser/search/search.h" | 8 #include "chrome/browser/search/search.h" |
| 9 #include "chrome/common/render_messages.h" | 9 #include "chrome/common/render_messages.h" |
| 10 #include "chrome/common/url_constants.h" | 10 #include "chrome/common/url_constants.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 } | 33 } |
| 34 | 34 |
| 35 bool IsSearchResults(const content::WebContents* contents) { | 35 bool IsSearchResults(const content::WebContents* contents) { |
| 36 return !chrome::GetSearchTerms(contents).empty(); | 36 return !chrome::GetSearchTerms(contents).empty(); |
| 37 } | 37 } |
| 38 | 38 |
| 39 // TODO(kmadhusu): Move this helper from anonymous namespace to chrome | 39 // TODO(kmadhusu): Move this helper from anonymous namespace to chrome |
| 40 // namespace and remove InstantPage::IsLocal(). | 40 // namespace and remove InstantPage::IsLocal(). |
| 41 bool IsLocal(const content::WebContents* contents) { | 41 bool IsLocal(const content::WebContents* contents) { |
| 42 return contents && | 42 return contents && |
| 43 (contents->GetURL() == GURL(chrome::kChromeSearchLocalNtpUrl) || | 43 contents->GetURL() == GURL(chrome::kChromeSearchLocalNtpUrl); |
| 44 contents->GetURL() == GURL(chrome::kChromeSearchLocalGoogleNtpUrl)); | |
| 45 } | 44 } |
| 46 | 45 |
| 47 } // namespace | 46 } // namespace |
| 48 | 47 |
| 49 SearchTabHelper::SearchTabHelper(content::WebContents* web_contents) | 48 SearchTabHelper::SearchTabHelper(content::WebContents* web_contents) |
| 50 : WebContentsObserver(web_contents), | 49 : WebContentsObserver(web_contents), |
| 51 is_search_enabled_(chrome::IsInstantExtendedAPIEnabled()), | 50 is_search_enabled_(chrome::IsInstantExtendedAPIEnabled()), |
| 52 user_input_in_progress_(false), | 51 user_input_in_progress_(false), |
| 53 popup_is_open_(false), | 52 popup_is_open_(false), |
| 54 user_text_is_empty_(true), | 53 user_text_is_empty_(true), |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 if (!web_contents()->IsActiveEntry(page_id)) | 236 if (!web_contents()->IsActiveEntry(page_id)) |
| 238 return; | 237 return; |
| 239 | 238 |
| 240 InstantSupportChanged(instant_support); | 239 InstantSupportChanged(instant_support); |
| 241 } | 240 } |
| 242 | 241 |
| 243 void SearchTabHelper::OnSetVoiceSearchSupported(int page_id, bool supported) { | 242 void SearchTabHelper::OnSetVoiceSearchSupported(int page_id, bool supported) { |
| 244 if (web_contents()->IsActiveEntry(page_id)) | 243 if (web_contents()->IsActiveEntry(page_id)) |
| 245 model_.SetVoiceSearchSupported(supported); | 244 model_.SetVoiceSearchSupported(supported); |
| 246 } | 245 } |
| OLD | NEW |