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

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: Fix win & android compile Created 6 years, 7 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 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
1065 RecordAction( 1064 RecordAction(
1066 base::UserMetricsAction("BadMessageTerminate_SharedMemoryAura")); 1065 base::UserMetricsAction("BadMessageTerminate_SharedMemoryAura"));
1067 host_->GetProcess()->ReceivedBadMessage(); 1066 host_->GetProcess()->ReceivedBadMessage();
1068 return; 1067 return;
1069 } 1068 }
1070 } 1069 }
1071 1070
1072 #if defined(OS_WIN) 1071 #if defined(OS_WIN)
1073 void RenderWidgetHostViewAura::SetParentNativeViewAccessible( 1072 void RenderWidgetHostViewAura::SetParentNativeViewAccessible(
1074 gfx::NativeViewAccessible accessible_parent) { 1073 gfx::NativeViewAccessible accessible_parent) {
1075 if (GetBrowserAccessibilityManager()) { 1074 BrowserAccessibilityManager* manager =
1076 GetBrowserAccessibilityManager()->ToBrowserAccessibilityManagerWin() 1075 host_->GetRootBrowserAccessibilityManager();
1076 if (manager) {
1077 manager->ToBrowserAccessibilityManagerWin()
1077 ->set_parent_iaccessible(accessible_parent); 1078 ->set_parent_iaccessible(accessible_parent);
1078 } 1079 }
1079 } 1080 }
1080 1081
1081 gfx::NativeViewId RenderWidgetHostViewAura::GetParentForWindowlessPlugin() 1082 gfx::NativeViewId RenderWidgetHostViewAura::GetParentForWindowlessPlugin()
1082 const { 1083 const {
1083 if (legacy_render_widget_host_HWND_) { 1084 if (legacy_render_widget_host_HWND_) {
1084 return reinterpret_cast<gfx::NativeViewId>( 1085 return reinterpret_cast<gfx::NativeViewId>(
1085 legacy_render_widget_host_HWND_->hwnd()); 1086 legacy_render_widget_host_HWND_->hwnd());
1086 } 1087 }
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
1181 RenderWidgetHostViewAura::CreateSyntheticGestureTarget() { 1182 RenderWidgetHostViewAura::CreateSyntheticGestureTarget() {
1182 return scoped_ptr<SyntheticGestureTarget>( 1183 return scoped_ptr<SyntheticGestureTarget>(
1183 new SyntheticGestureTargetAura(host_)); 1184 new SyntheticGestureTargetAura(host_));
1184 } 1185 }
1185 1186
1186 void RenderWidgetHostViewAura::SetScrollOffsetPinning( 1187 void RenderWidgetHostViewAura::SetScrollOffsetPinning(
1187 bool is_pinned_to_left, bool is_pinned_to_right) { 1188 bool is_pinned_to_left, bool is_pinned_to_right) {
1188 // Not needed. Mac-only. 1189 // Not needed. Mac-only.
1189 } 1190 }
1190 1191
1191 void RenderWidgetHostViewAura::CreateBrowserAccessibilityManagerIfNeeded() { 1192 BrowserAccessibilityManager*
1192 if (GetBrowserAccessibilityManager()) 1193 RenderWidgetHostViewAura::CreateBrowserAccessibilityManager(
ncarter (slow) 2014/05/28 00:50:11 Indentation is off here.
dmazzoni 2014/05/28 22:01:17 Done.
1193 return; 1194 BrowserAccessibilityDelegate* delegate) {
1194
1195 BrowserAccessibilityManager* manager = NULL; 1195 BrowserAccessibilityManager* manager = NULL;
1196 #if defined(OS_WIN) 1196 #if defined(OS_WIN)
1197 aura::WindowTreeHost* host = window_->GetHost(); 1197 aura::WindowTreeHost* host = window_->GetHost();
1198 if (!host) 1198 if (!host)
1199 return; 1199 return NULL;
1200 HWND hwnd = host->GetAcceleratedWidget(); 1200 HWND hwnd = host->GetAcceleratedWidget();
1201 1201
1202 // The accessible_parent may be NULL at this point. The WebContents will pass 1202 // The accessible_parent may be NULL at this point. The WebContents will pass
1203 // it down to this instance (by way of the RenderViewHost and 1203 // it down to this instance (by way of the RenderViewHost and
1204 // RenderWidgetHost) when it is known. This instance will then set it on its 1204 // RenderWidgetHost) when it is known. This instance will then set it on its
1205 // BrowserAccessibilityManager. 1205 // BrowserAccessibilityManager.
1206 RenderViewHost* rvh = RenderViewHost::From(host_);
1207 RenderFrameHostImpl* rfh =
1208 rvh->GetDelegate()->GetFrameTree()->GetMainFrame();
1206 gfx::NativeViewAccessible accessible_parent = 1209 gfx::NativeViewAccessible accessible_parent =
1207 host_->GetParentNativeViewAccessible(); 1210 rfh->GetParentNativeViewAccessible();
1208 1211
1209 if (legacy_render_widget_host_HWND_) { 1212 if (legacy_render_widget_host_HWND_) {
1210 manager = new BrowserAccessibilityManagerWin( 1213 manager = new BrowserAccessibilityManagerWin(
1211 legacy_render_widget_host_HWND_.get(), accessible_parent, 1214 legacy_render_widget_host_HWND_.get(), accessible_parent,
1212 BrowserAccessibilityManagerWin::GetEmptyDocument(), host_); 1215 BrowserAccessibilityManagerWin::GetEmptyDocument(), delegate);
1213 } 1216 }
1214 #else 1217 #else
1215 manager = BrowserAccessibilityManager::Create( 1218 manager = BrowserAccessibilityManager::Create(
1216 BrowserAccessibilityManager::GetEmptyDocument(), host_); 1219 BrowserAccessibilityManager::GetEmptyDocument(), delegate);
1217 #endif 1220 #endif
1218 SetBrowserAccessibilityManager(manager); 1221 return manager;
1219 } 1222 }
1220 1223
1221 gfx::GLSurfaceHandle RenderWidgetHostViewAura::GetCompositingSurface() { 1224 gfx::GLSurfaceHandle RenderWidgetHostViewAura::GetCompositingSurface() {
1222 return ImageTransportFactory::GetInstance()->GetSharedSurfaceHandle(); 1225 return ImageTransportFactory::GetInstance()->GetSharedSurfaceHandle();
1223 } 1226 }
1224 1227
1225 bool RenderWidgetHostViewAura::LockMouse() { 1228 bool RenderWidgetHostViewAura::LockMouse() {
1226 aura::Window* root_window = window_->GetRootWindow(); 1229 aura::Window* root_window = window_->GetRootWindow();
1227 if (!root_window) 1230 if (!root_window)
1228 return false; 1231 return false;
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after
2021 host_->SetInputMethodActive(input_method->IsActive()); 2024 host_->SetInputMethodActive(input_method->IsActive());
2022 2025
2023 // Often the application can set focus to the view in response to a key 2026 // Often the application can set focus to the view in response to a key
2024 // down. However the following char event shouldn't be sent to the web 2027 // down. However the following char event shouldn't be sent to the web
2025 // page. 2028 // page.
2026 host_->SuppressNextCharEvents(); 2029 host_->SuppressNextCharEvents();
2027 } else { 2030 } else {
2028 host_->SetInputMethodActive(false); 2031 host_->SetInputMethodActive(false);
2029 } 2032 }
2030 2033
2031 BrowserAccessibilityManager* manager = GetBrowserAccessibilityManager(); 2034 BrowserAccessibilityManager* manager =
2035 host_->GetRootBrowserAccessibilityManager();
2032 if (manager) 2036 if (manager)
2033 manager->OnWindowFocused(); 2037 manager->OnWindowFocused();
2034 } else if (window_ == lost_focus) { 2038 } else if (window_ == lost_focus) {
2035 host_->SetActive(false); 2039 host_->SetActive(false);
2036 host_->Blur(); 2040 host_->Blur();
2037 2041
2038 DetachFromInputMethod(); 2042 DetachFromInputMethod();
2039 host_->SetInputMethodActive(false); 2043 host_->SetInputMethodActive(false);
2040 2044
2041 if (touch_editing_client_) 2045 if (touch_editing_client_)
2042 touch_editing_client_->EndTouchEditing(false); 2046 touch_editing_client_->EndTouchEditing(false);
2043 2047
2044 BrowserAccessibilityManager* manager = GetBrowserAccessibilityManager(); 2048 BrowserAccessibilityManager* manager =
2049 host_->GetRootBrowserAccessibilityManager();
2045 if (manager) 2050 if (manager)
2046 manager->OnWindowBlurred(); 2051 manager->OnWindowBlurred();
2047 2052
2048 // If we lose the focus while fullscreen, close the window; Pepper Flash 2053 // If we lose the focus while fullscreen, close the window; Pepper Flash
2049 // won't do it for us (unlike NPAPI Flash). However, we do not close the 2054 // won't do it for us (unlike NPAPI Flash). However, we do not close the
2050 // window if we lose the focus to a window on another display. 2055 // window if we lose the focus to a window on another display.
2051 gfx::Screen* screen = gfx::Screen::GetScreenFor(window_); 2056 gfx::Screen* screen = gfx::Screen::GetScreenFor(window_);
2052 bool focusing_other_display = 2057 bool focusing_other_display =
2053 gained_focus && screen->GetNumDisplays() > 1 && 2058 gained_focus && screen->GetNumDisplays() > 1 &&
2054 (screen->GetDisplayNearestWindow(window_).id() != 2059 (screen->GetDisplayNearestWindow(window_).id() !=
(...skipping 324 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