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/browser/renderer_host/render_widget_host_view_aura.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
(...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1012 // NPNVnetscapeWindow property corresponds to the bounds of the webpage. | 1012 // NPNVnetscapeWindow property corresponds to the bounds of the webpage. |
1013 // This is not true in Aura where we have only HWND which is the main Aura | 1013 // This is not true in Aura where we have only HWND which is the main Aura |
1014 // window. If we return this window to plugins like Flash then it causes the | 1014 // window. If we return this window to plugins like Flash then it causes the |
1015 // coordinate translations done by these plugins to break. | 1015 // coordinate translations done by these plugins to break. |
1016 // Additonally the legacy dummy window is needed for accessibility and for | 1016 // Additonally the legacy dummy window is needed for accessibility and for |
1017 // scrolling to work in legacy drivers for trackpoints/trackpads, etc. | 1017 // scrolling to work in legacy drivers for trackpoints/trackpads, etc. |
1018 if (GetNativeViewId()) { | 1018 if (GetNativeViewId()) { |
1019 if (!legacy_render_widget_host_HWND_) { | 1019 if (!legacy_render_widget_host_HWND_) { |
1020 legacy_render_widget_host_HWND_ = LegacyRenderWidgetHostHWND::Create( | 1020 legacy_render_widget_host_HWND_ = LegacyRenderWidgetHostHWND::Create( |
1021 reinterpret_cast<HWND>(GetNativeViewId())); | 1021 reinterpret_cast<HWND>(GetNativeViewId())); |
1022 BrowserAccessibilityManagerWin* manager = | |
1023 static_cast<BrowserAccessibilityManagerWin*>( | |
1024 GetBrowserAccessibilityManager()); | |
1025 if (manager) | |
1026 manager->SetAccessibleHWND(legacy_render_widget_host_HWND_.get()); | |
1022 } | 1027 } |
1023 if (legacy_render_widget_host_HWND_) { | 1028 if (legacy_render_widget_host_HWND_) { |
1024 legacy_render_widget_host_HWND_->SetBounds( | 1029 legacy_render_widget_host_HWND_->SetBounds( |
1025 window_->GetBoundsInRootWindow()); | 1030 window_->GetBoundsInRootWindow()); |
1026 } | 1031 } |
1027 } | 1032 } |
1028 | 1033 |
1029 if (mouse_locked_) | 1034 if (mouse_locked_) |
1030 UpdateMouseLockRegion(); | 1035 UpdateMouseLockRegion(); |
1031 #endif | 1036 #endif |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1244 | 1249 |
1245 if (overscroll_controller_) | 1250 if (overscroll_controller_) |
1246 consumed |= overscroll_controller_->WillHandleEvent(input_event); | 1251 consumed |= overscroll_controller_->WillHandleEvent(input_event); |
1247 | 1252 |
1248 return consumed && !WebTouchEvent::isTouchEventType(input_event.type) | 1253 return consumed && !WebTouchEvent::isTouchEventType(input_event.type) |
1249 ? INPUT_EVENT_ACK_STATE_CONSUMED | 1254 ? INPUT_EVENT_ACK_STATE_CONSUMED |
1250 : INPUT_EVENT_ACK_STATE_NOT_CONSUMED; | 1255 : INPUT_EVENT_ACK_STATE_NOT_CONSUMED; |
1251 } | 1256 } |
1252 | 1257 |
1253 void RenderWidgetHostViewAura::CreateBrowserAccessibilityManagerIfNeeded() { | 1258 void RenderWidgetHostViewAura::CreateBrowserAccessibilityManagerIfNeeded() { |
1254 if (GetBrowserAccessibilityManager()) | |
1255 return; | |
1256 | |
1257 BrowserAccessibilityManager* manager = NULL; | |
1258 #if defined(OS_WIN) | 1259 #if defined(OS_WIN) |
1259 aura::WindowTreeHost* host = window_->GetHost(); | 1260 if (!GetBrowserAccessibilityManager()) { |
1260 if (!host) | 1261 gfx::NativeViewAccessible accessible_parent = |
1261 return; | 1262 host_->GetParentNativeViewAccessible(); |
1262 HWND hwnd = host->GetAcceleratedWidget(); | 1263 LegacyRenderWidgetHostHWND* parent_hwnd = |
ananta
2014/06/12 22:17:45
We should be allocating the BrowserAccessibilityMa
dmazzoni
2014/06/12 23:23:27
No, this is intentional. We want to create the BAM
| |
1263 | 1264 legacy_render_widget_host_HWND_.get(); |
1264 // The accessible_parent may be NULL at this point. The WebContents will pass | 1265 SetBrowserAccessibilityManager(new BrowserAccessibilityManagerWin( |
1265 // it down to this instance (by way of the RenderViewHost and | |
1266 // RenderWidgetHost) when it is known. This instance will then set it on its | |
1267 // BrowserAccessibilityManager. | |
1268 gfx::NativeViewAccessible accessible_parent = | |
1269 host_->GetParentNativeViewAccessible(); | |
1270 | |
1271 if (legacy_render_widget_host_HWND_) { | |
1272 manager = new BrowserAccessibilityManagerWin( | |
1273 legacy_render_widget_host_HWND_.get(), accessible_parent, | 1266 legacy_render_widget_host_HWND_.get(), accessible_parent, |
1274 BrowserAccessibilityManagerWin::GetEmptyDocument(), host_); | 1267 BrowserAccessibilityManagerWin::GetEmptyDocument(), host_)); |
1275 } | 1268 } |
1276 #else | 1269 #else |
1277 manager = BrowserAccessibilityManager::Create( | 1270 if (!GetBrowserAccessibilityManager()) { |
1278 BrowserAccessibilityManager::GetEmptyDocument(), host_); | 1271 SetBrowserAccessibilityManager( |
1272 BrowserAccessibilityManager::Create( | |
1273 BrowserAccessibilityManager::GetEmptyDocument(), host_)); | |
1274 } | |
1279 #endif | 1275 #endif |
1280 SetBrowserAccessibilityManager(manager); | |
1281 } | 1276 } |
1282 | 1277 |
1283 gfx::GLSurfaceHandle RenderWidgetHostViewAura::GetCompositingSurface() { | 1278 gfx::GLSurfaceHandle RenderWidgetHostViewAura::GetCompositingSurface() { |
1284 return ImageTransportFactory::GetInstance()->GetSharedSurfaceHandle(); | 1279 return ImageTransportFactory::GetInstance()->GetSharedSurfaceHandle(); |
1285 } | 1280 } |
1286 | 1281 |
1287 bool RenderWidgetHostViewAura::LockMouse() { | 1282 bool RenderWidgetHostViewAura::LockMouse() { |
1288 aura::Window* root_window = window_->GetRootWindow(); | 1283 aura::Window* root_window = window_->GetRootWindow(); |
1289 if (!root_window) | 1284 if (!root_window) |
1290 return false; | 1285 return false; |
(...skipping 1170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2461 | 2456 |
2462 //////////////////////////////////////////////////////////////////////////////// | 2457 //////////////////////////////////////////////////////////////////////////////// |
2463 // RenderWidgetHostViewBase, public: | 2458 // RenderWidgetHostViewBase, public: |
2464 | 2459 |
2465 // static | 2460 // static |
2466 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { | 2461 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { |
2467 GetScreenInfoForWindow(results, NULL); | 2462 GetScreenInfoForWindow(results, NULL); |
2468 } | 2463 } |
2469 | 2464 |
2470 } // namespace content | 2465 } // namespace content |
OLD | NEW |