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 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
662 bool was_created_by_renderer) { | 662 bool was_created_by_renderer) { |
663 routing_id_ = params.view_id; | 663 routing_id_ = params.view_id; |
664 surface_id_ = params.surface_id; | 664 surface_id_ = params.surface_id; |
665 if (params.opener_route_id != MSG_ROUTING_NONE && was_created_by_renderer) | 665 if (params.opener_route_id != MSG_ROUTING_NONE && was_created_by_renderer) |
666 opener_id_ = params.opener_route_id; | 666 opener_id_ = params.opener_route_id; |
667 display_mode_= params.initial_size.display_mode; | 667 display_mode_= params.initial_size.display_mode; |
668 | 668 |
669 // Ensure we start with a valid next_page_id_ from the browser. | 669 // Ensure we start with a valid next_page_id_ from the browser. |
670 DCHECK_GE(next_page_id_, 0); | 670 DCHECK_GE(next_page_id_, 0); |
671 | 671 |
672 main_render_frame_.reset(RenderFrameImpl::Create( | 672 main_render_frame_ = RenderFrameImpl::Create( |
673 this, params.main_frame_routing_id)); | 673 this, params.main_frame_routing_id); |
674 // The main frame WebLocalFrame object is closed by | 674 // The main frame WebLocalFrame object is closed by |
675 // RenderFrameImpl::frameDetached(). | 675 // RenderFrameImpl::frameDetached(). |
676 WebLocalFrame* web_frame = WebLocalFrame::create(main_render_frame_.get()); | 676 WebLocalFrame* web_frame = WebLocalFrame::create(main_render_frame_); |
677 main_render_frame_->SetWebFrame(web_frame); | 677 main_render_frame_->SetWebFrame(web_frame); |
678 | 678 |
679 compositor_deps_ = compositor_deps; | 679 compositor_deps_ = compositor_deps; |
680 webwidget_ = WebView::create(this); | 680 webwidget_ = WebView::create(this); |
681 webwidget_mouse_lock_target_.reset(new WebWidgetLockTarget(webwidget_)); | 681 webwidget_mouse_lock_target_.reset(new WebWidgetLockTarget(webwidget_)); |
682 | 682 |
683 const base::CommandLine& command_line = | 683 const base::CommandLine& command_line = |
684 *base::CommandLine::ForCurrentProcess(); | 684 *base::CommandLine::ForCurrentProcess(); |
685 | 685 |
686 if (command_line.HasSwitch(switches::kStatsCollectionController)) | 686 if (command_line.HasSwitch(switches::kStatsCollectionController)) |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
727 !command_line.HasSwitch(switches::kDisableThreadedScrolling)); | 727 !command_line.HasSwitch(switches::kDisableThreadedScrolling)); |
728 webview()->settings()->setRootLayerScrolls( | 728 webview()->settings()->setRootLayerScrolls( |
729 command_line.HasSwitch(switches::kRootLayerScrolls)); | 729 command_line.HasSwitch(switches::kRootLayerScrolls)); |
730 | 730 |
731 ApplyWebPreferences(webkit_preferences_, webview()); | 731 ApplyWebPreferences(webkit_preferences_, webview()); |
732 | 732 |
733 RenderFrameProxy* proxy = NULL; | 733 RenderFrameProxy* proxy = NULL; |
734 if (params.proxy_routing_id != MSG_ROUTING_NONE) { | 734 if (params.proxy_routing_id != MSG_ROUTING_NONE) { |
735 CHECK(params.swapped_out); | 735 CHECK(params.swapped_out); |
736 proxy = RenderFrameProxy::CreateProxyToReplaceFrame( | 736 proxy = RenderFrameProxy::CreateProxyToReplaceFrame( |
737 main_render_frame_.get(), params.proxy_routing_id); | 737 main_render_frame_, params.proxy_routing_id); |
738 main_render_frame_->set_render_frame_proxy(proxy); | 738 main_render_frame_->set_render_frame_proxy(proxy); |
739 } | 739 } |
740 | 740 |
741 // In --site-per-process, just use the WebRemoteFrame as the main frame. | 741 // In --site-per-process, just use the WebRemoteFrame as the main frame. |
742 if (command_line.HasSwitch(switches::kSitePerProcess) && proxy) { | 742 if (command_line.HasSwitch(switches::kSitePerProcess) && proxy) { |
743 webview()->setMainFrame(proxy->web_frame()); | 743 webview()->setMainFrame(proxy->web_frame()); |
744 // Initialize the WebRemoteFrame with information replicated from the | 744 // Initialize the WebRemoteFrame with information replicated from the |
745 // browser process. | 745 // browser process. |
746 proxy->SetReplicatedState(params.replicated_frame_state); | 746 proxy->SetReplicatedState(params.replicated_frame_state); |
747 } else { | 747 } else { |
(...skipping 1415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2163 static_cast<int32>(status))); | 2163 static_cast<int32>(status))); |
2164 } | 2164 } |
2165 | 2165 |
2166 // RenderView implementation --------------------------------------------------- | 2166 // RenderView implementation --------------------------------------------------- |
2167 | 2167 |
2168 bool RenderViewImpl::Send(IPC::Message* message) { | 2168 bool RenderViewImpl::Send(IPC::Message* message) { |
2169 return RenderWidget::Send(message); | 2169 return RenderWidget::Send(message); |
2170 } | 2170 } |
2171 | 2171 |
2172 RenderFrameImpl* RenderViewImpl::GetMainRenderFrame() { | 2172 RenderFrameImpl* RenderViewImpl::GetMainRenderFrame() { |
2173 return main_render_frame_.get(); | 2173 return main_render_frame_; |
2174 } | 2174 } |
2175 | 2175 |
2176 int RenderViewImpl::GetRoutingID() const { | 2176 int RenderViewImpl::GetRoutingID() const { |
2177 return routing_id_; | 2177 return routing_id_; |
2178 } | 2178 } |
2179 | 2179 |
2180 gfx::Size RenderViewImpl::GetSize() const { | 2180 gfx::Size RenderViewImpl::GetSize() const { |
2181 return size(); | 2181 return size(); |
2182 } | 2182 } |
2183 | 2183 |
(...skipping 1301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3485 user_gesture)); | 3485 user_gesture)); |
3486 } | 3486 } |
3487 | 3487 |
3488 blink::WebPageVisibilityState RenderViewImpl::visibilityState() const { | 3488 blink::WebPageVisibilityState RenderViewImpl::visibilityState() const { |
3489 blink::WebPageVisibilityState current_state = is_hidden() ? | 3489 blink::WebPageVisibilityState current_state = is_hidden() ? |
3490 blink::WebPageVisibilityStateHidden : | 3490 blink::WebPageVisibilityStateHidden : |
3491 blink::WebPageVisibilityStateVisible; | 3491 blink::WebPageVisibilityStateVisible; |
3492 blink::WebPageVisibilityState override_state = current_state; | 3492 blink::WebPageVisibilityState override_state = current_state; |
3493 // TODO(jam): move this method to WebFrameClient. | 3493 // TODO(jam): move this method to WebFrameClient. |
3494 if (GetContentClient()->renderer()-> | 3494 if (GetContentClient()->renderer()-> |
3495 ShouldOverridePageVisibilityState(main_render_frame_.get(), | 3495 ShouldOverridePageVisibilityState(main_render_frame_, |
3496 &override_state)) | 3496 &override_state)) |
3497 return override_state; | 3497 return override_state; |
3498 return current_state; | 3498 return current_state; |
3499 } | 3499 } |
3500 | 3500 |
3501 void RenderViewImpl::draggableRegionsChanged() { | 3501 void RenderViewImpl::draggableRegionsChanged() { |
3502 FOR_EACH_OBSERVER( | 3502 FOR_EACH_OBSERVER( |
3503 RenderViewObserver, | 3503 RenderViewObserver, |
3504 observers_, | 3504 observers_, |
3505 DraggableRegionsChanged(webview()->mainFrame())); | 3505 DraggableRegionsChanged(webview()->mainFrame())); |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3771 std::vector<gfx::Size> sizes; | 3771 std::vector<gfx::Size> sizes; |
3772 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 3772 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
3773 if (!url.isEmpty()) | 3773 if (!url.isEmpty()) |
3774 urls.push_back( | 3774 urls.push_back( |
3775 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 3775 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
3776 } | 3776 } |
3777 SendUpdateFaviconURL(urls); | 3777 SendUpdateFaviconURL(urls); |
3778 } | 3778 } |
3779 | 3779 |
3780 } // namespace content | 3780 } // namespace content |
OLD | NEW |