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/views/external_tab_container_win.h" | 5 #include "chrome/browser/ui/views/external_tab_container_win.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
11 #include "base/debug/trace_event.h" | 11 #include "base/debug/trace_event.h" |
12 #include "base/i18n/rtl.h" | 12 #include "base/i18n/rtl.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/string16.h" | 15 #include "base/string16.h" |
16 #include "base/time.h" | 16 #include "base/time.h" |
17 #include "base/utf_string_conversions.h" | 17 #include "base/utf_string_conversions.h" |
18 #include "base/win/win_util.h" | 18 #include "base/win/win_util.h" |
19 #include "chrome/app/chrome_command_ids.h" | 19 #include "chrome/app/chrome_command_ids.h" |
20 #include "chrome/app/chrome_dll_resource.h" | 20 #include "chrome/app/chrome_dll_resource.h" |
21 #include "chrome/browser/api/infobars/infobar_service.h" | 21 #include "chrome/browser/api/infobars/infobar_service.h" |
22 #include "chrome/browser/automation/automation_provider.h" | 22 #include "chrome/browser/automation/automation_provider.h" |
23 #include "chrome/browser/devtools/devtools_toggle_action.h" | 23 #include "chrome/browser/devtools/devtools_toggle_action.h" |
24 #include "chrome/browser/devtools/devtools_window.h" | 24 #include "chrome/browser/devtools/devtools_window.h" |
25 #include "chrome/browser/file_select_helper.h" | 25 #include "chrome/browser/file_select_helper.h" |
26 #include "chrome/browser/history/history_tab_helper.h" | 26 #include "chrome/browser/history/history_tab_helper.h" |
27 #include "chrome/browser/history/history_types.h" | 27 #include "chrome/browser/history/history_types.h" |
| 28 #include "chrome/browser/intents/register_intent_handler_infobar_delegate.h" |
28 #include "chrome/browser/pepper_broker_infobar_delegate.h" | 29 #include "chrome/browser/pepper_broker_infobar_delegate.h" |
29 #include "chrome/browser/profiles/profile.h" | 30 #include "chrome/browser/profiles/profile.h" |
30 #include "chrome/browser/repost_form_warning_controller.h" | 31 #include "chrome/browser/repost_form_warning_controller.h" |
31 #include "chrome/browser/themes/theme_service.h" | 32 #include "chrome/browser/themes/theme_service.h" |
32 #include "chrome/browser/ui/app_modal_dialogs/javascript_dialog_creator.h" | 33 #include "chrome/browser/ui/app_modal_dialogs/javascript_dialog_creator.h" |
33 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" | 34 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" |
34 #include "chrome/browser/ui/browser.h" | 35 #include "chrome/browser/ui/browser.h" |
35 #include "chrome/browser/ui/browser_tab_contents.h" | 36 #include "chrome/browser/ui/browser_tab_contents.h" |
36 #include "chrome/browser/ui/browser_window.h" | 37 #include "chrome/browser/ui/browser_window.h" |
| 38 #include "chrome/browser/ui/media_stream_infobar_delegate.h" |
37 #include "chrome/browser/ui/tab_modal_confirm_dialog.h" | 39 #include "chrome/browser/ui/tab_modal_confirm_dialog.h" |
38 #include "chrome/browser/ui/views/infobars/infobar_container_view.h" | 40 #include "chrome/browser/ui/views/infobars/infobar_container_view.h" |
39 #include "chrome/browser/ui/views/tab_contents/render_view_context_menu_win.h" | 41 #include "chrome/browser/ui/views/tab_contents/render_view_context_menu_win.h" |
40 #include "chrome/common/automation_messages.h" | 42 #include "chrome/common/automation_messages.h" |
41 #include "chrome/common/chrome_constants.h" | 43 #include "chrome/common/chrome_constants.h" |
42 #include "chrome/common/chrome_notification_types.h" | 44 #include "chrome/common/chrome_notification_types.h" |
43 #include "chrome/common/render_messages.h" | 45 #include "chrome/common/render_messages.h" |
44 #include "chrome/common/url_constants.h" | 46 #include "chrome/common/url_constants.h" |
45 #include "content/public/browser/load_notification_details.h" | 47 #include "content/public/browser/load_notification_details.h" |
46 #include "content/public/browser/native_web_keyboard_event.h" | 48 #include "content/public/browser/native_web_keyboard_event.h" |
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
793 const string16& title, | 795 const string16& title, |
794 bool user_gesture) { | 796 bool user_gesture) { |
795 Browser::RegisterProtocolHandlerHelper(tab, protocol, url, title, | 797 Browser::RegisterProtocolHandlerHelper(tab, protocol, url, title, |
796 user_gesture, NULL); | 798 user_gesture, NULL); |
797 } | 799 } |
798 | 800 |
799 void ExternalTabContainerWin::RegisterIntentHandler( | 801 void ExternalTabContainerWin::RegisterIntentHandler( |
800 WebContents* tab, | 802 WebContents* tab, |
801 const webkit_glue::WebIntentServiceData& data, | 803 const webkit_glue::WebIntentServiceData& data, |
802 bool user_gesture) { | 804 bool user_gesture) { |
803 Browser::RegisterIntentHandlerHelper(tab, data, user_gesture); | 805 RegisterIntentHandlerInfoBarDelegate::Create(tab, data); |
804 } | 806 } |
805 | 807 |
806 void ExternalTabContainerWin::WebIntentDispatch( | 808 void ExternalTabContainerWin::WebIntentDispatch( |
807 WebContents* tab, | 809 WebContents* tab, |
808 content::WebIntentsDispatcher* intents_dispatcher) { | 810 content::WebIntentsDispatcher* intents_dispatcher) { |
809 // TODO(binji) How do we want to display the WebIntentPicker bubble if there | 811 // TODO(binji) How do we want to display the WebIntentPicker bubble if there |
810 // is no BrowserWindow? | 812 // is no BrowserWindow? |
811 delete intents_dispatcher; | 813 delete intents_dispatcher; |
812 } | 814 } |
813 | 815 |
814 void ExternalTabContainerWin::FindReply(WebContents* tab, | 816 void ExternalTabContainerWin::FindReply(WebContents* tab, |
815 int request_id, | 817 int request_id, |
816 int number_of_matches, | 818 int number_of_matches, |
817 const gfx::Rect& selection_rect, | 819 const gfx::Rect& selection_rect, |
818 int active_match_ordinal, | 820 int active_match_ordinal, |
819 bool final_update) { | 821 bool final_update) { |
820 Browser::FindReplyHelper(tab, request_id, number_of_matches, selection_rect, | 822 Browser::FindReplyHelper(tab, request_id, number_of_matches, selection_rect, |
821 active_match_ordinal, final_update); | 823 active_match_ordinal, final_update); |
822 } | 824 } |
823 | 825 |
824 void ExternalTabContainerWin::RequestMediaAccessPermission( | 826 void ExternalTabContainerWin::RequestMediaAccessPermission( |
825 content::WebContents* web_contents, | 827 content::WebContents* web_contents, |
826 const content::MediaStreamRequest& request, | 828 const content::MediaStreamRequest& request, |
827 const content::MediaResponseCallback& callback) { | 829 const content::MediaResponseCallback& callback) { |
828 Browser::RequestMediaAccessPermissionHelper(web_contents, request, callback); | 830 MediaStreamInfoBarDelegate::Create(web_contents, request, callback); |
829 } | 831 } |
830 | 832 |
831 bool ExternalTabContainerWin::RequestPpapiBrokerPermission( | 833 bool ExternalTabContainerWin::RequestPpapiBrokerPermission( |
832 WebContents* web_contents, | 834 WebContents* web_contents, |
833 const GURL& url, | 835 const GURL& url, |
834 const FilePath& plugin_path, | 836 const FilePath& plugin_path, |
835 const base::Callback<void(bool)>& callback) { | 837 const base::Callback<void(bool)>& callback) { |
836 PepperBrokerInfoBarDelegate::Show(web_contents, url, plugin_path, callback); | 838 PepperBrokerInfoBarDelegate::Create(web_contents, url, plugin_path, callback); |
837 return true; | 839 return true; |
838 } | 840 } |
839 | 841 |
840 bool ExternalTabContainerWin::OnMessageReceived(const IPC::Message& message) { | 842 bool ExternalTabContainerWin::OnMessageReceived(const IPC::Message& message) { |
841 bool handled = true; | 843 bool handled = true; |
842 IPC_BEGIN_MESSAGE_MAP(ExternalTabContainerWin, message) | 844 IPC_BEGIN_MESSAGE_MAP(ExternalTabContainerWin, message) |
843 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_ForwardMessageToExternalHost, | 845 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_ForwardMessageToExternalHost, |
844 OnForwardMessageToExternalHost) | 846 OnForwardMessageToExternalHost) |
845 IPC_MESSAGE_UNHANDLED(handled = false) | 847 IPC_MESSAGE_UNHANDLED(handled = false) |
846 IPC_END_MESSAGE_MAP() | 848 IPC_END_MESSAGE_MAP() |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1279 if (params.disposition == CURRENT_TAB) { | 1281 if (params.disposition == CURRENT_TAB) { |
1280 DCHECK(route_all_top_level_navigations_); | 1282 DCHECK(route_all_top_level_navigations_); |
1281 forward_params.disposition = NEW_FOREGROUND_TAB; | 1283 forward_params.disposition = NEW_FOREGROUND_TAB; |
1282 } | 1284 } |
1283 WebContents* new_contents = | 1285 WebContents* new_contents = |
1284 ExternalTabContainerWin::OpenURLFromTab(source, forward_params); | 1286 ExternalTabContainerWin::OpenURLFromTab(source, forward_params); |
1285 // support only one navigation for a dummy tab before it is killed. | 1287 // support only one navigation for a dummy tab before it is killed. |
1286 ::DestroyWindow(GetNativeView()); | 1288 ::DestroyWindow(GetNativeView()); |
1287 return new_contents; | 1289 return new_contents; |
1288 } | 1290 } |
OLD | NEW |