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 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 | 676 |
677 void RenderViewImpl::Initialize(RenderViewImplParams* params) { | 677 void RenderViewImpl::Initialize(RenderViewImplParams* params) { |
678 routing_id_ = params->routing_id; | 678 routing_id_ = params->routing_id; |
679 surface_id_ = params->surface_id; | 679 surface_id_ = params->surface_id; |
680 if (params->opener_id != MSG_ROUTING_NONE && params->is_renderer_created) | 680 if (params->opener_id != MSG_ROUTING_NONE && params->is_renderer_created) |
681 opener_id_ = params->opener_id; | 681 opener_id_ = params->opener_id; |
682 | 682 |
683 // Ensure we start with a valid next_page_id_ from the browser. | 683 // Ensure we start with a valid next_page_id_ from the browser. |
684 DCHECK_GE(next_page_id_, 0); | 684 DCHECK_GE(next_page_id_, 0); |
685 | 685 |
686 RenderFrameImpl* main_render_frame = RenderFrameImpl::Create( | 686 main_render_frame_.reset(RenderFrameImpl::Create( |
687 this, params->main_frame_routing_id); | 687 this, params->main_frame_routing_id)); |
688 // The main frame WebLocalFrame object is closed by | 688 // The main frame WebLocalFrame object is closed by |
689 // RenderFrameImpl::frameDetached(). | 689 // RenderFrameImpl::frameDetached(). |
690 WebLocalFrame* web_frame = WebLocalFrame::create(main_render_frame); | 690 WebLocalFrame* web_frame = WebLocalFrame::create(main_render_frame_.get()); |
691 main_render_frame->SetWebFrame(web_frame); | 691 main_render_frame_->SetWebFrame(web_frame); |
692 | 692 |
693 if (params->proxy_routing_id != MSG_ROUTING_NONE) { | 693 if (params->proxy_routing_id != MSG_ROUTING_NONE) { |
694 CHECK(params->swapped_out); | 694 CHECK(params->swapped_out); |
695 RenderFrameProxy* proxy = | 695 RenderFrameProxy* proxy = |
696 RenderFrameProxy::CreateFrameProxy(params->proxy_routing_id, | 696 RenderFrameProxy::CreateFrameProxy(params->proxy_routing_id, |
697 params->main_frame_routing_id); | 697 params->main_frame_routing_id); |
698 main_render_frame->set_render_frame_proxy(proxy); | 698 main_render_frame_->set_render_frame_proxy(proxy); |
699 } | 699 } |
700 | 700 |
701 webwidget_ = WebView::create(this); | 701 webwidget_ = WebView::create(this); |
702 webwidget_mouse_lock_target_.reset(new WebWidgetLockTarget(webwidget_)); | 702 webwidget_mouse_lock_target_.reset(new WebWidgetLockTarget(webwidget_)); |
703 | 703 |
704 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 704 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
705 | 705 |
706 if (command_line.HasSwitch(switches::kStatsCollectionController)) | 706 if (command_line.HasSwitch(switches::kStatsCollectionController)) |
707 stats_collection_observer_.reset(new StatsCollectionObserver(this)); | 707 stats_collection_observer_.reset(new StatsCollectionObserver(this)); |
708 | 708 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
750 webview()->settings()->setAcceleratedCompositingForFixedRootBackgroundEnabled( | 750 webview()->settings()->setAcceleratedCompositingForFixedRootBackgroundEnabled( |
751 ShouldUseAcceleratedFixedRootBackground(device_scale_factor_)); | 751 ShouldUseAcceleratedFixedRootBackground(device_scale_factor_)); |
752 webview()->settings()->setCompositedScrollingForFramesEnabled( | 752 webview()->settings()->setCompositedScrollingForFramesEnabled( |
753 ShouldUseCompositedScrollingForFrames(device_scale_factor_)); | 753 ShouldUseCompositedScrollingForFrames(device_scale_factor_)); |
754 | 754 |
755 ApplyWebPreferences(webkit_preferences_, webview()); | 755 ApplyWebPreferences(webkit_preferences_, webview()); |
756 | 756 |
757 webview()->settings()->setAllowConnectingInsecureWebSocket( | 757 webview()->settings()->setAllowConnectingInsecureWebSocket( |
758 command_line.HasSwitch(switches::kAllowInsecureWebSocketFromHttpsOrigin)); | 758 command_line.HasSwitch(switches::kAllowInsecureWebSocketFromHttpsOrigin)); |
759 | 759 |
760 main_render_frame_.reset(main_render_frame); | |
761 webview()->setMainFrame(main_render_frame_->GetWebFrame()); | 760 webview()->setMainFrame(main_render_frame_->GetWebFrame()); |
762 main_render_frame_->Initialize(); | 761 main_render_frame_->Initialize(); |
763 | 762 |
764 if (switches::IsTouchDragDropEnabled()) | 763 if (switches::IsTouchDragDropEnabled()) |
765 webview()->settings()->setTouchDragDropEnabled(true); | 764 webview()->settings()->setTouchDragDropEnabled(true); |
766 | 765 |
767 if (switches::IsTouchEditingEnabled()) | 766 if (switches::IsTouchEditingEnabled()) |
768 webview()->settings()->setTouchEditingEnabled(true); | 767 webview()->settings()->setTouchEditingEnabled(true); |
769 | 768 |
770 if (!params->frame_name.empty()) | 769 if (!params->frame_name.empty()) |
(...skipping 2856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3627 file_chooser_completions_.push_back(linked_ptr<PendingFileChooser>( | 3626 file_chooser_completions_.push_back(linked_ptr<PendingFileChooser>( |
3628 new PendingFileChooser(params, completion))); | 3627 new PendingFileChooser(params, completion))); |
3629 if (file_chooser_completions_.size() == 1) { | 3628 if (file_chooser_completions_.size() == 1) { |
3630 // Actually show the browse dialog when this is the first request. | 3629 // Actually show the browse dialog when this is the first request. |
3631 Send(new ViewHostMsg_RunFileChooser(routing_id_, params)); | 3630 Send(new ViewHostMsg_RunFileChooser(routing_id_, params)); |
3632 } | 3631 } |
3633 return true; | 3632 return true; |
3634 } | 3633 } |
3635 | 3634 |
3636 blink::WebGeolocationClient* RenderViewImpl::geolocationClient() { | 3635 blink::WebGeolocationClient* RenderViewImpl::geolocationClient() { |
3637 if (!geolocation_dispatcher_) | 3636 if (!geolocation_dispatcher_) { |
3638 geolocation_dispatcher_ = new GeolocationDispatcher(this); | 3637 geolocation_dispatcher_ = new GeolocationDispatcher( |
| 3638 main_render_frame_.get()); |
| 3639 } |
3639 return geolocation_dispatcher_; | 3640 return geolocation_dispatcher_; |
3640 } | 3641 } |
3641 | 3642 |
3642 blink::WebSpeechRecognizer* RenderViewImpl::speechRecognizer() { | 3643 blink::WebSpeechRecognizer* RenderViewImpl::speechRecognizer() { |
3643 if (!speech_recognition_dispatcher_) | 3644 if (!speech_recognition_dispatcher_) |
3644 speech_recognition_dispatcher_ = new SpeechRecognitionDispatcher(this); | 3645 speech_recognition_dispatcher_ = new SpeechRecognitionDispatcher(this); |
3645 return speech_recognition_dispatcher_; | 3646 return speech_recognition_dispatcher_; |
3646 } | 3647 } |
3647 | 3648 |
3648 void RenderViewImpl::zoomLimitsChanged(double minimum_level, | 3649 void RenderViewImpl::zoomLimitsChanged(double minimum_level, |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4049 std::vector<gfx::Size> sizes; | 4050 std::vector<gfx::Size> sizes; |
4050 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 4051 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
4051 if (!url.isEmpty()) | 4052 if (!url.isEmpty()) |
4052 urls.push_back( | 4053 urls.push_back( |
4053 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 4054 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
4054 } | 4055 } |
4055 SendUpdateFaviconURL(urls); | 4056 SendUpdateFaviconURL(urls); |
4056 } | 4057 } |
4057 | 4058 |
4058 } // namespace content | 4059 } // namespace content |
OLD | NEW |