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 "content/browser/renderer_host/render_widget_host_view_win.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_win.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <peninputpanel_i.c> | 8 #include <peninputpanel_i.c> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 close_on_deactivate_ = true; | 385 close_on_deactivate_ = true; |
386 DoPopupOrFullscreenInit(parent_host_view->GetNativeView(), pos, | 386 DoPopupOrFullscreenInit(parent_host_view->GetNativeView(), pos, |
387 WS_EX_TOOLWINDOW); | 387 WS_EX_TOOLWINDOW); |
388 } | 388 } |
389 | 389 |
390 void RenderWidgetHostViewWin::InitAsFullscreen( | 390 void RenderWidgetHostViewWin::InitAsFullscreen( |
391 RenderWidgetHostView* reference_host_view) { | 391 RenderWidgetHostView* reference_host_view) { |
392 gfx::Rect pos = gfx::Screen::GetMonitorNearestWindow( | 392 gfx::Rect pos = gfx::Screen::GetMonitorNearestWindow( |
393 reference_host_view->GetNativeView()).bounds(); | 393 reference_host_view->GetNativeView()).bounds(); |
394 is_fullscreen_ = true; | 394 is_fullscreen_ = true; |
395 DoPopupOrFullscreenInit(GetDesktopWindow(), pos, 0); | 395 DoPopupOrFullscreenInit(ui::GetWindowToParentTo(true), pos, 0); |
396 } | 396 } |
397 | 397 |
398 RenderWidgetHost* RenderWidgetHostViewWin::GetRenderWidgetHost() const { | 398 RenderWidgetHost* RenderWidgetHostViewWin::GetRenderWidgetHost() const { |
399 return render_widget_host_; | 399 return render_widget_host_; |
400 } | 400 } |
401 | 401 |
402 void RenderWidgetHostViewWin::DidBecomeSelected() { | 402 void RenderWidgetHostViewWin::DidBecomeSelected() { |
403 if (!is_hidden_) | 403 if (!is_hidden_) |
404 return; | 404 return; |
405 | 405 |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
661 NOTREACHED(); | 661 NOTREACHED(); |
662 } | 662 } |
663 | 663 |
664 bool RenderWidgetHostViewWin::HasFocus() const { | 664 bool RenderWidgetHostViewWin::HasFocus() const { |
665 return ::GetFocus() == m_hWnd; | 665 return ::GetFocus() == m_hWnd; |
666 } | 666 } |
667 | 667 |
668 void RenderWidgetHostViewWin::Show() { | 668 void RenderWidgetHostViewWin::Show() { |
669 if (!is_fullscreen_) { | 669 if (!is_fullscreen_) { |
670 DCHECK(parent_hwnd_); | 670 DCHECK(parent_hwnd_); |
671 DCHECK(parent_hwnd_ != GetDesktopWindow()); | 671 DCHECK(parent_hwnd_ != ui::GetWindowToParentTo(true)); |
672 SetParent(parent_hwnd_); | 672 SetParent(parent_hwnd_); |
673 } | 673 } |
674 ShowWindow(SW_SHOW); | 674 ShowWindow(SW_SHOW); |
675 | 675 |
676 DidBecomeSelected(); | 676 DidBecomeSelected(); |
677 } | 677 } |
678 | 678 |
679 void RenderWidgetHostViewWin::Hide() { | 679 void RenderWidgetHostViewWin::Hide() { |
680 if (!is_fullscreen_ && GetParent() == GetDesktopWindow()) { | 680 if (!is_fullscreen_ && GetParent() == ui::GetWindowToParentTo(true)) { |
681 LOG(WARNING) << "Hide() called twice in a row: " << this << ":" << | 681 LOG(WARNING) << "Hide() called twice in a row: " << this << ":" << |
682 parent_hwnd_ << ":" << GetParent(); | 682 parent_hwnd_ << ":" << GetParent(); |
683 return; | 683 return; |
684 } | 684 } |
685 | 685 |
686 if (::GetFocus() == m_hWnd) | 686 if (::GetFocus() == m_hWnd) |
687 ::SetFocus(NULL); | 687 ::SetFocus(NULL); |
688 ShowWindow(SW_HIDE); | 688 ShowWindow(SW_HIDE); |
689 | 689 |
690 if (!is_fullscreen_) { | 690 if (!is_fullscreen_) { |
(...skipping 2009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2700 void RenderWidgetHostViewWin::ResetPointerDownContext() { | 2700 void RenderWidgetHostViewWin::ResetPointerDownContext() { |
2701 // If the default focus on the page is on an edit field and we did not | 2701 // If the default focus on the page is on an edit field and we did not |
2702 // receive a focus change in the context of a pointer down message, it means | 2702 // receive a focus change in the context of a pointer down message, it means |
2703 // that the pointer down message occurred on the edit field and we should | 2703 // that the pointer down message occurred on the edit field and we should |
2704 // display the on screen keyboard | 2704 // display the on screen keyboard |
2705 if (!received_focus_change_after_pointer_down_ && virtual_keyboard_) | 2705 if (!received_focus_change_after_pointer_down_ && virtual_keyboard_) |
2706 DisplayOnScreenKeyboardIfNeeded(); | 2706 DisplayOnScreenKeyboardIfNeeded(); |
2707 received_focus_change_after_pointer_down_ = false; | 2707 received_focus_change_after_pointer_down_ = false; |
2708 pointer_down_context_ = false; | 2708 pointer_down_context_ = false; |
2709 } | 2709 } |
OLD | NEW |