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

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

Issue 273423004: Migrate accessibility from RenderView to RenderFrame. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Get rid of ForEachFrameAndPendingFrame Created 6 years, 6 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 | Annotate | Revision Log
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 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 #endif 628 #endif
629 return static_cast<gfx::NativeViewId>(NULL); 629 return static_cast<gfx::NativeViewId>(NULL);
630 } 630 }
631 631
632 gfx::NativeViewAccessible RenderWidgetHostViewAura::GetNativeViewAccessible() { 632 gfx::NativeViewAccessible RenderWidgetHostViewAura::GetNativeViewAccessible() {
633 #if defined(OS_WIN) 633 #if defined(OS_WIN)
634 aura::WindowTreeHost* host = window_->GetHost(); 634 aura::WindowTreeHost* host = window_->GetHost();
635 if (!host) 635 if (!host)
636 return static_cast<gfx::NativeViewAccessible>(NULL); 636 return static_cast<gfx::NativeViewAccessible>(NULL);
637 HWND hwnd = host->GetAcceleratedWidget(); 637 HWND hwnd = host->GetAcceleratedWidget();
638 638 BrowserAccessibilityManager* manager =
639 CreateBrowserAccessibilityManagerIfNeeded(); 639 host_->GetRootBrowserAccessibilityManager();
640 BrowserAccessibilityManager* manager = GetBrowserAccessibilityManager();
641 if (manager) 640 if (manager)
642 return manager->GetRoot()->ToBrowserAccessibilityWin(); 641 return manager->GetRoot()->ToBrowserAccessibilityWin();
643 #endif 642 #endif
644 643
645 NOTIMPLEMENTED(); 644 NOTIMPLEMENTED();
646 return static_cast<gfx::NativeViewAccessible>(NULL); 645 return static_cast<gfx::NativeViewAccessible>(NULL);
647 } 646 }
648 647
649 ui::TextInputClient* RenderWidgetHostViewAura::GetTextInputClient() { 648 ui::TextInputClient* RenderWidgetHostViewAura::GetTextInputClient() {
650 return this; 649 return this;
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
1066 RecordAction( 1065 RecordAction(
1067 base::UserMetricsAction("BadMessageTerminate_SharedMemoryAura")); 1066 base::UserMetricsAction("BadMessageTerminate_SharedMemoryAura"));
1068 host_->GetProcess()->ReceivedBadMessage(); 1067 host_->GetProcess()->ReceivedBadMessage();
1069 return; 1068 return;
1070 } 1069 }
1071 } 1070 }
1072 1071
1073 #if defined(OS_WIN) 1072 #if defined(OS_WIN)
1074 void RenderWidgetHostViewAura::SetParentNativeViewAccessible( 1073 void RenderWidgetHostViewAura::SetParentNativeViewAccessible(
1075 gfx::NativeViewAccessible accessible_parent) { 1074 gfx::NativeViewAccessible accessible_parent) {
1076 if (GetBrowserAccessibilityManager()) { 1075 BrowserAccessibilityManager* manager =
1077 GetBrowserAccessibilityManager()->ToBrowserAccessibilityManagerWin() 1076 host_->GetRootBrowserAccessibilityManager();
1077 if (manager) {
1078 manager->ToBrowserAccessibilityManagerWin()
1078 ->set_parent_iaccessible(accessible_parent); 1079 ->set_parent_iaccessible(accessible_parent);
1079 } 1080 }
1080 } 1081 }
1081 1082
1082 gfx::NativeViewId RenderWidgetHostViewAura::GetParentForWindowlessPlugin() 1083 gfx::NativeViewId RenderWidgetHostViewAura::GetParentForWindowlessPlugin()
1083 const { 1084 const {
1084 if (legacy_render_widget_host_HWND_) { 1085 if (legacy_render_widget_host_HWND_) {
1085 return reinterpret_cast<gfx::NativeViewId>( 1086 return reinterpret_cast<gfx::NativeViewId>(
1086 legacy_render_widget_host_HWND_->hwnd()); 1087 legacy_render_widget_host_HWND_->hwnd());
1087 } 1088 }
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
1182 RenderWidgetHostViewAura::CreateSyntheticGestureTarget() { 1183 RenderWidgetHostViewAura::CreateSyntheticGestureTarget() {
1183 return scoped_ptr<SyntheticGestureTarget>( 1184 return scoped_ptr<SyntheticGestureTarget>(
1184 new SyntheticGestureTargetAura(host_)); 1185 new SyntheticGestureTargetAura(host_));
1185 } 1186 }
1186 1187
1187 void RenderWidgetHostViewAura::SetScrollOffsetPinning( 1188 void RenderWidgetHostViewAura::SetScrollOffsetPinning(
1188 bool is_pinned_to_left, bool is_pinned_to_right) { 1189 bool is_pinned_to_left, bool is_pinned_to_right) {
1189 // Not needed. Mac-only. 1190 // Not needed. Mac-only.
1190 } 1191 }
1191 1192
1192 void RenderWidgetHostViewAura::CreateBrowserAccessibilityManagerIfNeeded() { 1193 BrowserAccessibilityManager*
1193 if (GetBrowserAccessibilityManager()) 1194 RenderWidgetHostViewAura::CreateBrowserAccessibilityManager(
1194 return; 1195 BrowserAccessibilityDelegate* delegate) {
1195
1196 BrowserAccessibilityManager* manager = NULL; 1196 BrowserAccessibilityManager* manager = NULL;
1197 #if defined(OS_WIN) 1197 #if defined(OS_WIN)
1198 aura::WindowTreeHost* host = window_->GetHost(); 1198 aura::WindowTreeHost* host = window_->GetHost();
1199 if (!host) 1199 if (!host)
1200 return; 1200 return NULL;
1201 HWND hwnd = host->GetAcceleratedWidget(); 1201 HWND hwnd = host->GetAcceleratedWidget();
1202 1202
1203 // The accessible_parent may be NULL at this point. The WebContents will pass 1203 // The accessible_parent may be NULL at this point. The WebContents will pass
1204 // it down to this instance (by way of the RenderViewHost and 1204 // it down to this instance (by way of the RenderViewHost and
1205 // RenderWidgetHost) when it is known. This instance will then set it on its 1205 // RenderWidgetHost) when it is known. This instance will then set it on its
1206 // BrowserAccessibilityManager. 1206 // BrowserAccessibilityManager.
1207 RenderViewHost* rvh = RenderViewHost::From(host_);
1208 RenderFrameHostImpl* rfh =
1209 rvh->GetDelegate()->GetFrameTree()->GetMainFrame();
1207 gfx::NativeViewAccessible accessible_parent = 1210 gfx::NativeViewAccessible accessible_parent =
1208 host_->GetParentNativeViewAccessible(); 1211 rfh->GetParentNativeViewAccessible();
1209 1212
1210 if (legacy_render_widget_host_HWND_) { 1213 if (legacy_render_widget_host_HWND_) {
1211 manager = new BrowserAccessibilityManagerWin( 1214 manager = new BrowserAccessibilityManagerWin(
1212 legacy_render_widget_host_HWND_.get(), accessible_parent, 1215 legacy_render_widget_host_HWND_.get(), accessible_parent,
1213 BrowserAccessibilityManagerWin::GetEmptyDocument(), host_); 1216 BrowserAccessibilityManagerWin::GetEmptyDocument(), delegate);
1214 } 1217 }
1215 #else 1218 #else
1216 manager = BrowserAccessibilityManager::Create( 1219 manager = BrowserAccessibilityManager::Create(
1217 BrowserAccessibilityManager::GetEmptyDocument(), host_); 1220 BrowserAccessibilityManager::GetEmptyDocument(), delegate);
1218 #endif 1221 #endif
1219 SetBrowserAccessibilityManager(manager); 1222 return manager;
1220 } 1223 }
1221 1224
1222 gfx::GLSurfaceHandle RenderWidgetHostViewAura::GetCompositingSurface() { 1225 gfx::GLSurfaceHandle RenderWidgetHostViewAura::GetCompositingSurface() {
1223 return ImageTransportFactory::GetInstance()->GetSharedSurfaceHandle(); 1226 return ImageTransportFactory::GetInstance()->GetSharedSurfaceHandle();
1224 } 1227 }
1225 1228
1226 bool RenderWidgetHostViewAura::LockMouse() { 1229 bool RenderWidgetHostViewAura::LockMouse() {
1227 aura::Window* root_window = window_->GetRootWindow(); 1230 aura::Window* root_window = window_->GetRootWindow();
1228 if (!root_window) 1231 if (!root_window)
1229 return false; 1232 return false;
(...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after
2023 host_->SetInputMethodActive(input_method->IsActive()); 2026 host_->SetInputMethodActive(input_method->IsActive());
2024 2027
2025 // Often the application can set focus to the view in response to a key 2028 // Often the application can set focus to the view in response to a key
2026 // down. However the following char event shouldn't be sent to the web 2029 // down. However the following char event shouldn't be sent to the web
2027 // page. 2030 // page.
2028 host_->SuppressNextCharEvents(); 2031 host_->SuppressNextCharEvents();
2029 } else { 2032 } else {
2030 host_->SetInputMethodActive(false); 2033 host_->SetInputMethodActive(false);
2031 } 2034 }
2032 2035
2033 BrowserAccessibilityManager* manager = GetBrowserAccessibilityManager(); 2036 BrowserAccessibilityManager* manager =
2037 host_->GetRootBrowserAccessibilityManager();
2034 if (manager) 2038 if (manager)
2035 manager->OnWindowFocused(); 2039 manager->OnWindowFocused();
2036 } else if (window_ == lost_focus) { 2040 } else if (window_ == lost_focus) {
2037 host_->SetActive(false); 2041 host_->SetActive(false);
2038 host_->Blur(); 2042 host_->Blur();
2039 2043
2040 DetachFromInputMethod(); 2044 DetachFromInputMethod();
2041 host_->SetInputMethodActive(false); 2045 host_->SetInputMethodActive(false);
2042 2046
2043 if (touch_editing_client_) 2047 if (touch_editing_client_)
2044 touch_editing_client_->EndTouchEditing(false); 2048 touch_editing_client_->EndTouchEditing(false);
2045 2049
2046 BrowserAccessibilityManager* manager = GetBrowserAccessibilityManager(); 2050 BrowserAccessibilityManager* manager =
2051 host_->GetRootBrowserAccessibilityManager();
2047 if (manager) 2052 if (manager)
2048 manager->OnWindowBlurred(); 2053 manager->OnWindowBlurred();
2049 2054
2050 // If we lose the focus while fullscreen, close the window; Pepper Flash 2055 // If we lose the focus while fullscreen, close the window; Pepper Flash
2051 // won't do it for us (unlike NPAPI Flash). However, we do not close the 2056 // won't do it for us (unlike NPAPI Flash). However, we do not close the
2052 // window if we lose the focus to a window on another display. 2057 // window if we lose the focus to a window on another display.
2053 gfx::Screen* screen = gfx::Screen::GetScreenFor(window_); 2058 gfx::Screen* screen = gfx::Screen::GetScreenFor(window_);
2054 bool focusing_other_display = 2059 bool focusing_other_display =
2055 gained_focus && screen->GetNumDisplays() > 1 && 2060 gained_focus && screen->GetNumDisplays() > 1 &&
2056 (screen->GetDisplayNearestWindow(window_).id() != 2061 (screen->GetDisplayNearestWindow(window_).id() !=
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
2379 2384
2380 //////////////////////////////////////////////////////////////////////////////// 2385 ////////////////////////////////////////////////////////////////////////////////
2381 // RenderWidgetHostViewBase, public: 2386 // RenderWidgetHostViewBase, public:
2382 2387
2383 // static 2388 // static
2384 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { 2389 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) {
2385 GetScreenInfoForWindow(results, NULL); 2390 GetScreenInfoForWindow(results, NULL);
2386 } 2391 }
2387 2392
2388 } // namespace content 2393 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698