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 1258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1269 const blink::WebActiveWheelFlingParameters& params) { | 1269 const blink::WebActiveWheelFlingParameters& params) { |
1270 if (webview()) | 1270 if (webview()) |
1271 webview()->transferActiveWheelFlingAnimation(params); | 1271 webview()->transferActiveWheelFlingAnimation(params); |
1272 } | 1272 } |
1273 | 1273 |
1274 bool RenderViewImpl::OnMessageReceived(const IPC::Message& message) { | 1274 bool RenderViewImpl::OnMessageReceived(const IPC::Message& message) { |
1275 WebFrame* main_frame = webview() ? webview()->mainFrame() : NULL; | 1275 WebFrame* main_frame = webview() ? webview()->mainFrame() : NULL; |
1276 if (main_frame && main_frame->isWebLocalFrame()) | 1276 if (main_frame && main_frame->isWebLocalFrame()) |
1277 GetContentClient()->SetActiveURL(main_frame->document().url()); | 1277 GetContentClient()->SetActiveURL(main_frame->document().url()); |
1278 | 1278 |
1279 // Input IPC messages must not be processed if the RenderView is in | |
1280 // swapped out state. | |
1281 if (IPC_MESSAGE_ID_CLASS(message.type()) == InputMsgStart) | |
alexmos
2015/10/15 22:52:38
Shouldn't there be an actual check here that the v
nasko
2015/10/15 23:18:26
d'oh!
| |
1282 return false; | |
1283 | |
1279 base::ObserverListBase<RenderViewObserver>::Iterator it(&observers_); | 1284 base::ObserverListBase<RenderViewObserver>::Iterator it(&observers_); |
1280 RenderViewObserver* observer; | 1285 RenderViewObserver* observer; |
1281 while ((observer = it.GetNext()) != NULL) | 1286 while ((observer = it.GetNext()) != NULL) |
1282 if (observer->OnMessageReceived(message)) | 1287 if (observer->OnMessageReceived(message)) |
1283 return true; | 1288 return true; |
1284 | 1289 |
1285 bool handled = true; | 1290 bool handled = true; |
1286 IPC_BEGIN_MESSAGE_MAP(RenderViewImpl, message) | 1291 IPC_BEGIN_MESSAGE_MAP(RenderViewImpl, message) |
1287 IPC_MESSAGE_HANDLER(InputMsg_ExecuteEditCommand, OnExecuteEditCommand) | 1292 IPC_MESSAGE_HANDLER(InputMsg_ExecuteEditCommand, OnExecuteEditCommand) |
1288 IPC_MESSAGE_HANDLER(InputMsg_MoveCaret, OnMoveCaret) | 1293 IPC_MESSAGE_HANDLER(InputMsg_MoveCaret, OnMoveCaret) |
(...skipping 1770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3059 | 3064 |
3060 GURL RenderViewImpl::GetURLForGraphicsContext3D() { | 3065 GURL RenderViewImpl::GetURLForGraphicsContext3D() { |
3061 DCHECK(webview()); | 3066 DCHECK(webview()); |
3062 if (webview()->mainFrame()->isWebLocalFrame()) | 3067 if (webview()->mainFrame()->isWebLocalFrame()) |
3063 return GURL(webview()->mainFrame()->document().url()); | 3068 return GURL(webview()->mainFrame()->document().url()); |
3064 else | 3069 else |
3065 return GURL("chrome://gpu/RenderViewImpl::CreateGraphicsContext3D"); | 3070 return GURL("chrome://gpu/RenderViewImpl::CreateGraphicsContext3D"); |
3066 } | 3071 } |
3067 | 3072 |
3068 void RenderViewImpl::OnSetFocus(bool enable) { | 3073 void RenderViewImpl::OnSetFocus(bool enable) { |
3074 // RenderView getting focus must always have a WebLocalFrame as the main | |
3075 // frame. | |
3076 CHECK(!enable || webview()->mainFrame()->isWebLocalFrame()); | |
alexmos
2015/10/15 22:52:38
I wonder if "!enable" is needed. If there's no cu
nasko
2015/10/15 23:18:26
Done.
| |
3069 RenderWidget::OnSetFocus(enable); | 3077 RenderWidget::OnSetFocus(enable); |
3070 | 3078 |
3071 #if defined(ENABLE_PLUGINS) | 3079 #if defined(ENABLE_PLUGINS) |
3072 if (webview() && webview()->isActive()) { | 3080 if (webview() && webview()->isActive()) { |
3073 // Notify all NPAPI plugins. | 3081 // Notify all NPAPI plugins. |
3074 std::set<WebPluginDelegateProxy*>::iterator plugin_it; | 3082 std::set<WebPluginDelegateProxy*>::iterator plugin_it; |
3075 for (plugin_it = plugin_delegates_.begin(); | 3083 for (plugin_it = plugin_delegates_.begin(); |
3076 plugin_it != plugin_delegates_.end(); ++plugin_it) { | 3084 plugin_it != plugin_delegates_.end(); ++plugin_it) { |
3077 #if defined(OS_MACOSX) | 3085 #if defined(OS_MACOSX) |
3078 // RenderWidget's call to setFocus can cause the underlying webview's | 3086 // RenderWidget's call to setFocus can cause the underlying webview's |
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3682 std::vector<gfx::Size> sizes; | 3690 std::vector<gfx::Size> sizes; |
3683 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 3691 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
3684 if (!url.isEmpty()) | 3692 if (!url.isEmpty()) |
3685 urls.push_back( | 3693 urls.push_back( |
3686 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 3694 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
3687 } | 3695 } |
3688 SendUpdateFaviconURL(urls); | 3696 SendUpdateFaviconURL(urls); |
3689 } | 3697 } |
3690 | 3698 |
3691 } // namespace content | 3699 } // namespace content |
OLD | NEW |