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" |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 | 332 |
333 holder_->Attach(view_to_attach); | 333 holder_->Attach(view_to_attach); |
334 | 334 |
335 // The view will not be focused automatically when it is attached, so we need | 335 // The view will not be focused automatically when it is attached, so we need |
336 // to pass on focus to it if the FocusManager thinks the view is focused. Note | 336 // to pass on focus to it if the FocusManager thinks the view is focused. Note |
337 // that not every Widget has a focus manager. | 337 // that not every Widget has a focus manager. |
338 FocusManager* const focus_manager = GetFocusManager(); | 338 FocusManager* const focus_manager = GetFocusManager(); |
339 if (focus_manager && focus_manager->GetFocusedView() == this) | 339 if (focus_manager && focus_manager->GetFocusedView() == this) |
340 OnFocus(); | 340 OnFocus(); |
341 | 341 |
342 #if defined(OS_WIN) | |
343 if (!is_embedding_fullscreen_widget_) { | |
344 web_contents()->SetParentNativeViewAccessible( | |
345 parent()->GetNativeViewAccessible()); | |
346 } | |
347 #endif | |
348 | |
349 OnWebContentsAttached(); | 342 OnWebContentsAttached(); |
350 } | 343 } |
351 | 344 |
352 void WebView::DetachWebContents() { | 345 void WebView::DetachWebContents() { |
353 if (web_contents()) { | 346 if (web_contents()) |
354 holder_->Detach(); | 347 holder_->Detach(); |
355 #if defined(OS_WIN) | |
356 if (!is_embedding_fullscreen_widget_) | |
357 web_contents()->SetParentNativeViewAccessible(NULL); | |
358 #endif | |
359 } | |
360 } | 348 } |
361 | 349 |
362 void WebView::ReattachForFullscreenChange(bool enter_fullscreen) { | 350 void WebView::ReattachForFullscreenChange(bool enter_fullscreen) { |
363 DCHECK(embed_fullscreen_widget_mode_enabled_); | 351 DCHECK(embed_fullscreen_widget_mode_enabled_); |
364 const bool web_contents_has_separate_fs_widget = | 352 const bool web_contents_has_separate_fs_widget = |
365 web_contents() && web_contents()->GetFullscreenRenderWidgetHostView(); | 353 web_contents() && web_contents()->GetFullscreenRenderWidgetHostView(); |
366 if (is_embedding_fullscreen_widget_ || web_contents_has_separate_fs_widget) { | 354 if (is_embedding_fullscreen_widget_ || web_contents_has_separate_fs_widget) { |
367 // Shutting down or starting up the embedding of the separate fullscreen | 355 // Shutting down or starting up the embedding of the separate fullscreen |
368 // widget. Need to detach and re-attach to a different native view. | 356 // widget. Need to detach and re-attach to a different native view. |
369 DetachWebContents(); | 357 DetachWebContents(); |
(...skipping 24 matching lines...) Expand all Loading... |
394 if (!contents) { | 382 if (!contents) { |
395 content::WebContents::CreateParams create_params( | 383 content::WebContents::CreateParams create_params( |
396 browser_context, NULL); | 384 browser_context, NULL); |
397 return content::WebContents::Create(create_params); | 385 return content::WebContents::Create(create_params); |
398 } | 386 } |
399 | 387 |
400 return contents; | 388 return contents; |
401 } | 389 } |
402 | 390 |
403 } // namespace views | 391 } // namespace views |
OLD | NEW |