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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 #include "third_party/WebKit/public/platform/WebURLResponse.h" | 127 #include "third_party/WebKit/public/platform/WebURLResponse.h" |
128 #include "third_party/WebKit/public/platform/WebVector.h" | 128 #include "third_party/WebKit/public/platform/WebVector.h" |
129 #include "third_party/WebKit/public/web/WebAXObject.h" | 129 #include "third_party/WebKit/public/web/WebAXObject.h" |
130 #include "third_party/WebKit/public/web/WebColorName.h" | 130 #include "third_party/WebKit/public/web/WebColorName.h" |
131 #include "third_party/WebKit/public/web/WebColorSuggestion.h" | 131 #include "third_party/WebKit/public/web/WebColorSuggestion.h" |
132 #include "third_party/WebKit/public/web/WebDOMEvent.h" | 132 #include "third_party/WebKit/public/web/WebDOMEvent.h" |
133 #include "third_party/WebKit/public/web/WebDOMMessageEvent.h" | 133 #include "third_party/WebKit/public/web/WebDOMMessageEvent.h" |
134 #include "third_party/WebKit/public/web/WebDataSource.h" | 134 #include "third_party/WebKit/public/web/WebDataSource.h" |
135 #include "third_party/WebKit/public/web/WebDateTimeChooserCompletion.h" | 135 #include "third_party/WebKit/public/web/WebDateTimeChooserCompletion.h" |
136 #include "third_party/WebKit/public/web/WebDateTimeChooserParams.h" | 136 #include "third_party/WebKit/public/web/WebDateTimeChooserParams.h" |
137 #include "third_party/WebKit/public/web/WebDevToolsAgent.h" | |
138 #include "third_party/WebKit/public/web/WebDocument.h" | 137 #include "third_party/WebKit/public/web/WebDocument.h" |
139 #include "third_party/WebKit/public/web/WebElement.h" | 138 #include "third_party/WebKit/public/web/WebElement.h" |
140 #include "third_party/WebKit/public/web/WebFileChooserParams.h" | 139 #include "third_party/WebKit/public/web/WebFileChooserParams.h" |
141 #include "third_party/WebKit/public/web/WebFindOptions.h" | 140 #include "third_party/WebKit/public/web/WebFindOptions.h" |
142 #include "third_party/WebKit/public/web/WebFormControlElement.h" | 141 #include "third_party/WebKit/public/web/WebFormControlElement.h" |
143 #include "third_party/WebKit/public/web/WebFormElement.h" | 142 #include "third_party/WebKit/public/web/WebFormElement.h" |
144 #include "third_party/WebKit/public/web/WebFrame.h" | 143 #include "third_party/WebKit/public/web/WebFrame.h" |
145 #include "third_party/WebKit/public/web/WebGlyphCache.h" | 144 #include "third_party/WebKit/public/web/WebGlyphCache.h" |
146 #include "third_party/WebKit/public/web/WebHistoryItem.h" | 145 #include "third_party/WebKit/public/web/WebHistoryItem.h" |
147 #include "third_party/WebKit/public/web/WebHitTestResult.h" | 146 #include "third_party/WebKit/public/web/WebHitTestResult.h" |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 | 394 |
396 static void ConvertToFaviconSizes( | 395 static void ConvertToFaviconSizes( |
397 const blink::WebVector<blink::WebSize>& web_sizes, | 396 const blink::WebVector<blink::WebSize>& web_sizes, |
398 std::vector<gfx::Size>* sizes) { | 397 std::vector<gfx::Size>* sizes) { |
399 DCHECK(sizes->empty()); | 398 DCHECK(sizes->empty()); |
400 sizes->reserve(web_sizes.size()); | 399 sizes->reserve(web_sizes.size()); |
401 for (size_t i = 0; i < web_sizes.size(); ++i) | 400 for (size_t i = 0; i < web_sizes.size(); ++i) |
402 sizes->push_back(gfx::Size(web_sizes[i])); | 401 sizes->push_back(gfx::Size(web_sizes[i])); |
403 } | 402 } |
404 | 403 |
405 static blink::WebDevToolsAgent* GetWebDevToolsAgent(WebView* webview) { | |
406 if (!webview || !webview->mainFrame()->isWebLocalFrame()) | |
407 return nullptr; | |
408 return webview->mainFrame()->toWebLocalFrame()->devToolsAgent(); | |
409 } | |
410 | |
411 /////////////////////////////////////////////////////////////////////////////// | 404 /////////////////////////////////////////////////////////////////////////////// |
412 | 405 |
413 struct RenderViewImpl::PendingFileChooser { | 406 struct RenderViewImpl::PendingFileChooser { |
414 PendingFileChooser(const FileChooserParams& p, WebFileChooserCompletion* c) | 407 PendingFileChooser(const FileChooserParams& p, WebFileChooserCompletion* c) |
415 : params(p), | 408 : params(p), |
416 completion(c) { | 409 completion(c) { |
417 } | 410 } |
418 FileChooserParams params; | 411 FileChooserParams params; |
419 WebFileChooserCompletion* completion; // MAY BE NULL to skip callback. | 412 WebFileChooserCompletion* completion; // MAY BE NULL to skip callback. |
420 }; | 413 }; |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
796 OnResize(params.initial_size); | 789 OnResize(params.initial_size); |
797 } else { | 790 } else { |
798 OnEnableAutoResize(params.min_size, params.max_size); | 791 OnEnableAutoResize(params.min_size, params.max_size); |
799 } | 792 } |
800 | 793 |
801 new MHTMLGenerator(this); | 794 new MHTMLGenerator(this); |
802 #if defined(OS_MACOSX) | 795 #if defined(OS_MACOSX) |
803 new TextInputClientObserver(this); | 796 new TextInputClientObserver(this); |
804 #endif // defined(OS_MACOSX) | 797 #endif // defined(OS_MACOSX) |
805 | 798 |
806 // TODO(dgozman): do this not for main frame, but for local frame roots. | |
807 if (blink::WebDevToolsAgent* devToolsAgent = GetWebDevToolsAgent(webview())) { | |
808 if (RenderWidgetCompositor* rwc = compositor()) | |
809 devToolsAgent->setLayerTreeId(rwc->GetLayerTreeId()); | |
810 } | |
811 | |
812 // The next group of objects all implement RenderViewObserver, so are deleted | 799 // The next group of objects all implement RenderViewObserver, so are deleted |
813 // along with the RenderView automatically. | 800 // along with the RenderView automatically. |
814 mouse_lock_dispatcher_ = new RenderViewMouseLockDispatcher(this); | 801 mouse_lock_dispatcher_ = new RenderViewMouseLockDispatcher(this); |
815 | 802 |
816 history_controller_.reset(new HistoryController(this)); | 803 history_controller_.reset(new HistoryController(this)); |
817 | 804 |
818 new IdleUserDetector(this); | 805 new IdleUserDetector(this); |
819 | 806 |
820 if (command_line.HasSwitch(switches::kDomAutomationController)) | 807 if (command_line.HasSwitch(switches::kDomAutomationController)) |
821 enabled_bindings_ |= BINDINGS_POLICY_DOM_AUTOMATION; | 808 enabled_bindings_ |= BINDINGS_POLICY_DOM_AUTOMATION; |
(...skipping 1219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2041 Send(new ViewHostMsg_FocusedNodeTouched( | 2028 Send(new ViewHostMsg_FocusedNodeTouched( |
2042 routing_id(), text_input_type != blink::WebTextInputTypeNone)); | 2029 routing_id(), text_input_type != blink::WebTextInputTypeNone)); |
2043 #endif | 2030 #endif |
2044 } | 2031 } |
2045 | 2032 |
2046 void RenderViewImpl::initializeLayerTreeView() { | 2033 void RenderViewImpl::initializeLayerTreeView() { |
2047 RenderWidget::initializeLayerTreeView(); | 2034 RenderWidget::initializeLayerTreeView(); |
2048 RenderWidgetCompositor* rwc = compositor(); | 2035 RenderWidgetCompositor* rwc = compositor(); |
2049 if (!rwc) | 2036 if (!rwc) |
2050 return; | 2037 return; |
2051 // TODO(dgozman): do this not for main frame, but for local frame roots. | |
2052 if (blink::WebDevToolsAgent* devToolsAgent = GetWebDevToolsAgent(webview())) | |
2053 devToolsAgent->setLayerTreeId(rwc->GetLayerTreeId()); | |
2054 | 2038 |
2055 bool use_threaded_event_handling = true; | 2039 bool use_threaded_event_handling = true; |
2056 #if defined(OS_MACOSX) && !defined(OS_IOS) | 2040 #if defined(OS_MACOSX) && !defined(OS_IOS) |
2057 // Disable threaded event handling if content is not handling the elastic | 2041 // Disable threaded event handling if content is not handling the elastic |
2058 // overscroll effect. This includes the cases where the elastic overscroll | 2042 // overscroll effect. This includes the cases where the elastic overscroll |
2059 // effect is being handled by Blink (because of command line flags) and older | 2043 // effect is being handled by Blink (because of command line flags) and older |
2060 // operating system versions which do not have an elastic overscroll effect | 2044 // operating system versions which do not have an elastic overscroll effect |
2061 // (SnowLeopard, which has Aqua scrollbars which need synchronous updates). | 2045 // (SnowLeopard, which has Aqua scrollbars which need synchronous updates). |
2062 use_threaded_event_handling = compositor_deps_->IsElasticOverscrollEnabled(); | 2046 use_threaded_event_handling = compositor_deps_->IsElasticOverscrollEnabled(); |
2063 #endif | 2047 #endif |
(...skipping 1721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3785 std::vector<gfx::Size> sizes; | 3769 std::vector<gfx::Size> sizes; |
3786 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 3770 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
3787 if (!url.isEmpty()) | 3771 if (!url.isEmpty()) |
3788 urls.push_back( | 3772 urls.push_back( |
3789 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 3773 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
3790 } | 3774 } |
3791 SendUpdateFaviconURL(urls); | 3775 SendUpdateFaviconURL(urls); |
3792 } | 3776 } |
3793 | 3777 |
3794 } // namespace content | 3778 } // namespace content |
OLD | NEW |