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 "ui/views/controls/webview/webview.h" | 5 #include "ui/views/controls/webview/webview.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 #include "content/public/browser/browser_accessibility_state.h" | 10 #include "content/public/browser/browser_accessibility_state.h" |
11 #include "content/public/browser/browser_context.h" | 11 #include "content/public/browser/browser_context.h" |
12 #include "content/public/browser/navigation_controller.h" | 12 #include "content/public/browser/navigation_controller.h" |
13 #include "content/public/browser/render_process_host.h" | 13 #include "content/public/browser/render_process_host.h" |
14 #include "content/public/browser/render_view_host.h" | 14 #include "content/public/browser/render_view_host.h" |
15 #include "content/public/browser/render_widget_host_view.h" | 15 #include "content/public/browser/render_widget_host_view.h" |
16 #include "content/public/browser/web_contents.h" | 16 #include "content/public/browser/web_contents.h" |
17 #include "ipc/ipc_message.h" | 17 #include "ipc/ipc_message.h" |
18 #include "ui/accessibility/ax_enums.h" | 18 #include "ui/accessibility/ax_enums.h" |
19 #include "ui/accessibility/ax_view_state.h" | 19 #include "ui/accessibility/ax_view_state.h" |
20 #include "ui/events/event.h" | 20 #include "ui/events/event.h" |
21 #include "ui/views/controls/native/native_view_host.h" | 21 #include "ui/views/controls/native/native_view_host.h" |
22 #include "ui/views/focus/focus_manager.h" | 22 #include "ui/views/focus/focus_manager.h" |
| 23 #include "ui/views/style/platform_style.h" |
23 #include "ui/views/views_delegate.h" | 24 #include "ui/views/views_delegate.h" |
24 | 25 |
25 namespace views { | 26 namespace views { |
26 | 27 |
27 // static | 28 // static |
28 const char WebView::kViewClassName[] = "WebView"; | 29 const char WebView::kViewClassName[] = "WebView"; |
29 | 30 |
30 //////////////////////////////////////////////////////////////////////////////// | 31 //////////////////////////////////////////////////////////////////////////////// |
31 // WebView, public: | 32 // WebView, public: |
32 | 33 |
(...skipping 27 matching lines...) Expand all Loading... |
60 WebContentsObserver::Observe(replacement); | 61 WebContentsObserver::Observe(replacement); |
61 if (observing_render_process_host_) { | 62 if (observing_render_process_host_) { |
62 observing_render_process_host_->RemoveObserver(this); | 63 observing_render_process_host_->RemoveObserver(this); |
63 observing_render_process_host_ = nullptr; | 64 observing_render_process_host_ = nullptr; |
64 } | 65 } |
65 if (web_contents() && web_contents()->GetRenderProcessHost()) { | 66 if (web_contents() && web_contents()->GetRenderProcessHost()) { |
66 observing_render_process_host_ = web_contents()->GetRenderProcessHost(); | 67 observing_render_process_host_ = web_contents()->GetRenderProcessHost(); |
67 observing_render_process_host_->AddObserver(this); | 68 observing_render_process_host_->AddObserver(this); |
68 } | 69 } |
69 // web_contents() now returns |replacement| from here onwards. | 70 // web_contents() now returns |replacement| from here onwards. |
70 SetFocusable(!!web_contents()); | 71 if (web_contents()) |
| 72 PlatformStyle::ConfigureFocus(PlatformStyle::CONTROL::WEBVIEW, this); |
| 73 |
71 if (wc_owner_.get() != replacement) | 74 if (wc_owner_.get() != replacement) |
72 wc_owner_.reset(); | 75 wc_owner_.reset(); |
73 if (embed_fullscreen_widget_mode_enabled_) { | 76 if (embed_fullscreen_widget_mode_enabled_) { |
74 is_embedding_fullscreen_widget_ = | 77 is_embedding_fullscreen_widget_ = |
75 web_contents() && web_contents()->GetFullscreenRenderWidgetHostView(); | 78 web_contents() && web_contents()->GetFullscreenRenderWidgetHostView(); |
76 } else { | 79 } else { |
77 DCHECK(!is_embedding_fullscreen_widget_); | 80 DCHECK(!is_embedding_fullscreen_widget_); |
78 } | 81 } |
79 AttachWebContents(); | 82 AttachWebContents(); |
80 NotifyAccessibilityWebContentsChanged(); | 83 NotifyAccessibilityWebContentsChanged(); |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 if (!contents) { | 385 if (!contents) { |
383 content::WebContents::CreateParams create_params( | 386 content::WebContents::CreateParams create_params( |
384 browser_context, NULL); | 387 browser_context, NULL); |
385 return content::WebContents::Create(create_params); | 388 return content::WebContents::Create(create_params); |
386 } | 389 } |
387 | 390 |
388 return contents; | 391 return contents; |
389 } | 392 } |
390 | 393 |
391 } // namespace views | 394 } // namespace views |
OLD | NEW |