| 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 DCHECK(host_); |
| 693 if (!host_->is_hidden()) | 694 if (!host_->is_hidden()) |
| 694 return; | 695 return; |
| 695 host_->WasShown(); | 696 host_->WasShown(); |
| 696 if (framebuffer_holder_) | 697 if (framebuffer_holder_) |
| 697 FrameMemoryManager::GetInstance()->SetFrameVisibility(this, true); | 698 FrameMemoryManager::GetInstance()->SetFrameVisibility(this, true); |
| 698 | 699 |
| 699 aura::client::CursorClient* cursor_client = | 700 aura::RootWindow* root = window_->GetRootWindow(); |
| 700 aura::client::GetCursorClient(window_->GetRootWindow()); | 701 if (root) { |
| 701 if (cursor_client) | 702 aura::client::CursorClient* cursor_client = |
| 702 NotifyRendererOfCursorVisibilityState(cursor_client->IsCursorVisible()); | 703 aura::client::GetCursorClient(root); |
| 704 if (cursor_client) |
| 705 NotifyRendererOfCursorVisibilityState(cursor_client->IsCursorVisible()); |
| 706 } |
| 703 | 707 |
| 704 if (!current_surface_.get() && host_->is_accelerated_compositing_active() && | 708 if (!current_surface_.get() && host_->is_accelerated_compositing_active() && |
| 705 !released_front_lock_.get()) { | 709 !released_front_lock_.get()) { |
| 706 released_front_lock_ = GetCompositor()->GetCompositorLock(); | 710 ui::Compositor* compositor = GetCompositor(); |
| 711 if (compositor) |
| 712 released_front_lock_ = compositor->GetCompositorLock(); |
| 707 } | 713 } |
| 708 | 714 |
| 709 #if defined(OS_WIN) | 715 #if defined(OS_WIN) |
| 710 LPARAM lparam = reinterpret_cast<LPARAM>(this); | 716 LPARAM lparam = reinterpret_cast<LPARAM>(this); |
| 711 EnumChildWindows(ui::GetHiddenWindow(), ShowWindowsCallback, lparam); | 717 EnumChildWindows(ui::GetHiddenWindow(), ShowWindowsCallback, lparam); |
| 712 transient_observer_->SendPluginCutoutRects(); | 718 transient_observer_->SendPluginCutoutRects(); |
| 713 #endif | 719 #endif |
| 714 } | 720 } |
| 715 | 721 |
| 716 void RenderWidgetHostViewAura::WasHidden() { | 722 void RenderWidgetHostViewAura::WasHidden() { |
| 717 if (host_->is_hidden()) | 723 if (!host_ || host_->is_hidden()) |
| 718 return; | 724 return; |
| 719 host_->WasHidden(); | 725 host_->WasHidden(); |
| 720 if (framebuffer_holder_) | 726 if (framebuffer_holder_) |
| 721 FrameMemoryManager::GetInstance()->SetFrameVisibility(this, false); | 727 FrameMemoryManager::GetInstance()->SetFrameVisibility(this, false); |
| 722 | 728 |
| 723 released_front_lock_ = NULL; | 729 released_front_lock_ = NULL; |
| 724 | 730 |
| 725 #if defined(OS_WIN) | 731 #if defined(OS_WIN) |
| 726 aura::RootWindow* root_window = window_->GetRootWindow(); | 732 aura::RootWindow* root_window = window_->GetRootWindow(); |
| 727 if (root_window) { | 733 if (root_window) { |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 954 bool RenderWidgetHostViewAura::HasFocus() const { | 960 bool RenderWidgetHostViewAura::HasFocus() const { |
| 955 return window_->HasFocus(); | 961 return window_->HasFocus(); |
| 956 } | 962 } |
| 957 | 963 |
| 958 bool RenderWidgetHostViewAura::IsSurfaceAvailableForCopy() const { | 964 bool RenderWidgetHostViewAura::IsSurfaceAvailableForCopy() const { |
| 959 return CanCopyToBitmap() || !!host_->GetBackingStore(false); | 965 return CanCopyToBitmap() || !!host_->GetBackingStore(false); |
| 960 } | 966 } |
| 961 | 967 |
| 962 void RenderWidgetHostViewAura::Show() { | 968 void RenderWidgetHostViewAura::Show() { |
| 963 window_->Show(); | 969 window_->Show(); |
| 970 WasShown(); |
| 964 } | 971 } |
| 965 | 972 |
| 966 void RenderWidgetHostViewAura::Hide() { | 973 void RenderWidgetHostViewAura::Hide() { |
| 967 window_->Hide(); | 974 window_->Hide(); |
| 975 WasHidden(); |
| 968 } | 976 } |
| 969 | 977 |
| 970 bool RenderWidgetHostViewAura::IsShowing() { | 978 bool RenderWidgetHostViewAura::IsShowing() { |
| 971 return window_->IsVisible(); | 979 return window_->IsVisible(); |
| 972 } | 980 } |
| 973 | 981 |
| 974 gfx::Rect RenderWidgetHostViewAura::GetViewBounds() const { | 982 gfx::Rect RenderWidgetHostViewAura::GetViewBounds() const { |
| 975 // This is the size that we want the renderer to produce. While we're waiting | 983 // 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 | 984 // 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. | 985 // 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) { | 3382 RenderWidgetHost* widget) { |
| 3375 return new RenderWidgetHostViewAura(widget); | 3383 return new RenderWidgetHostViewAura(widget); |
| 3376 } | 3384 } |
| 3377 | 3385 |
| 3378 // static | 3386 // static |
| 3379 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 3387 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { |
| 3380 GetScreenInfoForWindow(results, NULL); | 3388 GetScreenInfoForWindow(results, NULL); |
| 3381 } | 3389 } |
| 3382 | 3390 |
| 3383 } // namespace content | 3391 } // namespace content |
| OLD | NEW |