| 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 <set> | 7 #include <set> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 951 #endif // defined(OS_WIN) | 951 #endif // defined(OS_WIN) |
| 952 } | 952 } |
| 953 | 953 |
| 954 void RenderWidgetHostViewAura::Focus() { | 954 void RenderWidgetHostViewAura::Focus() { |
| 955 // Make sure we have a FocusClient before attempting to Focus(). In some | 955 // Make sure we have a FocusClient before attempting to Focus(). In some |
| 956 // situations we may not yet be in a valid Window hierarchy (such as reloading | 956 // situations we may not yet be in a valid Window hierarchy (such as reloading |
| 957 // after out of memory discarded the tab). | 957 // after out of memory discarded the tab). |
| 958 aura::client::FocusClient* client = aura::client::GetFocusClient(window_); | 958 aura::client::FocusClient* client = aura::client::GetFocusClient(window_); |
| 959 if (client) | 959 if (client) |
| 960 window_->Focus(); | 960 window_->Focus(); |
| 961 |
| 962 // XXX This is for testing, it has to be moved to a unit or browser test. |
| 963 // Which would call: |
| 964 // content::RenderWidgetHostView->SetBackgroundColor(SK_ColorTRANSPARENT) |
| 965 // content::RenderWidgetHostView->SetBackgroundOpaque(true) |
| 966 SetBackgroundColor(SK_ColorTRANSPARENT); |
| 967 SetBackgroundOpaque(true); |
| 961 } | 968 } |
| 962 | 969 |
| 963 bool RenderWidgetHostViewAura::HasFocus() const { | 970 bool RenderWidgetHostViewAura::HasFocus() const { |
| 964 return window_->HasFocus(); | 971 return window_->HasFocus(); |
| 965 } | 972 } |
| 966 | 973 |
| 967 bool RenderWidgetHostViewAura::IsSurfaceAvailableForCopy() const { | 974 bool RenderWidgetHostViewAura::IsSurfaceAvailableForCopy() const { |
| 968 return delegated_frame_host_->CanCopyToBitmap(); | 975 return delegated_frame_host_->CanCopyToBitmap(); |
| 969 } | 976 } |
| 970 | 977 |
| 971 bool RenderWidgetHostViewAura::IsShowing() { | 978 bool RenderWidgetHostViewAura::IsShowing() { |
| 972 return window_->IsVisible(); | 979 return window_->IsVisible(); |
| 973 } | 980 } |
| 974 | 981 |
| 975 gfx::Rect RenderWidgetHostViewAura::GetViewBounds() const { | 982 gfx::Rect RenderWidgetHostViewAura::GetViewBounds() const { |
| 976 return window_->GetBoundsInScreen(); | 983 return window_->GetBoundsInScreen(); |
| 977 } | 984 } |
| 978 | 985 |
| 979 void RenderWidgetHostViewAura::SetBackgroundColor(SkColor color) { | 986 void RenderWidgetHostViewAura::SetBackgroundColor(SkColor color) { |
| 980 RenderWidgetHostViewBase::SetBackgroundColor(color); | 987 RenderWidgetHostViewBase::SetBackgroundColor(color); |
| 981 bool opaque = GetBackgroundOpaque(); | 988 host_->SetBackgroundColor(color); |
| 982 host_->SetBackgroundOpaque(opaque); | |
| 983 window_->layer()->SetFillsBoundsOpaquely(opaque); | |
| 984 window_->layer()->SetColor(color); | 989 window_->layer()->SetColor(color); |
| 985 } | 990 } |
| 986 | 991 |
| 992 void RenderWidgetHostViewAura::SetBackgroundOpaque(bool opaque) { |
| 993 RenderWidgetHostViewBase::SetBackgroundOpaque(opaque); |
| 994 host_->SetBackgroundOpaque(opaque); |
| 995 window_->layer()->SetFillsBoundsOpaquely(opaque); |
| 996 } |
| 997 |
| 987 gfx::Size RenderWidgetHostViewAura::GetVisibleViewportSize() const { | 998 gfx::Size RenderWidgetHostViewAura::GetVisibleViewportSize() const { |
| 988 gfx::Rect requested_rect(GetRequestedRendererSize()); | 999 gfx::Rect requested_rect(GetRequestedRendererSize()); |
| 989 requested_rect.Inset(insets_); | 1000 requested_rect.Inset(insets_); |
| 990 return requested_rect.size(); | 1001 return requested_rect.size(); |
| 991 } | 1002 } |
| 992 | 1003 |
| 993 void RenderWidgetHostViewAura::SetInsets(const gfx::Insets& insets) { | 1004 void RenderWidgetHostViewAura::SetInsets(const gfx::Insets& insets) { |
| 994 if (insets != insets_) { | 1005 if (insets != insets_) { |
| 995 insets_ = insets; | 1006 insets_ = insets; |
| 996 host_->WasResized(); | 1007 host_->WasResized(); |
| (...skipping 2113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3110 | 3121 |
| 3111 //////////////////////////////////////////////////////////////////////////////// | 3122 //////////////////////////////////////////////////////////////////////////////// |
| 3112 // RenderWidgetHostViewBase, public: | 3123 // RenderWidgetHostViewBase, public: |
| 3113 | 3124 |
| 3114 // static | 3125 // static |
| 3115 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { | 3126 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { |
| 3116 GetScreenInfoForWindow(results, NULL); | 3127 GetScreenInfoForWindow(results, NULL); |
| 3117 } | 3128 } |
| 3118 | 3129 |
| 3119 } // namespace content | 3130 } // namespace content |
| OLD | NEW |