OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/browser.h" | 5 #include "chrome/browser/ui/browser.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <shellapi.h> | 9 #include <shellapi.h> |
10 #endif // OS_WIN | 10 #endif // OS_WIN |
(...skipping 2835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2846 break; | 2846 break; |
2847 } | 2847 } |
2848 } | 2848 } |
2849 | 2849 |
2850 if (rph_delegate != NULL) | 2850 if (rph_delegate != NULL) |
2851 infobar_helper->AddInfoBar(rph_delegate); | 2851 infobar_helper->AddInfoBar(rph_delegate); |
2852 } | 2852 } |
2853 } | 2853 } |
2854 | 2854 |
2855 // static | 2855 // static |
2856 void Browser::RegisterIntentHandlerHelper(WebContents* tab, | 2856 void Browser::RegisterIntentHandlerHelper(WebContents* tab, |
Ben Goodger (Google)
2012/03/08 23:32:38
Since this is a static function, does it really ne
Jesse Greenwald
2012/03/10 00:13:26
Done.
| |
2857 const string16& action, | 2857 const string16& action, |
2858 const string16& type, | 2858 const string16& type, |
2859 const string16& href, | 2859 const string16& href, |
2860 const string16& title, | 2860 const string16& title, |
2861 const string16& disposition) { | 2861 const string16& disposition) { |
2862 // TODO(yfriedman): remove OS_ANDROID clause when browser is excluded from | |
2863 // Android build. | |
2864 #if defined(OS_ANDROID) | |
2865 return; | |
2866 #else | |
2862 if (!web_intents::IsWebIntentsEnabled()) | 2867 if (!web_intents::IsWebIntentsEnabled()) |
2863 return; | 2868 return; |
2864 | 2869 |
2865 TabContentsWrapper* tcw = TabContentsWrapper::GetCurrentWrapperForContents( | 2870 TabContentsWrapper* tcw = TabContentsWrapper::GetCurrentWrapperForContents( |
2866 tab); | 2871 tab); |
2867 if (!tcw || tcw->profile()->IsOffTheRecord()) | 2872 if (!tcw || tcw->profile()->IsOffTheRecord()) |
2868 return; | 2873 return; |
2869 | 2874 |
2870 FaviconService* favicon_service = | 2875 FaviconService* favicon_service = |
2871 tcw->profile()->GetFaviconService(Profile::EXPLICIT_ACCESS); | 2876 tcw->profile()->GetFaviconService(Profile::EXPLICIT_ACCESS); |
(...skipping 11 matching lines...) Expand all Loading... | |
2883 service.type = type; | 2888 service.type = type; |
2884 service.title = title; | 2889 service.title = title; |
2885 service.setDisposition(disposition); | 2890 service.setDisposition(disposition); |
2886 | 2891 |
2887 RegisterIntentHandlerInfoBarDelegate::MaybeShowIntentInfoBar( | 2892 RegisterIntentHandlerInfoBarDelegate::MaybeShowIntentInfoBar( |
2888 tcw->infobar_tab_helper(), | 2893 tcw->infobar_tab_helper(), |
2889 WebIntentsRegistryFactory::GetForProfile(tcw->profile()), | 2894 WebIntentsRegistryFactory::GetForProfile(tcw->profile()), |
2890 service, | 2895 service, |
2891 favicon_service, | 2896 favicon_service, |
2892 tab->GetURL()); | 2897 tab->GetURL()); |
2898 #endif // defined(OS_ANDROID) | |
2893 } | 2899 } |
2894 | 2900 |
2895 // static | 2901 // static |
2896 void Browser::FindReplyHelper(WebContents* tab, | 2902 void Browser::FindReplyHelper(WebContents* tab, |
2897 int request_id, | 2903 int request_id, |
2898 int number_of_matches, | 2904 int number_of_matches, |
2899 const gfx::Rect& selection_rect, | 2905 const gfx::Rect& selection_rect, |
2900 int active_match_ordinal, | 2906 int active_match_ordinal, |
2901 bool final_update) { | 2907 bool final_update) { |
2902 TabContentsWrapper* tcw = TabContentsWrapper::GetCurrentWrapperForContents( | 2908 TabContentsWrapper* tcw = TabContentsWrapper::GetCurrentWrapperForContents( |
(...skipping 1299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4202 const string16& action, | 4208 const string16& action, |
4203 const string16& type, | 4209 const string16& type, |
4204 const string16& href, | 4210 const string16& href, |
4205 const string16& title, | 4211 const string16& title, |
4206 const string16& disposition) { | 4212 const string16& disposition) { |
4207 RegisterIntentHandlerHelper(tab, action, type, href, title, disposition); | 4213 RegisterIntentHandlerHelper(tab, action, type, href, title, disposition); |
4208 } | 4214 } |
4209 | 4215 |
4210 void Browser::WebIntentDispatch( | 4216 void Browser::WebIntentDispatch( |
4211 WebContents* tab, content::WebIntentsDispatcher* intents_dispatcher) { | 4217 WebContents* tab, content::WebIntentsDispatcher* intents_dispatcher) { |
4218 // TODO(yfriedman): remove OS_ANDROID clause when browser is excluded from | |
4219 // Android build. | |
4220 #if !defined(OS_ANDROID) | |
4212 if (!web_intents::IsWebIntentsEnabled()) | 4221 if (!web_intents::IsWebIntentsEnabled()) |
4213 return; | 4222 return; |
4214 | 4223 |
4215 TabContentsWrapper* tcw = | 4224 TabContentsWrapper* tcw = |
4216 TabContentsWrapper::GetCurrentWrapperForContents(tab); | 4225 TabContentsWrapper::GetCurrentWrapperForContents(tab); |
4217 tcw->web_intent_picker_controller()->SetIntentsDispatcher(intents_dispatcher); | 4226 tcw->web_intent_picker_controller()->SetIntentsDispatcher(intents_dispatcher); |
4218 tcw->web_intent_picker_controller()->ShowDialog( | 4227 tcw->web_intent_picker_controller()->ShowDialog( |
4219 this, | 4228 this, |
4220 intents_dispatcher->GetIntent().action, | 4229 intents_dispatcher->GetIntent().action, |
4221 intents_dispatcher->GetIntent().type); | 4230 intents_dispatcher->GetIntent().type); |
4231 #endif // !defined(OS_ANDROID) | |
4222 } | 4232 } |
4223 | 4233 |
4224 void Browser::FindReply(WebContents* tab, | 4234 void Browser::FindReply(WebContents* tab, |
4225 int request_id, | 4235 int request_id, |
4226 int number_of_matches, | 4236 int number_of_matches, |
4227 const gfx::Rect& selection_rect, | 4237 const gfx::Rect& selection_rect, |
4228 int active_match_ordinal, | 4238 int active_match_ordinal, |
4229 bool final_update) { | 4239 bool final_update) { |
4230 FindReplyHelper(tab, request_id, number_of_matches, selection_rect, | 4240 FindReplyHelper(tab, request_id, number_of_matches, selection_rect, |
4231 active_match_ordinal, final_update); | 4241 active_match_ordinal, final_update); |
(...skipping 1414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5646 ShowSingletonTabOverwritingNTP(params); | 5656 ShowSingletonTabOverwritingNTP(params); |
5647 } else { | 5657 } else { |
5648 LoginUIServiceFactory::GetForProfile( | 5658 LoginUIServiceFactory::GetForProfile( |
5649 profile()->GetOriginalProfile())->ShowLoginUI(); | 5659 profile()->GetOriginalProfile())->ShowLoginUI(); |
5650 } | 5660 } |
5651 } | 5661 } |
5652 | 5662 |
5653 void Browser::ToggleSpeechInput() { | 5663 void Browser::ToggleSpeechInput() { |
5654 GetSelectedWebContents()->GetRenderViewHost()->ToggleSpeechInput(); | 5664 GetSelectedWebContents()->GetRenderViewHost()->ToggleSpeechInput(); |
5655 } | 5665 } |
OLD | NEW |