Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(305)

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 415633002: Simplify access to LegacyRenderWidgetHostHWND. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@render_frame_ax_4
Patch Set: Rebase and fix style issue Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1024 matching lines...) Expand 10 before | Expand all | Expand 10 after
1035 RecordAction( 1035 RecordAction(
1036 base::UserMetricsAction("BadMessageTerminate_SharedMemoryAura")); 1036 base::UserMetricsAction("BadMessageTerminate_SharedMemoryAura"));
1037 host_->GetProcess()->ReceivedBadMessage(); 1037 host_->GetProcess()->ReceivedBadMessage();
1038 return; 1038 return;
1039 } 1039 }
1040 } 1040 }
1041 1041
1042 #if defined(OS_WIN) 1042 #if defined(OS_WIN)
1043 void RenderWidgetHostViewAura::SetParentNativeViewAccessible( 1043 void RenderWidgetHostViewAura::SetParentNativeViewAccessible(
1044 gfx::NativeViewAccessible accessible_parent) { 1044 gfx::NativeViewAccessible accessible_parent) {
1045 BrowserAccessibilityManager* manager =
1046 host_->GetRootBrowserAccessibilityManager();
1047 if (manager) {
1048 manager->ToBrowserAccessibilityManagerWin()
1049 ->set_parent_iaccessible(accessible_parent);
1050 }
1051 } 1045 }
1052 1046
1053 gfx::NativeViewId RenderWidgetHostViewAura::GetParentForWindowlessPlugin() 1047 gfx::NativeViewId RenderWidgetHostViewAura::GetParentForWindowlessPlugin()
1054 const { 1048 const {
1055 if (legacy_render_widget_host_HWND_) { 1049 if (legacy_render_widget_host_HWND_) {
1056 return reinterpret_cast<gfx::NativeViewId>( 1050 return reinterpret_cast<gfx::NativeViewId>(
1057 legacy_render_widget_host_HWND_->hwnd()); 1051 legacy_render_widget_host_HWND_->hwnd());
1058 } 1052 }
1059 return NULL; 1053 return NULL;
1060 } 1054 }
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
1190 return consumed && !WebTouchEvent::isTouchEventType(input_event.type) 1184 return consumed && !WebTouchEvent::isTouchEventType(input_event.type)
1191 ? INPUT_EVENT_ACK_STATE_CONSUMED 1185 ? INPUT_EVENT_ACK_STATE_CONSUMED
1192 : INPUT_EVENT_ACK_STATE_NOT_CONSUMED; 1186 : INPUT_EVENT_ACK_STATE_NOT_CONSUMED;
1193 } 1187 }
1194 1188
1195 BrowserAccessibilityManager* 1189 BrowserAccessibilityManager*
1196 RenderWidgetHostViewAura::CreateBrowserAccessibilityManager( 1190 RenderWidgetHostViewAura::CreateBrowserAccessibilityManager(
1197 BrowserAccessibilityDelegate* delegate) { 1191 BrowserAccessibilityDelegate* delegate) {
1198 BrowserAccessibilityManager* manager = NULL; 1192 BrowserAccessibilityManager* manager = NULL;
1199 #if defined(OS_WIN) 1193 #if defined(OS_WIN)
1200 gfx::NativeViewAccessible accessible_parent =
1201 host_->GetParentNativeViewAccessible();
1202 manager = new BrowserAccessibilityManagerWin( 1194 manager = new BrowserAccessibilityManagerWin(
1203 legacy_render_widget_host_HWND_, accessible_parent,
1204 BrowserAccessibilityManagerWin::GetEmptyDocument(), delegate); 1195 BrowserAccessibilityManagerWin::GetEmptyDocument(), delegate);
1205 #else 1196 #else
1206 manager = BrowserAccessibilityManager::Create( 1197 manager = BrowserAccessibilityManager::Create(
1207 BrowserAccessibilityManager::GetEmptyDocument(), delegate); 1198 BrowserAccessibilityManager::GetEmptyDocument(), delegate);
1208 #endif 1199 #endif
1209 return manager; 1200 return manager;
1210 } 1201 }
1211 1202
1203 gfx::AcceleratedWidget
1204 RenderWidgetHostViewAura::AccessibilityGetAcceleratedWidget() {
1205 #if defined(OS_WIN)
1206 if (legacy_render_widget_host_HWND_)
1207 return legacy_render_widget_host_HWND_->hwnd();
1208 #endif
1209 return gfx::kNullAcceleratedWidget;
1210 }
1211
1212 gfx::NativeViewAccessible
1213 RenderWidgetHostViewAura::AccessibilityGetNativeViewAccessible() {
1214 #if defined(OS_WIN)
1215 if (legacy_render_widget_host_HWND_)
1216 return legacy_render_widget_host_HWND_->window_accessible();
1217 #endif
1218 return NULL;
1219
1220 }
1221
1212 gfx::GLSurfaceHandle RenderWidgetHostViewAura::GetCompositingSurface() { 1222 gfx::GLSurfaceHandle RenderWidgetHostViewAura::GetCompositingSurface() {
1213 return ImageTransportFactory::GetInstance()->GetSharedSurfaceHandle(); 1223 return ImageTransportFactory::GetInstance()->GetSharedSurfaceHandle();
1214 } 1224 }
1215 1225
1216 bool RenderWidgetHostViewAura::LockMouse() { 1226 bool RenderWidgetHostViewAura::LockMouse() {
1217 aura::Window* root_window = window_->GetRootWindow(); 1227 aura::Window* root_window = window_->GetRootWindow();
1218 if (!root_window) 1228 if (!root_window)
1219 return false; 1229 return false;
1220 1230
1221 if (mouse_locked_) 1231 if (mouse_locked_)
(...skipping 1080 matching lines...) Expand 10 before | Expand all | Expand 10 after
2302 if (legacy_render_widget_host_HWND_) { 2312 if (legacy_render_widget_host_HWND_) {
2303 legacy_render_widget_host_HWND_->set_host(this); 2313 legacy_render_widget_host_HWND_->set_host(this);
2304 legacy_render_widget_host_HWND_->SetBounds( 2314 legacy_render_widget_host_HWND_->SetBounds(
2305 window_->GetBoundsInRootWindow()); 2315 window_->GetBoundsInRootWindow());
2306 // There are cases where the parent window is created, made visible and 2316 // There are cases where the parent window is created, made visible and
2307 // the associated RenderWidget is also visible before the 2317 // the associated RenderWidget is also visible before the
2308 // LegacyRenderWidgetHostHWND instace is created. Ensure that it is shown 2318 // LegacyRenderWidgetHostHWND instace is created. Ensure that it is shown
2309 // here. 2319 // here.
2310 if (!host_->is_hidden()) 2320 if (!host_->is_hidden())
2311 legacy_render_widget_host_HWND_->Show(); 2321 legacy_render_widget_host_HWND_->Show();
2312
2313 BrowserAccessibilityManagerWin* manager =
2314 static_cast<BrowserAccessibilityManagerWin*>(
2315 host_->GetRootBrowserAccessibilityManager());
2316 if (manager)
2317 manager->SetAccessibleHWND(legacy_render_widget_host_HWND_);
2318 } 2322 }
2319 } 2323 }
2320 2324
2321 if (mouse_locked_) 2325 if (mouse_locked_)
2322 UpdateMouseLockRegion(); 2326 UpdateMouseLockRegion();
2323 #endif 2327 #endif
2324 } 2328 }
2325 2329
2326 void RenderWidgetHostViewAura::SchedulePaintIfNotInClip( 2330 void RenderWidgetHostViewAura::SchedulePaintIfNotInClip(
2327 const gfx::Rect& rect, 2331 const gfx::Rect& rect,
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
2486 2490
2487 //////////////////////////////////////////////////////////////////////////////// 2491 ////////////////////////////////////////////////////////////////////////////////
2488 // RenderWidgetHostViewBase, public: 2492 // RenderWidgetHostViewBase, public:
2489 2493
2490 // static 2494 // static
2491 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { 2495 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) {
2492 GetScreenInfoForWindow(results, NULL); 2496 GetScreenInfoForWindow(results, NULL);
2493 } 2497 }
2494 2498
2495 } // namespace content 2499 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698