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/renderer/render_view_impl.h" | 5 #include "content/renderer/render_view_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 const WebPreferences& webkit_prefs, | 503 const WebPreferences& webkit_prefs, |
504 SharedRenderViewCounter* counter, | 504 SharedRenderViewCounter* counter, |
505 int32 routing_id, | 505 int32 routing_id, |
506 int32 surface_id, | 506 int32 surface_id, |
507 int64 session_storage_namespace_id, | 507 int64 session_storage_namespace_id, |
508 const string16& frame_name, | 508 const string16& frame_name, |
509 bool is_renderer_created, | 509 bool is_renderer_created, |
510 bool swapped_out, | 510 bool swapped_out, |
511 int32 next_page_id, | 511 int32 next_page_id, |
512 const WebKit::WebScreenInfo& screen_info, | 512 const WebKit::WebScreenInfo& screen_info, |
513 content::GuestToEmbedderChannel* guest_to_embedder_channel, | 513 content::old::GuestToEmbedderChannel* guest_to_embedder_channel, |
514 AccessibilityMode accessibility_mode) | 514 AccessibilityMode accessibility_mode) |
515 : RenderWidget(WebKit::WebPopupTypeNone, screen_info, swapped_out), | 515 : RenderWidget(WebKit::WebPopupTypeNone, screen_info, swapped_out), |
516 webkit_preferences_(webkit_prefs), | 516 webkit_preferences_(webkit_prefs), |
517 send_content_state_immediately_(false), | 517 send_content_state_immediately_(false), |
518 enabled_bindings_(0), | 518 enabled_bindings_(0), |
519 send_preferred_size_changes_(false), | 519 send_preferred_size_changes_(false), |
520 is_loading_(false), | 520 is_loading_(false), |
521 navigation_gesture_(NavigationGestureUnknown), | 521 navigation_gesture_(NavigationGestureUnknown), |
522 opened_by_user_gesture_(true), | 522 opened_by_user_gesture_(true), |
523 opener_suppressed_(false), | 523 opener_suppressed_(false), |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
725 const WebPreferences& webkit_prefs, | 725 const WebPreferences& webkit_prefs, |
726 SharedRenderViewCounter* counter, | 726 SharedRenderViewCounter* counter, |
727 int32 routing_id, | 727 int32 routing_id, |
728 int32 surface_id, | 728 int32 surface_id, |
729 int64 session_storage_namespace_id, | 729 int64 session_storage_namespace_id, |
730 const string16& frame_name, | 730 const string16& frame_name, |
731 bool is_renderer_created, | 731 bool is_renderer_created, |
732 bool swapped_out, | 732 bool swapped_out, |
733 int32 next_page_id, | 733 int32 next_page_id, |
734 const WebKit::WebScreenInfo& screen_info, | 734 const WebKit::WebScreenInfo& screen_info, |
735 content::GuestToEmbedderChannel* guest_to_embedder_channel, | 735 content::old::GuestToEmbedderChannel* guest_to_embedder_channel, |
736 AccessibilityMode accessibility_mode) { | 736 AccessibilityMode accessibility_mode) { |
737 DCHECK(routing_id != MSG_ROUTING_NONE); | 737 DCHECK(routing_id != MSG_ROUTING_NONE); |
738 return new RenderViewImpl( | 738 return new RenderViewImpl( |
739 parent_hwnd, | 739 parent_hwnd, |
740 opener_id, | 740 opener_id, |
741 renderer_prefs, | 741 renderer_prefs, |
742 webkit_prefs, | 742 webkit_prefs, |
743 counter, | 743 counter, |
744 routing_id, | 744 routing_id, |
745 surface_id, | 745 surface_id, |
(...skipping 30 matching lines...) Expand all Loading... |
776 | 776 |
777 void RenderViewImpl::SetReportLoadProgressEnabled(bool enabled) { | 777 void RenderViewImpl::SetReportLoadProgressEnabled(bool enabled) { |
778 if (!enabled) { | 778 if (!enabled) { |
779 load_progress_tracker_.reset(NULL); | 779 load_progress_tracker_.reset(NULL); |
780 return; | 780 return; |
781 } | 781 } |
782 if (load_progress_tracker_ == NULL) | 782 if (load_progress_tracker_ == NULL) |
783 load_progress_tracker_.reset(new LoadProgressTracker(this)); | 783 load_progress_tracker_.reset(new LoadProgressTracker(this)); |
784 } | 784 } |
785 | 785 |
786 content::GuestToEmbedderChannel* | 786 content::old::GuestToEmbedderChannel* |
787 RenderViewImpl::GetGuestToEmbedderChannel() const { | 787 RenderViewImpl::GetGuestToEmbedderChannel() const { |
788 return guest_to_embedder_channel_; | 788 return guest_to_embedder_channel_; |
789 } | 789 } |
790 | 790 |
791 void RenderViewImpl::SetGuestToEmbedderChannel( | 791 void RenderViewImpl::SetGuestToEmbedderChannel( |
792 content::GuestToEmbedderChannel* channel) { | 792 content::old::GuestToEmbedderChannel* channel) { |
793 guest_to_embedder_channel_ = channel; | 793 guest_to_embedder_channel_ = channel; |
794 } | 794 } |
795 | 795 |
796 void RenderViewImpl::PluginCrashed(const FilePath& plugin_path) { | 796 void RenderViewImpl::PluginCrashed(const FilePath& plugin_path) { |
797 Send(new ViewHostMsg_CrashedPlugin(routing_id_, plugin_path)); | 797 Send(new ViewHostMsg_CrashedPlugin(routing_id_, plugin_path)); |
798 } | 798 } |
799 | 799 |
800 void RenderViewImpl::RegisterPluginDelegate(WebPluginDelegateProxy* delegate) { | 800 void RenderViewImpl::RegisterPluginDelegate(WebPluginDelegateProxy* delegate) { |
801 plugin_delegates_.insert(delegate); | 801 plugin_delegates_.insert(delegate); |
802 // If the renderer is visible, set initial visibility and focus state. | 802 // If the renderer is visible, set initial visibility and focus state. |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
971 CHECK(false) << "Unable to deserialize message in RenderViewImpl."; | 971 CHECK(false) << "Unable to deserialize message in RenderViewImpl."; |
972 } | 972 } |
973 | 973 |
974 return handled; | 974 return handled; |
975 } | 975 } |
976 | 976 |
977 void RenderViewImpl::OnNavigate(const ViewMsg_Navigate_Params& params) { | 977 void RenderViewImpl::OnNavigate(const ViewMsg_Navigate_Params& params) { |
978 // If we don't have guest-to-embedder channel associated with this RenderView | 978 // If we don't have guest-to-embedder channel associated with this RenderView |
979 // but we need one, grab one now. | 979 // but we need one, grab one now. |
980 if (!params.embedder_channel_name.empty() && !GetGuestToEmbedderChannel()) { | 980 if (!params.embedder_channel_name.empty() && !GetGuestToEmbedderChannel()) { |
981 content::GuestToEmbedderChannel* embedder_channel = | 981 content::old::GuestToEmbedderChannel* embedder_channel = |
982 RenderThreadImpl::current()->browser_plugin_channel_manager()-> | 982 RenderThreadImpl::current()->browser_plugin_channel_manager()-> |
983 GetChannelByName(params.embedder_channel_name); | 983 GetChannelByName(params.embedder_channel_name); |
984 DCHECK(embedder_channel); | 984 DCHECK(embedder_channel); |
985 SetGuestToEmbedderChannel(embedder_channel); | 985 SetGuestToEmbedderChannel(embedder_channel); |
986 host_window_set_ = false; | 986 host_window_set_ = false; |
987 // TODO(fsamuel): This is test code. Need to find a better way to tell | 987 // TODO(fsamuel): This is test code. Need to find a better way to tell |
988 // a WebView to drop its context. This needs to change in | 988 // a WebView to drop its context. This needs to change in |
989 // GuestToEmbedderChannel::OnContextLost. | 989 // GuestToEmbedderChannel::OnContextLost. |
990 GetWebView()->loseCompositorContext(1); | 990 GetWebView()->loseCompositorContext(1); |
991 RenderThreadImpl::current()->browser_plugin_channel_manager()-> | 991 RenderThreadImpl::current()->browser_plugin_channel_manager()-> |
(...skipping 1318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2310 | 2310 |
2311 WebPlugin* RenderViewImpl::createPlugin(WebFrame* frame, | 2311 WebPlugin* RenderViewImpl::createPlugin(WebFrame* frame, |
2312 const WebPluginParams& params) { | 2312 const WebPluginParams& params) { |
2313 WebPlugin* plugin = NULL; | 2313 WebPlugin* plugin = NULL; |
2314 if (content::GetContentClient()->renderer()->OverrideCreatePlugin( | 2314 if (content::GetContentClient()->renderer()->OverrideCreatePlugin( |
2315 this, frame, params, &plugin)) { | 2315 this, frame, params, &plugin)) { |
2316 return plugin; | 2316 return plugin; |
2317 } | 2317 } |
2318 | 2318 |
2319 if (UTF16ToASCII(params.mimeType) == content::kBrowserPluginMimeType) | 2319 if (UTF16ToASCII(params.mimeType) == content::kBrowserPluginMimeType) |
2320 return BrowserPlugin::Create(this, frame, params); | 2320 return content::old::BrowserPlugin::Create(this, frame, params); |
2321 | 2321 |
2322 webkit::WebPluginInfo info; | 2322 webkit::WebPluginInfo info; |
2323 std::string mime_type; | 2323 std::string mime_type; |
2324 bool found = GetPluginInfo(params.url, frame->top()->document().url(), | 2324 bool found = GetPluginInfo(params.url, frame->top()->document().url(), |
2325 params.mimeType.utf8(), &info, &mime_type); | 2325 params.mimeType.utf8(), &info, &mime_type); |
2326 if (!found) | 2326 if (!found) |
2327 return NULL; | 2327 return NULL; |
2328 | 2328 |
2329 WebPluginParams params_to_use = params; | 2329 WebPluginParams params_to_use = params; |
2330 params_to_use.mimeType = WebString::fromUTF8(mime_type); | 2330 params_to_use.mimeType = WebString::fromUTF8(mime_type); |
(...skipping 3436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5767 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { | 5767 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { |
5768 return !!RenderThreadImpl::current()->compositor_thread(); | 5768 return !!RenderThreadImpl::current()->compositor_thread(); |
5769 } | 5769 } |
5770 | 5770 |
5771 void RenderViewImpl::OnJavaBridgeInit() { | 5771 void RenderViewImpl::OnJavaBridgeInit() { |
5772 DCHECK(!java_bridge_dispatcher_); | 5772 DCHECK(!java_bridge_dispatcher_); |
5773 #if defined(ENABLE_JAVA_BRIDGE) | 5773 #if defined(ENABLE_JAVA_BRIDGE) |
5774 java_bridge_dispatcher_ = new JavaBridgeDispatcher(this); | 5774 java_bridge_dispatcher_ = new JavaBridgeDispatcher(this); |
5775 #endif | 5775 #endif |
5776 } | 5776 } |
OLD | NEW |