Chromium Code Reviews| 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" |
| 11 #include "base/metrics/stats_counters.h" | 11 #include "base/metrics/stats_counters.h" |
| 12 #include "base/string16.h" | 12 #include "base/string16.h" |
| 13 #include "base/string_number_conversions.h" | 13 #include "base/string_number_conversions.h" |
| 14 #include "base/string_util.h" | 14 #include "base/string_util.h" |
| 15 #include "base/sys_info.h" | 15 #include "base/sys_info.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 "cc/switches.h" | 18 #include "cc/switches.h" |
| 19 #include "content/browser/browser_plugin/browser_plugin_embedder.h" | 19 #include "content/browser/browser_plugin/browser_plugin_embedder.h" |
| 20 #include "content/browser/browser_plugin/browser_plugin_guest.h" | 20 #include "content/browser/browser_plugin/browser_plugin_guest.h" |
| 21 #include "content/browser/child_process_security_policy_impl.h" | 21 #include "content/browser/child_process_security_policy_impl.h" |
| 22 #include "content/browser/date_time_chooser.h" | |
| 22 #include "content/browser/devtools/devtools_manager_impl.h" | 23 #include "content/browser/devtools/devtools_manager_impl.h" |
| 23 #include "content/browser/dom_storage/dom_storage_context_impl.h" | 24 #include "content/browser/dom_storage/dom_storage_context_impl.h" |
| 24 #include "content/browser/dom_storage/session_storage_namespace_impl.h" | 25 #include "content/browser/dom_storage/session_storage_namespace_impl.h" |
| 25 #include "content/browser/download/download_stats.h" | 26 #include "content/browser/download/download_stats.h" |
| 26 #include "content/browser/download/mhtml_generation_manager.h" | 27 #include "content/browser/download/mhtml_generation_manager.h" |
| 27 #include "content/browser/download/save_package.h" | 28 #include "content/browser/download/save_package.h" |
| 28 #include "content/browser/gpu/gpu_data_manager_impl.h" | 29 #include "content/browser/gpu/gpu_data_manager_impl.h" |
| 29 #include "content/browser/gpu/gpu_process_host.h" | 30 #include "content/browser/gpu/gpu_process_host.h" |
| 30 #include "content/browser/host_zoom_map_impl.h" | 31 #include "content/browser/host_zoom_map_impl.h" |
| 31 #include "content/browser/intents/web_intents_dispatcher_impl.h" | 32 #include "content/browser/intents/web_intents_dispatcher_impl.h" |
| (...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 712 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateContentRestrictions, | 713 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateContentRestrictions, |
| 713 OnUpdateContentRestrictions) | 714 OnUpdateContentRestrictions) |
| 714 IPC_MESSAGE_HANDLER(ViewHostMsg_GoToEntryAtOffset, OnGoToEntryAtOffset) | 715 IPC_MESSAGE_HANDLER(ViewHostMsg_GoToEntryAtOffset, OnGoToEntryAtOffset) |
| 715 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateZoomLimits, OnUpdateZoomLimits) | 716 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateZoomLimits, OnUpdateZoomLimits) |
| 716 IPC_MESSAGE_HANDLER(ViewHostMsg_SaveURLAs, OnSaveURL) | 717 IPC_MESSAGE_HANDLER(ViewHostMsg_SaveURLAs, OnSaveURL) |
| 717 IPC_MESSAGE_HANDLER(ViewHostMsg_EnumerateDirectory, OnEnumerateDirectory) | 718 IPC_MESSAGE_HANDLER(ViewHostMsg_EnumerateDirectory, OnEnumerateDirectory) |
| 718 IPC_MESSAGE_HANDLER(ViewHostMsg_JSOutOfMemory, OnJSOutOfMemory) | 719 IPC_MESSAGE_HANDLER(ViewHostMsg_JSOutOfMemory, OnJSOutOfMemory) |
| 719 IPC_MESSAGE_HANDLER(ViewHostMsg_RegisterProtocolHandler, | 720 IPC_MESSAGE_HANDLER(ViewHostMsg_RegisterProtocolHandler, |
| 720 OnRegisterProtocolHandler) | 721 OnRegisterProtocolHandler) |
| 721 IPC_MESSAGE_HANDLER(ViewHostMsg_Find_Reply, OnFindReply) | 722 IPC_MESSAGE_HANDLER(ViewHostMsg_Find_Reply, OnFindReply) |
| 722 #if defined(OS_ANDROID) | 723 #if defined(OS_ANDROID) |
|
jam
2013/01/11 23:47:18
nit: can you move this ifdef to the bottom of IPC_
Miguel Garcia
2013/01/14 16:39:40
Done.
| |
| 723 IPC_MESSAGE_HANDLER(ViewHostMsg_FindMatchRects_Reply, | 724 IPC_MESSAGE_HANDLER(ViewHostMsg_FindMatchRects_Reply, |
| 724 OnFindMatchRectsReply) | 725 OnFindMatchRectsReply) |
| 726 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenDateTimeDialog, | |
| 727 OnOpenDateTimeDialog) | |
| 725 #endif | 728 #endif |
| 726 IPC_MESSAGE_HANDLER(ViewHostMsg_CrashedPlugin, OnCrashedPlugin) | 729 IPC_MESSAGE_HANDLER(ViewHostMsg_CrashedPlugin, OnCrashedPlugin) |
| 727 IPC_MESSAGE_HANDLER(ViewHostMsg_AppCacheAccessed, OnAppCacheAccessed) | 730 IPC_MESSAGE_HANDLER(ViewHostMsg_AppCacheAccessed, OnAppCacheAccessed) |
| 728 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenColorChooser, OnOpenColorChooser) | 731 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenColorChooser, OnOpenColorChooser) |
| 729 IPC_MESSAGE_HANDLER(ViewHostMsg_EndColorChooser, OnEndColorChooser) | 732 IPC_MESSAGE_HANDLER(ViewHostMsg_EndColorChooser, OnEndColorChooser) |
| 730 IPC_MESSAGE_HANDLER(ViewHostMsg_SetSelectedColorInColorChooser, | 733 IPC_MESSAGE_HANDLER(ViewHostMsg_SetSelectedColorInColorChooser, |
| 731 OnSetSelectedColorInColorChooser) | 734 OnSetSelectedColorInColorChooser) |
| 732 IPC_MESSAGE_HANDLER(ViewHostMsg_PepperPluginHung, OnPepperPluginHung) | 735 IPC_MESSAGE_HANDLER(ViewHostMsg_PepperPluginHung, OnPepperPluginHung) |
| 733 IPC_MESSAGE_HANDLER(ViewHostMsg_WebUISend, OnWebUISend) | 736 IPC_MESSAGE_HANDLER(ViewHostMsg_WebUISend, OnWebUISend) |
| 734 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestPpapiBrokerPermission, | 737 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestPpapiBrokerPermission, |
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1171 Source<WebContents>(opener_)); | 1174 Source<WebContents>(opener_)); |
| 1172 } | 1175 } |
| 1173 | 1176 |
| 1174 registrar_.Add(this, | 1177 registrar_.Add(this, |
| 1175 NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, | 1178 NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, |
| 1176 NotificationService::AllBrowserContextsAndSources()); | 1179 NotificationService::AllBrowserContextsAndSources()); |
| 1177 #if defined(ENABLE_JAVA_BRIDGE) | 1180 #if defined(ENABLE_JAVA_BRIDGE) |
| 1178 java_bridge_dispatcher_host_manager_.reset( | 1181 java_bridge_dispatcher_host_manager_.reset( |
| 1179 new JavaBridgeDispatcherHostManager(this)); | 1182 new JavaBridgeDispatcherHostManager(this)); |
| 1180 #endif | 1183 #endif |
| 1184 | |
| 1185 #if defined(OS_ANDROID) | |
| 1186 date_time_chooser_.reset(DateTimeChooser::Create()); | |
| 1187 #endif | |
| 1181 } | 1188 } |
| 1182 | 1189 |
| 1183 void WebContentsImpl::OnWebContentsDestroyed(WebContents* web_contents) { | 1190 void WebContentsImpl::OnWebContentsDestroyed(WebContents* web_contents) { |
| 1184 // Clear the opener if it has been closed. | 1191 // Clear the opener if it has been closed. |
| 1185 if (web_contents == opener_) { | 1192 if (web_contents == opener_) { |
| 1186 registrar_.Remove(this, NOTIFICATION_WEB_CONTENTS_DESTROYED, | 1193 registrar_.Remove(this, NOTIFICATION_WEB_CONTENTS_DESTROYED, |
| 1187 Source<WebContents>(opener_)); | 1194 Source<WebContents>(opener_)); |
| 1188 opener_ = NULL; | 1195 opener_ = NULL; |
| 1189 } | 1196 } |
| 1190 } | 1197 } |
| (...skipping 1067 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2258 } | 2265 } |
| 2259 | 2266 |
| 2260 #if defined(OS_ANDROID) | 2267 #if defined(OS_ANDROID) |
| 2261 void WebContentsImpl::OnFindMatchRectsReply( | 2268 void WebContentsImpl::OnFindMatchRectsReply( |
| 2262 int version, | 2269 int version, |
| 2263 const std::vector<gfx::RectF>& rects, | 2270 const std::vector<gfx::RectF>& rects, |
| 2264 const gfx::RectF& active_rect) { | 2271 const gfx::RectF& active_rect) { |
| 2265 if (delegate_) | 2272 if (delegate_) |
| 2266 delegate_->FindMatchRectsReply(this, version, rects, active_rect); | 2273 delegate_->FindMatchRectsReply(this, version, rects, active_rect); |
| 2267 } | 2274 } |
| 2275 | |
| 2276 void WebContentsImpl::OnOpenDateTimeDialog(int type, const std::string& value) { | |
| 2277 if (date_time_chooser_ != NULL) | |
| 2278 date_time_chooser_->ShowDialog( | |
| 2279 GetContentNativeView(), GetRenderViewHost(), type, value); | |
| 2280 } | |
| 2281 | |
| 2268 #endif | 2282 #endif |
| 2269 | 2283 |
| 2270 void WebContentsImpl::OnCrashedPlugin(const FilePath& plugin_path, | 2284 void WebContentsImpl::OnCrashedPlugin(const FilePath& plugin_path, |
| 2271 base::ProcessId plugin_pid) { | 2285 base::ProcessId plugin_pid) { |
| 2272 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 2286 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
| 2273 PluginCrashed(plugin_path, plugin_pid)); | 2287 PluginCrashed(plugin_path, plugin_pid)); |
| 2274 } | 2288 } |
| 2275 | 2289 |
| 2276 void WebContentsImpl::OnAppCacheAccessed(const GURL& manifest_url, | 2290 void WebContentsImpl::OnAppCacheAccessed(const GURL& manifest_url, |
| 2277 bool blocked_by_policy) { | 2291 bool blocked_by_policy) { |
| (...skipping 1123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3401 | 3415 |
| 3402 BrowserPluginGuest* WebContentsImpl::GetBrowserPluginGuest() { | 3416 BrowserPluginGuest* WebContentsImpl::GetBrowserPluginGuest() { |
| 3403 return browser_plugin_guest_.get(); | 3417 return browser_plugin_guest_.get(); |
| 3404 } | 3418 } |
| 3405 | 3419 |
| 3406 BrowserPluginEmbedder* WebContentsImpl::GetBrowserPluginEmbedder() { | 3420 BrowserPluginEmbedder* WebContentsImpl::GetBrowserPluginEmbedder() { |
| 3407 return browser_plugin_embedder_.get(); | 3421 return browser_plugin_embedder_.get(); |
| 3408 } | 3422 } |
| 3409 | 3423 |
| 3410 } // namespace content | 3424 } // namespace content |
| OLD | NEW |