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 <map> | 8 #include <map> |
9 #include <peninputpanel_i.c> | 9 #include <peninputpanel_i.c> |
10 #include <stack> | 10 #include <stack> |
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
679 gfx::Rect pos = gfx::Screen::GetDisplayNearestWindow( | 679 gfx::Rect pos = gfx::Screen::GetDisplayNearestWindow( |
680 reference_host_view->GetNativeView()).bounds(); | 680 reference_host_view->GetNativeView()).bounds(); |
681 is_fullscreen_ = true; | 681 is_fullscreen_ = true; |
682 DoPopupOrFullscreenInit(ui::GetWindowToParentTo(true), pos, 0); | 682 DoPopupOrFullscreenInit(ui::GetWindowToParentTo(true), pos, 0); |
683 } | 683 } |
684 | 684 |
685 RenderWidgetHost* RenderWidgetHostViewWin::GetRenderWidgetHost() const { | 685 RenderWidgetHost* RenderWidgetHostViewWin::GetRenderWidgetHost() const { |
686 return render_widget_host_; | 686 return render_widget_host_; |
687 } | 687 } |
688 | 688 |
689 void RenderWidgetHostViewWin::WasRestored() { | 689 void RenderWidgetHostViewWin::WasShown() { |
690 if (!is_hidden_) | 690 if (!is_hidden_) |
691 return; | 691 return; |
692 | 692 |
693 if (web_contents_switch_paint_time_.is_null()) | 693 if (web_contents_switch_paint_time_.is_null()) |
694 web_contents_switch_paint_time_ = TimeTicks::Now(); | 694 web_contents_switch_paint_time_ = TimeTicks::Now(); |
695 is_hidden_ = false; | 695 is_hidden_ = false; |
696 | 696 |
697 // |render_widget_host_| may be NULL if the WebContentsImpl is in the process | 697 // |render_widget_host_| may be NULL if the WebContentsImpl is in the process |
698 // of closing. | 698 // of closing. |
699 if (render_widget_host_) | 699 if (render_widget_host_) |
700 render_widget_host_->WasRestored(); | 700 render_widget_host_->WasShown(); |
701 } | 701 } |
702 | 702 |
703 void RenderWidgetHostViewWin::WasHidden() { | 703 void RenderWidgetHostViewWin::WasHidden() { |
704 if (is_hidden_) | 704 if (is_hidden_) |
705 return; | 705 return; |
706 | 706 |
707 // If we receive any more paint messages while we are hidden, we want to | 707 // If we receive any more paint messages while we are hidden, we want to |
708 // ignore them so we don't re-allocate the backing store. We will paint | 708 // ignore them so we don't re-allocate the backing store. We will paint |
709 // everything again when we become selected again. | 709 // everything again when we become selected again. |
710 is_hidden_ = true; | 710 is_hidden_ = true; |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
956 return ::GetFocus() == m_hWnd; | 956 return ::GetFocus() == m_hWnd; |
957 } | 957 } |
958 | 958 |
959 bool RenderWidgetHostViewWin::IsSurfaceAvailableForCopy() const { | 959 bool RenderWidgetHostViewWin::IsSurfaceAvailableForCopy() const { |
960 return !!render_widget_host_->GetBackingStore(false) || | 960 return !!render_widget_host_->GetBackingStore(false) || |
961 !!accelerated_surface_.get(); | 961 !!accelerated_surface_.get(); |
962 } | 962 } |
963 | 963 |
964 void RenderWidgetHostViewWin::Show() { | 964 void RenderWidgetHostViewWin::Show() { |
965 ShowWindow(SW_SHOW); | 965 ShowWindow(SW_SHOW); |
966 WasRestored(); | 966 WasShown(); |
967 } | 967 } |
968 | 968 |
969 void RenderWidgetHostViewWin::Hide() { | 969 void RenderWidgetHostViewWin::Hide() { |
970 if (!is_fullscreen_ && GetParent() == ui::GetWindowToParentTo(true)) { | 970 if (!is_fullscreen_ && GetParent() == ui::GetWindowToParentTo(true)) { |
971 LOG(WARNING) << "Hide() called twice in a row: " << this << ":" | 971 LOG(WARNING) << "Hide() called twice in a row: " << this << ":" |
972 << GetParent(); | 972 << GetParent(); |
973 return; | 973 return; |
974 } | 974 } |
975 | 975 |
976 if (::GetFocus() == m_hWnd) | 976 if (::GetFocus() == m_hWnd) |
(...skipping 2185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3162 // receive a focus change in the context of a pointer down message, it means | 3162 // receive a focus change in the context of a pointer down message, it means |
3163 // that the pointer down message occurred on the edit field and we should | 3163 // that the pointer down message occurred on the edit field and we should |
3164 // display the on screen keyboard | 3164 // display the on screen keyboard |
3165 if (!received_focus_change_after_pointer_down_ && virtual_keyboard_) | 3165 if (!received_focus_change_after_pointer_down_ && virtual_keyboard_) |
3166 DisplayOnScreenKeyboardIfNeeded(); | 3166 DisplayOnScreenKeyboardIfNeeded(); |
3167 received_focus_change_after_pointer_down_ = false; | 3167 received_focus_change_after_pointer_down_ = false; |
3168 pointer_down_context_ = false; | 3168 pointer_down_context_ = false; |
3169 } | 3169 } |
3170 | 3170 |
3171 } // namespace content | 3171 } // namespace content |
OLD | NEW |