| 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_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_view_host.h" | 10 #include "content/public/browser/render_view_host.h" |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 if (holder_->native_view() == view_to_attach) | 291 if (holder_->native_view() == view_to_attach) |
| 292 return; | 292 return; |
| 293 holder_->Attach(view_to_attach); | 293 holder_->Attach(view_to_attach); |
| 294 | 294 |
| 295 // The view will not be focused automatically when it is attached, so we need | 295 // The view will not be focused automatically when it is attached, so we need |
| 296 // to pass on focus to it if the FocusManager thinks the view is focused. Note | 296 // to pass on focus to it if the FocusManager thinks the view is focused. Note |
| 297 // that not every Widget has a focus manager. | 297 // that not every Widget has a focus manager. |
| 298 FocusManager* const focus_manager = GetFocusManager(); | 298 FocusManager* const focus_manager = GetFocusManager(); |
| 299 if (focus_manager && focus_manager->GetFocusedView() == this) | 299 if (focus_manager && focus_manager->GetFocusedView() == this) |
| 300 OnFocus(); | 300 OnFocus(); |
| 301 | |
| 302 #if defined(OS_WIN) | |
| 303 if (!is_embedding_fullscreen_widget_) { | |
| 304 web_contents()->SetParentNativeViewAccessible( | |
| 305 parent()->GetNativeViewAccessible()); | |
| 306 } | |
| 307 #endif | |
| 308 } | 301 } |
| 309 | 302 |
| 310 void WebView::DetachWebContents() { | 303 void WebView::DetachWebContents() { |
| 311 if (web_contents()) { | 304 if (web_contents()) |
| 312 holder_->Detach(); | 305 holder_->Detach(); |
| 313 #if defined(OS_WIN) | |
| 314 if (!is_embedding_fullscreen_widget_) | |
| 315 web_contents()->SetParentNativeViewAccessible(NULL); | |
| 316 #endif | |
| 317 } | |
| 318 } | 306 } |
| 319 | 307 |
| 320 void WebView::ReattachForFullscreenChange(bool enter_fullscreen) { | 308 void WebView::ReattachForFullscreenChange(bool enter_fullscreen) { |
| 321 DCHECK(embed_fullscreen_widget_mode_enabled_); | 309 DCHECK(embed_fullscreen_widget_mode_enabled_); |
| 322 const bool web_contents_has_separate_fs_widget = | 310 const bool web_contents_has_separate_fs_widget = |
| 323 web_contents() && web_contents()->GetFullscreenRenderWidgetHostView(); | 311 web_contents() && web_contents()->GetFullscreenRenderWidgetHostView(); |
| 324 if (is_embedding_fullscreen_widget_ || web_contents_has_separate_fs_widget) { | 312 if (is_embedding_fullscreen_widget_ || web_contents_has_separate_fs_widget) { |
| 325 // Shutting down or starting up the embedding of the separate fullscreen | 313 // Shutting down or starting up the embedding of the separate fullscreen |
| 326 // widget. Need to detach and re-attach to a different native view. | 314 // widget. Need to detach and re-attach to a different native view. |
| 327 DetachWebContents(); | 315 DetachWebContents(); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 354 if (!contents) { | 342 if (!contents) { |
| 355 content::WebContents::CreateParams create_params( | 343 content::WebContents::CreateParams create_params( |
| 356 browser_context, NULL); | 344 browser_context, NULL); |
| 357 return content::WebContents::Create(create_params); | 345 return content::WebContents::Create(create_params); |
| 358 } | 346 } |
| 359 | 347 |
| 360 return contents; | 348 return contents; |
| 361 } | 349 } |
| 362 | 350 |
| 363 } // namespace views | 351 } // namespace views |
| OLD | NEW |