Chromium Code Reviews| 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 937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 948 ShouldUseTransitionCompositing(device_scale_factor_)); | 948 ShouldUseTransitionCompositing(device_scale_factor_)); |
| 949 webview()->settings()->setAcceleratedCompositingForFixedRootBackgroundEnabled( | 949 webview()->settings()->setAcceleratedCompositingForFixedRootBackgroundEnabled( |
| 950 ShouldUseAcceleratedFixedRootBackground(device_scale_factor_)); | 950 ShouldUseAcceleratedFixedRootBackground(device_scale_factor_)); |
| 951 webview()->settings()->setAcceleratedCompositingForScrollableFramesEnabled( | 951 webview()->settings()->setAcceleratedCompositingForScrollableFramesEnabled( |
| 952 ShouldUseAcceleratedCompositingForScrollableFrames(device_scale_factor_)); | 952 ShouldUseAcceleratedCompositingForScrollableFrames(device_scale_factor_)); |
| 953 webview()->settings()->setCompositedScrollingForFramesEnabled( | 953 webview()->settings()->setCompositedScrollingForFramesEnabled( |
| 954 ShouldUseCompositedScrollingForFrames(device_scale_factor_)); | 954 ShouldUseCompositedScrollingForFrames(device_scale_factor_)); |
| 955 | 955 |
| 956 ApplyWebPreferences(webkit_preferences_, webview()); | 956 ApplyWebPreferences(webkit_preferences_, webview()); |
| 957 | 957 |
| 958 main_render_frame_.reset( | 958 main_render_frame_ = |
| 959 RenderFrameImpl::Create(this, params->main_frame_routing_id)); | 959 RenderFrameImpl::Create(this, params->main_frame_routing_id); |
| 960 // The main frame WebFrame object is closed by | 960 // The main frame WebFrame object is closed by |
| 961 // RenderViewImpl::frameDetached(). | 961 // RenderViewImpl::frameDetached(). |
| 962 webview()->setMainFrame(WebFrame::create(main_render_frame_.get())); | 962 webview()->setMainFrame(WebFrame::create(main_render_frame_)); |
| 963 | 963 |
| 964 if (switches::IsTouchDragDropEnabled()) | 964 if (switches::IsTouchDragDropEnabled()) |
| 965 webview()->settings()->setTouchDragDropEnabled(true); | 965 webview()->settings()->setTouchDragDropEnabled(true); |
| 966 | 966 |
| 967 if (switches::IsTouchEditingEnabled()) | 967 if (switches::IsTouchEditingEnabled()) |
| 968 webview()->settings()->setTouchEditingEnabled(true); | 968 webview()->settings()->setTouchEditingEnabled(true); |
| 969 | 969 |
| 970 if (!params->frame_name.empty()) | 970 if (!params->frame_name.empty()) |
| 971 webview()->mainFrame()->setName(params->frame_name); | 971 webview()->mainFrame()->setName(params->frame_name); |
| 972 | 972 |
| (...skipping 1575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2548 int id = enumeration_completion_id_++; | 2548 int id = enumeration_completion_id_++; |
| 2549 enumeration_completions_[id] = chooser_completion; | 2549 enumeration_completions_[id] = chooser_completion; |
| 2550 return Send(new ViewHostMsg_EnumerateDirectory( | 2550 return Send(new ViewHostMsg_EnumerateDirectory( |
| 2551 routing_id_, | 2551 routing_id_, |
| 2552 id, | 2552 id, |
| 2553 base::FilePath::FromUTF16Unsafe(path))); | 2553 base::FilePath::FromUTF16Unsafe(path))); |
| 2554 } | 2554 } |
| 2555 | 2555 |
| 2556 void RenderViewImpl::initializeHelperPluginWebFrame( | 2556 void RenderViewImpl::initializeHelperPluginWebFrame( |
| 2557 blink::WebHelperPlugin* plugin) { | 2557 blink::WebHelperPlugin* plugin) { |
| 2558 plugin->initializeFrame(main_render_frame_.get()); | 2558 plugin->initializeFrame(main_render_frame_); |
| 2559 } | 2559 } |
| 2560 | 2560 |
| 2561 void RenderViewImpl::didStartLoading() { | 2561 void RenderViewImpl::didStartLoading() { |
| 2562 if (is_loading_) { | 2562 if (is_loading_) { |
| 2563 DVLOG(1) << "didStartLoading called while loading"; | 2563 DVLOG(1) << "didStartLoading called while loading"; |
| 2564 return; | 2564 return; |
| 2565 } | 2565 } |
| 2566 | 2566 |
| 2567 is_loading_ = true; | 2567 is_loading_ = true; |
| 2568 | 2568 |
| (...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3160 // opener after hearing about it from the browser, and the browser does not | 3160 // opener after hearing about it from the browser, and the browser does not |
| 3161 // (yet) care about subframe openers. | 3161 // (yet) care about subframe openers. |
| 3162 if (is_swapped_out_ || frame->parent()) | 3162 if (is_swapped_out_ || frame->parent()) |
| 3163 return; | 3163 return; |
| 3164 | 3164 |
| 3165 // Notify WebContents and all its swapped out RenderViews. | 3165 // Notify WebContents and all its swapped out RenderViews. |
| 3166 Send(new ViewHostMsg_DidDisownOpener(routing_id_)); | 3166 Send(new ViewHostMsg_DidDisownOpener(routing_id_)); |
| 3167 } | 3167 } |
| 3168 | 3168 |
| 3169 void RenderViewImpl::frameDetached(WebFrame* frame) { | 3169 void RenderViewImpl::frameDetached(WebFrame* frame) { |
| 3170 if (!frame->parent()) { | |
| 3171 // We cannot rely on our main_render_frame_ anymore. It will be deleted as | |
| 3172 // part of RenderFrameImpl::frameDetached. We expect to be deleted | |
| 3173 // right away, but we clear this out to be safe. | |
| 3174 main_render_frame_ = NULL; | |
|
Charlie Reis
2013/11/21 23:59:15
I added this as well, since I didn't like the idea
| |
| 3175 } | |
| 3170 FOR_EACH_OBSERVER(RenderViewObserver, observers_, FrameDetached(frame)); | 3176 FOR_EACH_OBSERVER(RenderViewObserver, observers_, FrameDetached(frame)); |
| 3171 } | 3177 } |
| 3172 | 3178 |
| 3173 void RenderViewImpl::willClose(WebFrame* frame) { | 3179 void RenderViewImpl::willClose(WebFrame* frame) { |
| 3174 FOR_EACH_OBSERVER(RenderViewObserver, observers_, FrameWillClose(frame)); | 3180 FOR_EACH_OBSERVER(RenderViewObserver, observers_, FrameWillClose(frame)); |
| 3175 } | 3181 } |
| 3176 | 3182 |
| 3177 void RenderViewImpl::didMatchCSS( | 3183 void RenderViewImpl::didMatchCSS( |
| 3178 WebFrame* frame, | 3184 WebFrame* frame, |
| 3179 const WebVector<WebString>& newly_matching_selectors, | 3185 const WebVector<WebString>& newly_matching_selectors, |
| (...skipping 3499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6679 for (size_t i = 0; i < icon_urls.size(); i++) { | 6685 for (size_t i = 0; i < icon_urls.size(); i++) { |
| 6680 WebURL url = icon_urls[i].iconURL(); | 6686 WebURL url = icon_urls[i].iconURL(); |
| 6681 if (!url.isEmpty()) | 6687 if (!url.isEmpty()) |
| 6682 urls.push_back(FaviconURL(url, | 6688 urls.push_back(FaviconURL(url, |
| 6683 ToFaviconType(icon_urls[i].iconType()))); | 6689 ToFaviconType(icon_urls[i].iconType()))); |
| 6684 } | 6690 } |
| 6685 SendUpdateFaviconURL(urls); | 6691 SendUpdateFaviconURL(urls); |
| 6686 } | 6692 } |
| 6687 | 6693 |
| 6688 } // namespace content | 6694 } // namespace content |
| OLD | NEW |