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 "content/browser/web_contents/web_contents_impl.h" | 5 #include "content/browser/web_contents/web_contents_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
78 #include "ui/base/layout.h" | 78 #include "ui/base/layout.h" |
79 #include "ui/base/touch/touch_device_win.h" | 79 #include "ui/base/touch/touch_device_win.h" |
80 #include "ui/base/ui_base_switches.h" | 80 #include "ui/base/ui_base_switches.h" |
81 #include "ui/gfx/display.h" | 81 #include "ui/gfx/display.h" |
82 #include "ui/gfx/screen.h" | 82 #include "ui/gfx/screen.h" |
83 #include "ui/gl/gl_switches.h" | 83 #include "ui/gl/gl_switches.h" |
84 #include "webkit/glue/web_intent_data.h" | 84 #include "webkit/glue/web_intent_data.h" |
85 #include "webkit/glue/web_intent_service_data.h" | 85 #include "webkit/glue/web_intent_service_data.h" |
86 #include "webkit/glue/webpreferences.h" | 86 #include "webkit/glue/webpreferences.h" |
87 | 87 |
88 #if defined(OS_ANDROID) | |
89 #include "content/browser/android/date_time_chooser_android.h" | |
90 #endif | |
91 | |
88 #if defined(OS_MACOSX) | 92 #if defined(OS_MACOSX) |
89 #include "base/mac/foundation_util.h" | 93 #include "base/mac/foundation_util.h" |
90 #include "ui/surface/io_surface_support_mac.h" | 94 #include "ui/surface/io_surface_support_mac.h" |
91 #endif | 95 #endif |
92 | 96 |
93 #if defined(USE_AURA) && defined(USE_X11) | 97 #if defined(USE_AURA) && defined(USE_X11) |
94 #include "ui/aura/window.h" | 98 #include "ui/aura/window.h" |
95 #include "ui/base/touch/touch_factory.h" | 99 #include "ui/base/touch/touch_factory.h" |
96 #endif // defined (USE_AURA) && defined(USE_X11) | 100 #endif // defined (USE_AURA) && defined(USE_X11) |
97 | 101 |
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
718 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateContentRestrictions, | 722 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateContentRestrictions, |
719 OnUpdateContentRestrictions) | 723 OnUpdateContentRestrictions) |
720 IPC_MESSAGE_HANDLER(ViewHostMsg_GoToEntryAtOffset, OnGoToEntryAtOffset) | 724 IPC_MESSAGE_HANDLER(ViewHostMsg_GoToEntryAtOffset, OnGoToEntryAtOffset) |
721 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateZoomLimits, OnUpdateZoomLimits) | 725 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateZoomLimits, OnUpdateZoomLimits) |
722 IPC_MESSAGE_HANDLER(ViewHostMsg_SaveURLAs, OnSaveURL) | 726 IPC_MESSAGE_HANDLER(ViewHostMsg_SaveURLAs, OnSaveURL) |
723 IPC_MESSAGE_HANDLER(ViewHostMsg_EnumerateDirectory, OnEnumerateDirectory) | 727 IPC_MESSAGE_HANDLER(ViewHostMsg_EnumerateDirectory, OnEnumerateDirectory) |
724 IPC_MESSAGE_HANDLER(ViewHostMsg_JSOutOfMemory, OnJSOutOfMemory) | 728 IPC_MESSAGE_HANDLER(ViewHostMsg_JSOutOfMemory, OnJSOutOfMemory) |
725 IPC_MESSAGE_HANDLER(ViewHostMsg_RegisterProtocolHandler, | 729 IPC_MESSAGE_HANDLER(ViewHostMsg_RegisterProtocolHandler, |
726 OnRegisterProtocolHandler) | 730 OnRegisterProtocolHandler) |
727 IPC_MESSAGE_HANDLER(ViewHostMsg_Find_Reply, OnFindReply) | 731 IPC_MESSAGE_HANDLER(ViewHostMsg_Find_Reply, OnFindReply) |
728 #if defined(OS_ANDROID) | |
729 IPC_MESSAGE_HANDLER(ViewHostMsg_FindMatchRects_Reply, | |
730 OnFindMatchRectsReply) | |
731 #endif | |
732 IPC_MESSAGE_HANDLER(ViewHostMsg_CrashedPlugin, OnCrashedPlugin) | 732 IPC_MESSAGE_HANDLER(ViewHostMsg_CrashedPlugin, OnCrashedPlugin) |
733 IPC_MESSAGE_HANDLER(ViewHostMsg_AppCacheAccessed, OnAppCacheAccessed) | 733 IPC_MESSAGE_HANDLER(ViewHostMsg_AppCacheAccessed, OnAppCacheAccessed) |
734 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenColorChooser, OnOpenColorChooser) | 734 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenColorChooser, OnOpenColorChooser) |
735 IPC_MESSAGE_HANDLER(ViewHostMsg_EndColorChooser, OnEndColorChooser) | 735 IPC_MESSAGE_HANDLER(ViewHostMsg_EndColorChooser, OnEndColorChooser) |
736 IPC_MESSAGE_HANDLER(ViewHostMsg_SetSelectedColorInColorChooser, | 736 IPC_MESSAGE_HANDLER(ViewHostMsg_SetSelectedColorInColorChooser, |
737 OnSetSelectedColorInColorChooser) | 737 OnSetSelectedColorInColorChooser) |
738 IPC_MESSAGE_HANDLER(ViewHostMsg_PepperPluginHung, OnPepperPluginHung) | 738 IPC_MESSAGE_HANDLER(ViewHostMsg_PepperPluginHung, OnPepperPluginHung) |
739 IPC_MESSAGE_HANDLER(ViewHostMsg_WebUISend, OnWebUISend) | 739 IPC_MESSAGE_HANDLER(ViewHostMsg_WebUISend, OnWebUISend) |
740 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestPpapiBrokerPermission, | 740 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestPpapiBrokerPermission, |
741 OnRequestPpapiBrokerPermission) | 741 OnRequestPpapiBrokerPermission) |
742 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_CreateGuest, | 742 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_CreateGuest, |
743 OnBrowserPluginCreateGuest) | 743 OnBrowserPluginCreateGuest) |
744 IPC_MESSAGE_HANDLER(IconHostMsg_DidDownloadFavicon, OnDidDownloadFavicon) | 744 IPC_MESSAGE_HANDLER(IconHostMsg_DidDownloadFavicon, OnDidDownloadFavicon) |
745 IPC_MESSAGE_HANDLER(IconHostMsg_UpdateFaviconURL, OnUpdateFaviconURL) | 745 IPC_MESSAGE_HANDLER(IconHostMsg_UpdateFaviconURL, OnUpdateFaviconURL) |
746 #if defined(OS_ANDROID) | |
747 IPC_MESSAGE_HANDLER(ViewHostMsg_FindMatchRects_Reply, | |
748 OnFindMatchRectsReply) | |
749 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenDateTimeDialog, | |
750 OnOpenDateTimeDialog) | |
751 #endif | |
746 IPC_MESSAGE_UNHANDLED(handled = false) | 752 IPC_MESSAGE_UNHANDLED(handled = false) |
747 IPC_END_MESSAGE_MAP_EX() | 753 IPC_END_MESSAGE_MAP_EX() |
748 message_source_ = NULL; | 754 message_source_ = NULL; |
749 | 755 |
750 if (!message_is_ok) { | 756 if (!message_is_ok) { |
751 RecordAction(UserMetricsAction("BadMessageTerminate_RVD")); | 757 RecordAction(UserMetricsAction("BadMessageTerminate_RVD")); |
752 GetRenderProcessHost()->ReceivedBadMessage(); | 758 GetRenderProcessHost()->ReceivedBadMessage(); |
753 } | 759 } |
754 | 760 |
755 return handled; | 761 return handled; |
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1177 Source<WebContents>(opener_)); | 1183 Source<WebContents>(opener_)); |
1178 } | 1184 } |
1179 | 1185 |
1180 registrar_.Add(this, | 1186 registrar_.Add(this, |
1181 NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, | 1187 NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, |
1182 NotificationService::AllBrowserContextsAndSources()); | 1188 NotificationService::AllBrowserContextsAndSources()); |
1183 #if defined(ENABLE_JAVA_BRIDGE) | 1189 #if defined(ENABLE_JAVA_BRIDGE) |
1184 java_bridge_dispatcher_host_manager_.reset( | 1190 java_bridge_dispatcher_host_manager_.reset( |
1185 new JavaBridgeDispatcherHostManager(this)); | 1191 new JavaBridgeDispatcherHostManager(this)); |
1186 #endif | 1192 #endif |
1193 | |
1194 #if defined(OS_ANDROID) | |
1195 date_time_chooser_.reset(new DateTimeChooserAndroid()); | |
1196 #endif | |
1187 } | 1197 } |
1188 | 1198 |
1189 void WebContentsImpl::OnWebContentsDestroyed(WebContents* web_contents) { | 1199 void WebContentsImpl::OnWebContentsDestroyed(WebContents* web_contents) { |
1190 // Clear the opener if it has been closed. | 1200 // Clear the opener if it has been closed. |
1191 if (web_contents == opener_) { | 1201 if (web_contents == opener_) { |
1192 registrar_.Remove(this, NOTIFICATION_WEB_CONTENTS_DESTROYED, | 1202 registrar_.Remove(this, NOTIFICATION_WEB_CONTENTS_DESTROYED, |
1193 Source<WebContents>(opener_)); | 1203 Source<WebContents>(opener_)); |
1194 opener_ = NULL; | 1204 opener_ = NULL; |
1195 } | 1205 } |
1196 } | 1206 } |
(...skipping 1067 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2264 } | 2274 } |
2265 | 2275 |
2266 #if defined(OS_ANDROID) | 2276 #if defined(OS_ANDROID) |
2267 void WebContentsImpl::OnFindMatchRectsReply( | 2277 void WebContentsImpl::OnFindMatchRectsReply( |
2268 int version, | 2278 int version, |
2269 const std::vector<gfx::RectF>& rects, | 2279 const std::vector<gfx::RectF>& rects, |
2270 const gfx::RectF& active_rect) { | 2280 const gfx::RectF& active_rect) { |
2271 if (delegate_) | 2281 if (delegate_) |
2272 delegate_->FindMatchRectsReply(this, version, rects, active_rect); | 2282 delegate_->FindMatchRectsReply(this, version, rects, active_rect); |
2273 } | 2283 } |
2284 | |
2285 void WebContentsImpl::OnOpenDateTimeDialog(int type, const std::string& value) { | |
2286 if (date_time_chooser_ != NULL) | |
bulach
2013/01/17 10:32:21
I think this can't ever be NULL at this point, rig
Miguel Garcia
2013/01/17 12:17:40
Done.
| |
2287 date_time_chooser_->ShowDialog( | |
2288 GetContentNativeView(), GetRenderViewHost(), type, value); | |
2289 } | |
2290 | |
2274 #endif | 2291 #endif |
2275 | 2292 |
2276 void WebContentsImpl::OnCrashedPlugin(const FilePath& plugin_path, | 2293 void WebContentsImpl::OnCrashedPlugin(const FilePath& plugin_path, |
2277 base::ProcessId plugin_pid) { | 2294 base::ProcessId plugin_pid) { |
2278 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 2295 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
2279 PluginCrashed(plugin_path, plugin_pid)); | 2296 PluginCrashed(plugin_path, plugin_pid)); |
2280 } | 2297 } |
2281 | 2298 |
2282 void WebContentsImpl::OnAppCacheAccessed(const GURL& manifest_url, | 2299 void WebContentsImpl::OnAppCacheAccessed(const GURL& manifest_url, |
2283 bool blocked_by_policy) { | 2300 bool blocked_by_policy) { |
(...skipping 1123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3407 | 3424 |
3408 BrowserPluginGuest* WebContentsImpl::GetBrowserPluginGuest() { | 3425 BrowserPluginGuest* WebContentsImpl::GetBrowserPluginGuest() { |
3409 return browser_plugin_guest_.get(); | 3426 return browser_plugin_guest_.get(); |
3410 } | 3427 } |
3411 | 3428 |
3412 BrowserPluginEmbedder* WebContentsImpl::GetBrowserPluginEmbedder() { | 3429 BrowserPluginEmbedder* WebContentsImpl::GetBrowserPluginEmbedder() { |
3413 return browser_plugin_embedder_.get(); | 3430 return browser_plugin_embedder_.get(); |
3414 } | 3431 } |
3415 | 3432 |
3416 } // namespace content | 3433 } // namespace content |
OLD | NEW |