| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 #include "content/public/common/url_constants.h" | 64 #include "content/public/common/url_constants.h" |
| 65 #include "content/public/common/url_utils.h" | 65 #include "content/public/common/url_utils.h" |
| 66 #include "content/public/common/web_preferences.h" | 66 #include "content/public/common/web_preferences.h" |
| 67 #include "content/public/renderer/content_renderer_client.h" | 67 #include "content/public/renderer/content_renderer_client.h" |
| 68 #include "content/public/renderer/document_state.h" | 68 #include "content/public/renderer/document_state.h" |
| 69 #include "content/public/renderer/navigation_state.h" | 69 #include "content/public/renderer/navigation_state.h" |
| 70 #include "content/public/renderer/render_view_observer.h" | 70 #include "content/public/renderer/render_view_observer.h" |
| 71 #include "content/public/renderer/render_view_visitor.h" | 71 #include "content/public/renderer/render_view_visitor.h" |
| 72 #include "content/renderer/browser_plugin/browser_plugin.h" | 72 #include "content/renderer/browser_plugin/browser_plugin.h" |
| 73 #include "content/renderer/browser_plugin/browser_plugin_manager.h" | 73 #include "content/renderer/browser_plugin/browser_plugin_manager.h" |
| 74 #include "content/renderer/devtools/devtools_agent.h" | |
| 75 #include "content/renderer/disambiguation_popup_helper.h" | 74 #include "content/renderer/disambiguation_popup_helper.h" |
| 76 #include "content/renderer/dom_storage/webstoragenamespace_impl.h" | 75 #include "content/renderer/dom_storage/webstoragenamespace_impl.h" |
| 77 #include "content/renderer/drop_data_builder.h" | 76 #include "content/renderer/drop_data_builder.h" |
| 78 #include "content/renderer/gpu/render_widget_compositor.h" | 77 #include "content/renderer/gpu/render_widget_compositor.h" |
| 79 #include "content/renderer/history_controller.h" | 78 #include "content/renderer/history_controller.h" |
| 80 #include "content/renderer/history_serialization.h" | 79 #include "content/renderer/history_serialization.h" |
| 81 #include "content/renderer/idle_user_detector.h" | 80 #include "content/renderer/idle_user_detector.h" |
| 82 #include "content/renderer/ime_event_guard.h" | 81 #include "content/renderer/ime_event_guard.h" |
| 83 #include "content/renderer/input/input_handler_manager.h" | 82 #include "content/renderer/input/input_handler_manager.h" |
| 84 #include "content/renderer/internal_document_state_data.h" | 83 #include "content/renderer/internal_document_state_data.h" |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 | 408 |
| 410 static void ConvertToFaviconSizes( | 409 static void ConvertToFaviconSizes( |
| 411 const blink::WebVector<blink::WebSize>& web_sizes, | 410 const blink::WebVector<blink::WebSize>& web_sizes, |
| 412 std::vector<gfx::Size>* sizes) { | 411 std::vector<gfx::Size>* sizes) { |
| 413 DCHECK(sizes->empty()); | 412 DCHECK(sizes->empty()); |
| 414 sizes->reserve(web_sizes.size()); | 413 sizes->reserve(web_sizes.size()); |
| 415 for (size_t i = 0; i < web_sizes.size(); ++i) | 414 for (size_t i = 0; i < web_sizes.size(); ++i) |
| 416 sizes->push_back(gfx::Size(web_sizes[i])); | 415 sizes->push_back(gfx::Size(web_sizes[i])); |
| 417 } | 416 } |
| 418 | 417 |
| 418 static blink::WebDevToolsAgent* GetWebDevToolsAgent(WebView* webview) { |
| 419 if (!webview || !webview->mainFrame()->isWebLocalFrame()) |
| 420 return nullptr; |
| 421 return webview->mainFrame()->toWebLocalFrame()->devToolsAgent(); |
| 422 } |
| 423 |
| 419 /////////////////////////////////////////////////////////////////////////////// | 424 /////////////////////////////////////////////////////////////////////////////// |
| 420 | 425 |
| 421 struct RenderViewImpl::PendingFileChooser { | 426 struct RenderViewImpl::PendingFileChooser { |
| 422 PendingFileChooser(const FileChooserParams& p, WebFileChooserCompletion* c) | 427 PendingFileChooser(const FileChooserParams& p, WebFileChooserCompletion* c) |
| 423 : params(p), | 428 : params(p), |
| 424 completion(c) { | 429 completion(c) { |
| 425 } | 430 } |
| 426 FileChooserParams params; | 431 FileChooserParams params; |
| 427 WebFileChooserCompletion* completion; // MAY BE NULL to skip callback. | 432 WebFileChooserCompletion* completion; // MAY BE NULL to skip callback. |
| 428 }; | 433 }; |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 history_list_offset_(-1), | 635 history_list_offset_(-1), |
| 631 history_list_length_(0), | 636 history_list_length_(0), |
| 632 frames_in_progress_(0), | 637 frames_in_progress_(0), |
| 633 target_url_status_(TARGET_NONE), | 638 target_url_status_(TARGET_NONE), |
| 634 uses_temporary_zoom_level_(false), | 639 uses_temporary_zoom_level_(false), |
| 635 #if defined(OS_ANDROID) | 640 #if defined(OS_ANDROID) |
| 636 top_controls_constraints_(TOP_CONTROLS_STATE_BOTH), | 641 top_controls_constraints_(TOP_CONTROLS_STATE_BOTH), |
| 637 #endif | 642 #endif |
| 638 has_scrolled_focused_editable_node_into_rect_(false), | 643 has_scrolled_focused_editable_node_into_rect_(false), |
| 639 speech_recognition_dispatcher_(NULL), | 644 speech_recognition_dispatcher_(NULL), |
| 640 devtools_agent_(NULL), | |
| 641 mouse_lock_dispatcher_(NULL), | 645 mouse_lock_dispatcher_(NULL), |
| 642 #if defined(OS_ANDROID) | 646 #if defined(OS_ANDROID) |
| 643 expected_content_intent_id_(0), | 647 expected_content_intent_id_(0), |
| 644 #endif | 648 #endif |
| 645 #if defined(OS_WIN) | 649 #if defined(OS_WIN) |
| 646 focused_plugin_id_(-1), | 650 focused_plugin_id_(-1), |
| 647 #endif | 651 #endif |
| 648 #if defined(ENABLE_PLUGINS) | 652 #if defined(ENABLE_PLUGINS) |
| 649 plugin_find_handler_(NULL), | 653 plugin_find_handler_(NULL), |
| 650 focused_pepper_plugin_(NULL), | 654 focused_pepper_plugin_(NULL), |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 768 OnResize(params.initial_size); | 772 OnResize(params.initial_size); |
| 769 } else { | 773 } else { |
| 770 OnEnableAutoResize(params.min_size, params.max_size); | 774 OnEnableAutoResize(params.min_size, params.max_size); |
| 771 } | 775 } |
| 772 | 776 |
| 773 new MHTMLGenerator(this); | 777 new MHTMLGenerator(this); |
| 774 #if defined(OS_MACOSX) | 778 #if defined(OS_MACOSX) |
| 775 new TextInputClientObserver(this); | 779 new TextInputClientObserver(this); |
| 776 #endif // defined(OS_MACOSX) | 780 #endif // defined(OS_MACOSX) |
| 777 | 781 |
| 782 // TODO(dgozman): this should actually be in RenderFrameImpl::Initialize, |
| 783 // but we have to somehow differentiate local frame root there. |
| 784 if (!proxy) |
| 785 main_render_frame_->CreateDevToolsAgent(); |
| 786 |
| 787 // TODO(dgozman): do this not for main frame, but for local frame roots. |
| 788 if (blink::WebDevToolsAgent* devToolsAgent = GetWebDevToolsAgent(webview())) { |
| 789 if (RenderWidgetCompositor* rwc = compositor()) |
| 790 devToolsAgent->setLayerTreeId(rwc->GetLayerTreeId()); |
| 791 } |
| 792 |
| 778 // The next group of objects all implement RenderViewObserver, so are deleted | 793 // The next group of objects all implement RenderViewObserver, so are deleted |
| 779 // along with the RenderView automatically. | 794 // along with the RenderView automatically. |
| 780 if (!proxy) { | |
| 781 devtools_agent_ = new DevToolsAgent(main_render_frame_.get()); | |
| 782 if (RenderWidgetCompositor* rwc = compositor()) | |
| 783 webview()->devToolsAgent()->setLayerTreeId(rwc->GetLayerTreeId()); | |
| 784 } | |
| 785 | |
| 786 mouse_lock_dispatcher_ = new RenderViewMouseLockDispatcher(this); | 795 mouse_lock_dispatcher_ = new RenderViewMouseLockDispatcher(this); |
| 787 | 796 |
| 788 history_controller_.reset(new HistoryController(this)); | 797 history_controller_.reset(new HistoryController(this)); |
| 789 | 798 |
| 790 new IdleUserDetector(this); | 799 new IdleUserDetector(this); |
| 791 | 800 |
| 792 if (command_line.HasSwitch(switches::kDomAutomationController)) | 801 if (command_line.HasSwitch(switches::kDomAutomationController)) |
| 793 enabled_bindings_ |= BINDINGS_POLICY_DOM_AUTOMATION; | 802 enabled_bindings_ |= BINDINGS_POLICY_DOM_AUTOMATION; |
| 794 if (command_line.HasSwitch(switches::kStatsCollectionController)) | 803 if (command_line.HasSwitch(switches::kStatsCollectionController)) |
| 795 enabled_bindings_ |= BINDINGS_POLICY_STATS_COLLECTION; | 804 enabled_bindings_ |= BINDINGS_POLICY_STATS_COLLECTION; |
| (...skipping 1218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2014 Send(new ViewHostMsg_FocusedNodeTouched( | 2023 Send(new ViewHostMsg_FocusedNodeTouched( |
| 2015 routing_id(), text_input_type != blink::WebTextInputTypeNone)); | 2024 routing_id(), text_input_type != blink::WebTextInputTypeNone)); |
| 2016 #endif | 2025 #endif |
| 2017 } | 2026 } |
| 2018 | 2027 |
| 2019 void RenderViewImpl::initializeLayerTreeView() { | 2028 void RenderViewImpl::initializeLayerTreeView() { |
| 2020 RenderWidget::initializeLayerTreeView(); | 2029 RenderWidget::initializeLayerTreeView(); |
| 2021 RenderWidgetCompositor* rwc = compositor(); | 2030 RenderWidgetCompositor* rwc = compositor(); |
| 2022 if (!rwc) | 2031 if (!rwc) |
| 2023 return; | 2032 return; |
| 2024 if (webview() && webview()->devToolsAgent()) | 2033 // TODO(dgozman): do this not for main frame, but for local frame roots. |
| 2025 webview()->devToolsAgent()->setLayerTreeId(rwc->GetLayerTreeId()); | 2034 if (blink::WebDevToolsAgent* devToolsAgent = GetWebDevToolsAgent(webview())) |
| 2035 devToolsAgent->setLayerTreeId(rwc->GetLayerTreeId()); |
| 2026 | 2036 |
| 2027 bool use_threaded_event_handling = true; | 2037 bool use_threaded_event_handling = true; |
| 2028 #if defined(OS_MACOSX) && !defined(OS_IOS) | 2038 #if defined(OS_MACOSX) && !defined(OS_IOS) |
| 2029 // Disable threaded event handling if content is not handling the elastic | 2039 // Disable threaded event handling if content is not handling the elastic |
| 2030 // overscroll effect. This includes the cases where the elastic overscroll | 2040 // overscroll effect. This includes the cases where the elastic overscroll |
| 2031 // effect is being handled by Blink (because of command line flags) and older | 2041 // effect is being handled by Blink (because of command line flags) and older |
| 2032 // operating system versions which do not have an elastic overscroll effect | 2042 // operating system versions which do not have an elastic overscroll effect |
| 2033 // (SnowLeopard, which has Aqua scrollbars which need synchronous updates). | 2043 // (SnowLeopard, which has Aqua scrollbars which need synchronous updates). |
| 2034 use_threaded_event_handling = compositor_deps_->IsElasticOverscrollEnabled(); | 2044 use_threaded_event_handling = compositor_deps_->IsElasticOverscrollEnabled(); |
| 2035 #endif | 2045 #endif |
| (...skipping 1927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3963 std::vector<gfx::Size> sizes; | 3973 std::vector<gfx::Size> sizes; |
| 3964 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 3974 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
| 3965 if (!url.isEmpty()) | 3975 if (!url.isEmpty()) |
| 3966 urls.push_back( | 3976 urls.push_back( |
| 3967 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 3977 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
| 3968 } | 3978 } |
| 3969 SendUpdateFaviconURL(urls); | 3979 SendUpdateFaviconURL(urls); |
| 3970 } | 3980 } |
| 3971 | 3981 |
| 3972 } // namespace content | 3982 } // namespace content |
| OLD | NEW |