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 "content/public/browser/browser_accessibility_state.h" |
7 #include "content/public/browser/browser_context.h" | 8 #include "content/public/browser/browser_context.h" |
8 #include "content/public/browser/navigation_controller.h" | 9 #include "content/public/browser/navigation_controller.h" |
9 #include "content/public/browser/notification_details.h" | 10 #include "content/public/browser/notification_details.h" |
10 #include "content/public/browser/notification_registrar.h" | 11 #include "content/public/browser/notification_registrar.h" |
11 #include "content/public/browser/notification_source.h" | 12 #include "content/public/browser/notification_source.h" |
12 #include "content/public/browser/notification_types.h" | 13 #include "content/public/browser/notification_types.h" |
13 #include "content/public/browser/render_view_host.h" | 14 #include "content/public/browser/render_view_host.h" |
14 #include "content/public/browser/render_widget_host_view.h" | 15 #include "content/public/browser/render_widget_host_view.h" |
15 #include "content/public/browser/web_contents.h" | 16 #include "content/public/browser/web_contents.h" |
16 #include "content/public/browser/web_contents_view.h" | 17 #include "content/public/browser/web_contents_view.h" |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 //////////////////////////////////////////////////////////////////////////////// | 180 //////////////////////////////////////////////////////////////////////////////// |
180 // WebView, content::WebContentsDelegate implementation: | 181 // WebView, content::WebContentsDelegate implementation: |
181 | 182 |
182 void WebView::WebContentsFocused(content::WebContents* web_contents) { | 183 void WebView::WebContentsFocused(content::WebContents* web_contents) { |
183 DCHECK(wc_owner_.get()); | 184 DCHECK(wc_owner_.get()); |
184 // The WebView is only the delegate of WebContentses it creates itself. | 185 // The WebView is only the delegate of WebContentses it creates itself. |
185 OnWebContentsFocused(web_contents_); | 186 OnWebContentsFocused(web_contents_); |
186 } | 187 } |
187 | 188 |
188 //////////////////////////////////////////////////////////////////////////////// | 189 //////////////////////////////////////////////////////////////////////////////// |
189 // WebView, AccessibleWebView implementation: | |
190 | |
191 gfx::NativeViewAccessible WebView::AccessibleObjectFromChildId(long child_id) { | |
192 #if defined(OS_WIN) && defined(USE_AURA) | |
193 if (!web_contents_) | |
194 return NULL; | |
195 content::RenderWidgetHostView* host_view = | |
196 web_contents_->GetRenderWidgetHostView(); | |
197 if (host_view) | |
198 return host_view->AccessibleObjectFromChildId(child_id); | |
199 return NULL; | |
200 #else | |
201 NOTIMPLEMENTED(); | |
202 return NULL; | |
203 #endif | |
204 } | |
205 | |
206 View* WebView::AsView() { | |
207 return this; | |
208 } | |
209 | |
210 //////////////////////////////////////////////////////////////////////////////// | |
211 // WebView, private: | 190 // WebView, private: |
212 | 191 |
213 void WebView::AttachWebContents() { | 192 void WebView::AttachWebContents() { |
214 // Prevents attachment if the WebView isn't already in a Widget, or it's | 193 // Prevents attachment if the WebView isn't already in a Widget, or it's |
215 // already attached. | 194 // already attached. |
216 if (!GetWidget() || !web_contents_ || | 195 if (!GetWidget() || !web_contents_ || |
217 wcv_holder_->native_view() == web_contents_->GetView()->GetNativeView()) { | 196 wcv_holder_->native_view() == web_contents_->GetView()->GetNativeView()) { |
218 return; | 197 return; |
219 } | 198 } |
220 | 199 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 if (!contents) { | 266 if (!contents) { |
288 content::WebContents::CreateParams create_params( | 267 content::WebContents::CreateParams create_params( |
289 browser_context, site_instance); | 268 browser_context, site_instance); |
290 return content::WebContents::Create(create_params); | 269 return content::WebContents::Create(create_params); |
291 } | 270 } |
292 | 271 |
293 return contents; | 272 return contents; |
294 } | 273 } |
295 | 274 |
296 } // namespace views | 275 } // namespace views |
OLD | NEW |