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

Side by Side Diff: ui/views/controls/webview/webview.cc

Issue 909143003: Re-land: Implement NativeViewAccessibilityWin using AXPlatformNodeWin. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update GN build Created 5 years, 10 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
« no previous file with comments | « ui/views/accessibility/native_view_accessibility_win_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ui/views/controls/webview/webview.h" 5 #include "ui/views/controls/webview/webview.h"
6 6
7 #include "content/public/browser/browser_accessibility_state.h" 7 #include "content/public/browser/browser_accessibility_state.h"
8 #include "content/public/browser/browser_context.h" 8 #include "content/public/browser/browser_context.h"
9 #include "content/public/browser/navigation_controller.h" 9 #include "content/public/browser/navigation_controller.h"
10 #include "content/public/browser/render_process_host.h" 10 #include "content/public/browser/render_process_host.h"
11 #include "content/public/browser/render_view_host.h" 11 #include "content/public/browser/render_view_host.h"
12 #include "content/public/browser/render_widget_host_view.h" 12 #include "content/public/browser/render_widget_host_view.h"
13 #include "content/public/browser/web_contents.h" 13 #include "content/public/browser/web_contents.h"
14 #include "ipc/ipc_message.h" 14 #include "ipc/ipc_message.h"
15 #include "ui/accessibility/ax_enums.h" 15 #include "ui/accessibility/ax_enums.h"
16 #include "ui/accessibility/ax_view_state.h" 16 #include "ui/accessibility/ax_view_state.h"
17 #include "ui/base/ui_base_switches_util.h" 17 #include "ui/base/ui_base_switches_util.h"
18 #include "ui/events/event.h" 18 #include "ui/events/event.h"
19 #include "ui/views/accessibility/native_view_accessibility.h"
20 #include "ui/views/controls/native/native_view_host.h" 19 #include "ui/views/controls/native/native_view_host.h"
21 #include "ui/views/focus/focus_manager.h" 20 #include "ui/views/focus/focus_manager.h"
22 #include "ui/views/views_delegate.h" 21 #include "ui/views/views_delegate.h"
23 22
24 namespace views { 23 namespace views {
25 24
26 // static 25 // static
27 const char WebView::kViewClassName[] = "WebView"; 26 const char WebView::kViewClassName[] = "WebView";
28 27
29 //////////////////////////////////////////////////////////////////////////////// 28 ////////////////////////////////////////////////////////////////////////////////
30 // WebView, public: 29 // WebView, public:
31 30
32 WebView::WebView(content::BrowserContext* browser_context) 31 WebView::WebView(content::BrowserContext* browser_context)
33 : holder_(new NativeViewHost()), 32 : holder_(new NativeViewHost()),
34 observing_render_process_host_(nullptr), 33 observing_render_process_host_(nullptr),
35 embed_fullscreen_widget_mode_enabled_(false), 34 embed_fullscreen_widget_mode_enabled_(false),
36 is_embedding_fullscreen_widget_(false), 35 is_embedding_fullscreen_widget_(false),
37 browser_context_(browser_context), 36 browser_context_(browser_context),
38 allow_accelerators_(false) { 37 allow_accelerators_(false) {
39 AddChildView(holder_); // Takes ownership of |holder_|. 38 AddChildView(holder_); // Takes ownership of |holder_|.
40 NativeViewAccessibility::RegisterWebView(this);
41 } 39 }
42 40
43 WebView::~WebView() { 41 WebView::~WebView() {
44 SetWebContents(NULL); // Make sure all necessary tear-down takes place. 42 SetWebContents(NULL); // Make sure all necessary tear-down takes place.
45 NativeViewAccessibility::UnregisterWebView(this);
46 } 43 }
47 44
48 content::WebContents* WebView::GetWebContents() { 45 content::WebContents* WebView::GetWebContents() {
49 if (!web_contents()) { 46 if (!web_contents()) {
50 wc_owner_.reset(CreateWebContents(browser_context_)); 47 wc_owner_.reset(CreateWebContents(browser_context_));
51 wc_owner_->SetDelegate(this); 48 wc_owner_->SetDelegate(this);
52 SetWebContents(wc_owner_.get()); 49 SetWebContents(wc_owner_.get());
53 } 50 }
54 return web_contents(); 51 return web_contents();
55 } 52 }
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 if (!contents) { 421 if (!contents) {
425 content::WebContents::CreateParams create_params( 422 content::WebContents::CreateParams create_params(
426 browser_context, NULL); 423 browser_context, NULL);
427 return content::WebContents::Create(create_params); 424 return content::WebContents::Create(create_params);
428 } 425 }
429 426
430 return contents; 427 return contents;
431 } 428 }
432 429
433 } // namespace views 430 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/accessibility/native_view_accessibility_win_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698