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_aura.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
683 window_->SetDefaultParentByRootWindow(parent, bounds); | 683 window_->SetDefaultParentByRootWindow(parent, bounds); |
684 Show(); | 684 Show(); |
685 Focus(); | 685 Focus(); |
686 } | 686 } |
687 | 687 |
688 RenderWidgetHost* RenderWidgetHostViewAura::GetRenderWidgetHost() const { | 688 RenderWidgetHost* RenderWidgetHostViewAura::GetRenderWidgetHost() const { |
689 return host_; | 689 return host_; |
690 } | 690 } |
691 | 691 |
692 void RenderWidgetHostViewAura::WasShown() { | 692 void RenderWidgetHostViewAura::WasShown() { |
693 if (!host_->is_hidden()) | 693 if (!host_ || !host_->is_hidden()) |
piman
2013/09/20 16:51:30
Where is host_ reset? I can't find the code that d
| |
694 return; | 694 return; |
695 host_->WasShown(); | 695 host_->WasShown(); |
696 if (framebuffer_holder_) | 696 if (framebuffer_holder_) |
697 FrameMemoryManager::GetInstance()->SetFrameVisibility(this, true); | 697 FrameMemoryManager::GetInstance()->SetFrameVisibility(this, true); |
698 | 698 |
699 aura::client::CursorClient* cursor_client = | 699 aura::RootWindow* root = window_->GetRootWindow(); |
700 aura::client::GetCursorClient(window_->GetRootWindow()); | 700 if (root) { |
701 if (cursor_client) | 701 aura::client::CursorClient* cursor_client = |
702 NotifyRendererOfCursorVisibilityState(cursor_client->IsCursorVisible()); | 702 aura::client::GetCursorClient(root); |
703 if (cursor_client) | |
704 NotifyRendererOfCursorVisibilityState(cursor_client->IsCursorVisible()); | |
705 } | |
703 | 706 |
704 if (!current_surface_.get() && host_->is_accelerated_compositing_active() && | 707 if (!current_surface_.get() && host_->is_accelerated_compositing_active() && |
705 !released_front_lock_.get()) { | 708 !released_front_lock_.get()) { |
706 released_front_lock_ = GetCompositor()->GetCompositorLock(); | 709 ui::Compositor* compositor = GetCompositor(); |
710 if (compositor) | |
711 released_front_lock_ = compositor->GetCompositorLock(); | |
707 } | 712 } |
708 | 713 |
709 #if defined(OS_WIN) | 714 #if defined(OS_WIN) |
710 LPARAM lparam = reinterpret_cast<LPARAM>(this); | 715 LPARAM lparam = reinterpret_cast<LPARAM>(this); |
711 EnumChildWindows(ui::GetHiddenWindow(), ShowWindowsCallback, lparam); | 716 EnumChildWindows(ui::GetHiddenWindow(), ShowWindowsCallback, lparam); |
712 transient_observer_->SendPluginCutoutRects(); | 717 transient_observer_->SendPluginCutoutRects(); |
713 #endif | 718 #endif |
714 } | 719 } |
715 | 720 |
716 void RenderWidgetHostViewAura::WasHidden() { | 721 void RenderWidgetHostViewAura::WasHidden() { |
717 if (host_->is_hidden()) | 722 if (!host_ || host_->is_hidden()) |
718 return; | 723 return; |
719 host_->WasHidden(); | 724 host_->WasHidden(); |
720 if (framebuffer_holder_) | 725 if (framebuffer_holder_) |
721 FrameMemoryManager::GetInstance()->SetFrameVisibility(this, false); | 726 FrameMemoryManager::GetInstance()->SetFrameVisibility(this, false); |
722 | 727 |
723 released_front_lock_ = NULL; | 728 released_front_lock_ = NULL; |
724 | 729 |
725 #if defined(OS_WIN) | 730 #if defined(OS_WIN) |
726 aura::RootWindow* root_window = window_->GetRootWindow(); | 731 aura::RootWindow* root_window = window_->GetRootWindow(); |
727 if (root_window) { | 732 if (root_window) { |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
954 bool RenderWidgetHostViewAura::HasFocus() const { | 959 bool RenderWidgetHostViewAura::HasFocus() const { |
955 return window_->HasFocus(); | 960 return window_->HasFocus(); |
956 } | 961 } |
957 | 962 |
958 bool RenderWidgetHostViewAura::IsSurfaceAvailableForCopy() const { | 963 bool RenderWidgetHostViewAura::IsSurfaceAvailableForCopy() const { |
959 return CanCopyToBitmap() || !!host_->GetBackingStore(false); | 964 return CanCopyToBitmap() || !!host_->GetBackingStore(false); |
960 } | 965 } |
961 | 966 |
962 void RenderWidgetHostViewAura::Show() { | 967 void RenderWidgetHostViewAura::Show() { |
963 window_->Show(); | 968 window_->Show(); |
969 WasShown(); | |
964 } | 970 } |
965 | 971 |
966 void RenderWidgetHostViewAura::Hide() { | 972 void RenderWidgetHostViewAura::Hide() { |
967 window_->Hide(); | 973 window_->Hide(); |
974 WasHidden(); | |
968 } | 975 } |
969 | 976 |
970 bool RenderWidgetHostViewAura::IsShowing() { | 977 bool RenderWidgetHostViewAura::IsShowing() { |
971 return window_->IsVisible(); | 978 return window_->IsVisible(); |
972 } | 979 } |
973 | 980 |
974 gfx::Rect RenderWidgetHostViewAura::GetViewBounds() const { | 981 gfx::Rect RenderWidgetHostViewAura::GetViewBounds() const { |
975 // This is the size that we want the renderer to produce. While we're waiting | 982 // This is the size that we want the renderer to produce. While we're waiting |
976 // for the correct frame (i.e. during a resize), don't change the size so that | 983 // for the correct frame (i.e. during a resize), don't change the size so that |
977 // we don't pipeline more resizes than we can handle. | 984 // we don't pipeline more resizes than we can handle. |
(...skipping 2396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3374 RenderWidgetHost* widget) { | 3381 RenderWidgetHost* widget) { |
3375 return new RenderWidgetHostViewAura(widget); | 3382 return new RenderWidgetHostViewAura(widget); |
3376 } | 3383 } |
3377 | 3384 |
3378 // static | 3385 // static |
3379 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 3386 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { |
3380 GetScreenInfoForWindow(results, NULL); | 3387 GetScreenInfoForWindow(results, NULL); |
3381 } | 3388 } |
3382 | 3389 |
3383 } // namespace content | 3390 } // namespace content |
OLD | NEW |