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 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
678 | 678 |
679 void RenderViewImpl::Initialize(RenderViewImplParams* params) { | 679 void RenderViewImpl::Initialize(RenderViewImplParams* params) { |
680 routing_id_ = params->routing_id; | 680 routing_id_ = params->routing_id; |
681 surface_id_ = params->surface_id; | 681 surface_id_ = params->surface_id; |
682 if (params->opener_id != MSG_ROUTING_NONE && params->is_renderer_created) | 682 if (params->opener_id != MSG_ROUTING_NONE && params->is_renderer_created) |
683 opener_id_ = params->opener_id; | 683 opener_id_ = params->opener_id; |
684 | 684 |
685 // Ensure we start with a valid next_page_id_ from the browser. | 685 // Ensure we start with a valid next_page_id_ from the browser. |
686 DCHECK_GE(next_page_id_, 0); | 686 DCHECK_GE(next_page_id_, 0); |
687 | 687 |
688 RenderFrameImpl* main_render_frame = RenderFrameImpl::Create( | 688 main_render_frame_.reset(RenderFrameImpl::Create( |
689 this, params->main_frame_routing_id); | 689 this, params->main_frame_routing_id)); |
690 // The main frame WebLocalFrame object is closed by | 690 // The main frame WebLocalFrame object is closed by |
691 // RenderFrameImpl::frameDetached(). | 691 // RenderFrameImpl::frameDetached(). |
692 WebLocalFrame* web_frame = WebLocalFrame::create(main_render_frame); | 692 WebLocalFrame* web_frame = WebLocalFrame::create(main_render_frame_.get()); |
693 main_render_frame->SetWebFrame(web_frame); | 693 main_render_frame_->SetWebFrame(web_frame); |
694 | 694 |
695 if (params->proxy_routing_id != MSG_ROUTING_NONE) { | 695 if (params->proxy_routing_id != MSG_ROUTING_NONE) { |
696 CHECK(params->swapped_out); | 696 CHECK(params->swapped_out); |
697 RenderFrameProxy* proxy = | 697 RenderFrameProxy* proxy = |
698 RenderFrameProxy::CreateFrameProxy(params->proxy_routing_id, | 698 RenderFrameProxy::CreateFrameProxy(params->proxy_routing_id, |
699 params->main_frame_routing_id); | 699 params->main_frame_routing_id); |
700 main_render_frame->set_render_frame_proxy(proxy); | 700 main_render_frame_->set_render_frame_proxy(proxy); |
701 } | 701 } |
702 | 702 |
703 webwidget_ = WebView::create(this); | 703 webwidget_ = WebView::create(this); |
704 webwidget_mouse_lock_target_.reset(new WebWidgetLockTarget(webwidget_)); | 704 webwidget_mouse_lock_target_.reset(new WebWidgetLockTarget(webwidget_)); |
705 | 705 |
706 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 706 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
707 | 707 |
708 if (command_line.HasSwitch(switches::kStatsCollectionController)) | 708 if (command_line.HasSwitch(switches::kStatsCollectionController)) |
709 stats_collection_observer_.reset(new StatsCollectionObserver(this)); | 709 stats_collection_observer_.reset(new StatsCollectionObserver(this)); |
710 | 710 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
752 webview()->settings()->setAcceleratedCompositingForFixedRootBackgroundEnabled( | 752 webview()->settings()->setAcceleratedCompositingForFixedRootBackgroundEnabled( |
753 ShouldUseAcceleratedFixedRootBackground(device_scale_factor_)); | 753 ShouldUseAcceleratedFixedRootBackground(device_scale_factor_)); |
754 webview()->settings()->setCompositedScrollingForFramesEnabled( | 754 webview()->settings()->setCompositedScrollingForFramesEnabled( |
755 ShouldUseCompositedScrollingForFrames(device_scale_factor_)); | 755 ShouldUseCompositedScrollingForFrames(device_scale_factor_)); |
756 | 756 |
757 ApplyWebPreferences(webkit_preferences_, webview()); | 757 ApplyWebPreferences(webkit_preferences_, webview()); |
758 | 758 |
759 webview()->settings()->setAllowConnectingInsecureWebSocket( | 759 webview()->settings()->setAllowConnectingInsecureWebSocket( |
760 command_line.HasSwitch(switches::kAllowInsecureWebSocketFromHttpsOrigin)); | 760 command_line.HasSwitch(switches::kAllowInsecureWebSocketFromHttpsOrigin)); |
761 | 761 |
762 main_render_frame_.reset(main_render_frame); | |
763 webview()->setMainFrame(main_render_frame_->GetWebFrame()); | 762 webview()->setMainFrame(main_render_frame_->GetWebFrame()); |
764 main_render_frame_->Initialize(); | 763 main_render_frame_->Initialize(); |
765 | 764 |
766 if (switches::IsTouchDragDropEnabled()) | 765 if (switches::IsTouchDragDropEnabled()) |
767 webview()->settings()->setTouchDragDropEnabled(true); | 766 webview()->settings()->setTouchDragDropEnabled(true); |
768 | 767 |
769 if (switches::IsTouchEditingEnabled()) | 768 if (switches::IsTouchEditingEnabled()) |
770 webview()->settings()->setTouchEditingEnabled(true); | 769 webview()->settings()->setTouchEditingEnabled(true); |
771 | 770 |
772 if (!params->frame_name.empty()) | 771 if (!params->frame_name.empty()) |
(...skipping 1538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2311 static_cast<int32>(status))); | 2310 static_cast<int32>(status))); |
2312 } | 2311 } |
2313 | 2312 |
2314 // RenderView implementation --------------------------------------------------- | 2313 // RenderView implementation --------------------------------------------------- |
2315 | 2314 |
2316 bool RenderViewImpl::Send(IPC::Message* message) { | 2315 bool RenderViewImpl::Send(IPC::Message* message) { |
2317 return RenderWidget::Send(message); | 2316 return RenderWidget::Send(message); |
2318 } | 2317 } |
2319 | 2318 |
2320 RenderFrame* RenderViewImpl::GetMainRenderFrame() { | 2319 RenderFrame* RenderViewImpl::GetMainRenderFrame() { |
2321 return main_render_frame_.get(); | 2320 return main_render_frame_.get(); |
bulach
2014/05/30 15:03:12
just checking....
this would've returned NULL duri
jam
2014/05/30 16:36:54
My hunch is it's not intentional; so far I haven't
| |
2322 } | 2321 } |
2323 | 2322 |
2324 int RenderViewImpl::GetRoutingID() const { | 2323 int RenderViewImpl::GetRoutingID() const { |
2325 return routing_id_; | 2324 return routing_id_; |
2326 } | 2325 } |
2327 | 2326 |
2328 int RenderViewImpl::GetPageId() const { | 2327 int RenderViewImpl::GetPageId() const { |
2329 return page_id_; | 2328 return page_id_; |
2330 } | 2329 } |
2331 | 2330 |
(...skipping 1324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3656 file_chooser_completions_.push_back(linked_ptr<PendingFileChooser>( | 3655 file_chooser_completions_.push_back(linked_ptr<PendingFileChooser>( |
3657 new PendingFileChooser(params, completion))); | 3656 new PendingFileChooser(params, completion))); |
3658 if (file_chooser_completions_.size() == 1) { | 3657 if (file_chooser_completions_.size() == 1) { |
3659 // Actually show the browse dialog when this is the first request. | 3658 // Actually show the browse dialog when this is the first request. |
3660 Send(new ViewHostMsg_RunFileChooser(routing_id_, params)); | 3659 Send(new ViewHostMsg_RunFileChooser(routing_id_, params)); |
3661 } | 3660 } |
3662 return true; | 3661 return true; |
3663 } | 3662 } |
3664 | 3663 |
3665 blink::WebGeolocationClient* RenderViewImpl::geolocationClient() { | 3664 blink::WebGeolocationClient* RenderViewImpl::geolocationClient() { |
3666 if (!geolocation_dispatcher_) | 3665 if (!geolocation_dispatcher_) { |
3667 geolocation_dispatcher_ = new GeolocationDispatcher(this); | 3666 geolocation_dispatcher_ = new GeolocationDispatcher( |
3667 main_render_frame_.get()); | |
3668 } | |
3668 return geolocation_dispatcher_; | 3669 return geolocation_dispatcher_; |
3669 } | 3670 } |
3670 | 3671 |
3671 blink::WebSpeechRecognizer* RenderViewImpl::speechRecognizer() { | 3672 blink::WebSpeechRecognizer* RenderViewImpl::speechRecognizer() { |
3672 if (!speech_recognition_dispatcher_) | 3673 if (!speech_recognition_dispatcher_) |
3673 speech_recognition_dispatcher_ = new SpeechRecognitionDispatcher(this); | 3674 speech_recognition_dispatcher_ = new SpeechRecognitionDispatcher(this); |
3674 return speech_recognition_dispatcher_; | 3675 return speech_recognition_dispatcher_; |
3675 } | 3676 } |
3676 | 3677 |
3677 void RenderViewImpl::zoomLimitsChanged(double minimum_level, | 3678 void RenderViewImpl::zoomLimitsChanged(double minimum_level, |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4084 std::vector<gfx::Size> sizes; | 4085 std::vector<gfx::Size> sizes; |
4085 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 4086 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
4086 if (!url.isEmpty()) | 4087 if (!url.isEmpty()) |
4087 urls.push_back( | 4088 urls.push_back( |
4088 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 4089 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
4089 } | 4090 } |
4090 SendUpdateFaviconURL(urls); | 4091 SendUpdateFaviconURL(urls); |
4091 } | 4092 } |
4092 | 4093 |
4093 } // namespace content | 4094 } // namespace content |
OLD | NEW |