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/logging.h" | 7 #include "base/logging.h" |
8 #include "content/browser/renderer_host/backing_store_skia.h" | 8 #include "content/browser/renderer_host/backing_store_skia.h" |
9 #include "content/browser/renderer_host/render_widget_host.h" | 9 #include "content/browser/renderer_host/render_widget_host.h" |
10 #include "content/browser/renderer_host/web_input_event_aura.h" | 10 #include "content/browser/renderer_host/web_input_event_aura.h" |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 if (compositor && compositor->HasObserver(this)) | 135 if (compositor && compositor->HasObserver(this)) |
136 compositor->RemoveObserver(this); | 136 compositor->RemoveObserver(this); |
137 #endif | 137 #endif |
138 } | 138 } |
139 | 139 |
140 //////////////////////////////////////////////////////////////////////////////// | 140 //////////////////////////////////////////////////////////////////////////////// |
141 // RenderWidgetHostViewAura, RenderWidgetHostView implementation: | 141 // RenderWidgetHostViewAura, RenderWidgetHostView implementation: |
142 | 142 |
143 void RenderWidgetHostViewAura::InitAsChild( | 143 void RenderWidgetHostViewAura::InitAsChild( |
144 gfx::NativeView parent_view) { | 144 gfx::NativeView parent_view) { |
145 window_->Init(ui::Layer::LAYER_HAS_TEXTURE); | 145 window_->Init(ui::Layer::LAYER_TEXTURED); |
146 window_->SetName("RenderWidgetHostViewAura"); | 146 window_->SetName("RenderWidgetHostViewAura"); |
147 } | 147 } |
148 | 148 |
149 void RenderWidgetHostViewAura::InitAsPopup( | 149 void RenderWidgetHostViewAura::InitAsPopup( |
150 RenderWidgetHostView* parent_host_view, | 150 RenderWidgetHostView* parent_host_view, |
151 const gfx::Rect& pos) { | 151 const gfx::Rect& pos) { |
152 popup_parent_host_view_ = | 152 popup_parent_host_view_ = |
153 static_cast<RenderWidgetHostViewAura*>(parent_host_view); | 153 static_cast<RenderWidgetHostViewAura*>(parent_host_view); |
154 popup_parent_host_view_->popup_child_host_view_ = this; | 154 popup_parent_host_view_->popup_child_host_view_ = this; |
155 window_->SetType(aura::client::WINDOW_TYPE_MENU); | 155 window_->SetType(aura::client::WINDOW_TYPE_MENU); |
156 window_->Init(ui::Layer::LAYER_HAS_TEXTURE); | 156 window_->Init(ui::Layer::LAYER_TEXTURED); |
157 window_->SetName("RenderWidgetHostViewAura"); | 157 window_->SetName("RenderWidgetHostViewAura"); |
158 | 158 |
159 window_->SetParent(NULL); | 159 window_->SetParent(NULL); |
160 Show(); | 160 Show(); |
161 | 161 |
162 // |pos| is in root window coordinates. So convert it to | 162 // |pos| is in root window coordinates. So convert it to |
163 // |popup_parent_host_view_|'s coordinates first. | 163 // |popup_parent_host_view_|'s coordinates first. |
164 gfx::Point origin = pos.origin(); | 164 gfx::Point origin = pos.origin(); |
165 aura::Window::ConvertPointToWindow( | 165 aura::Window::ConvertPointToWindow( |
166 aura::RootWindow::GetInstance(), | 166 aura::RootWindow::GetInstance(), |
167 popup_parent_host_view_->window_, &origin); | 167 popup_parent_host_view_->window_, &origin); |
168 SetBounds(gfx::Rect(origin, pos.size())); | 168 SetBounds(gfx::Rect(origin, pos.size())); |
169 } | 169 } |
170 | 170 |
171 void RenderWidgetHostViewAura::InitAsFullscreen( | 171 void RenderWidgetHostViewAura::InitAsFullscreen( |
172 RenderWidgetHostView* reference_host_view) { | 172 RenderWidgetHostView* reference_host_view) { |
173 is_fullscreen_ = true; | 173 is_fullscreen_ = true; |
174 window_->SetType(aura::client::WINDOW_TYPE_NORMAL); | 174 window_->SetType(aura::client::WINDOW_TYPE_NORMAL); |
175 window_->Init(ui::Layer::LAYER_HAS_TEXTURE); | 175 window_->Init(ui::Layer::LAYER_TEXTURED); |
176 window_->SetName("RenderWidgetHostViewAura"); | 176 window_->SetName("RenderWidgetHostViewAura"); |
177 window_->SetIntProperty(aura::client::kShowStateKey, | 177 window_->SetIntProperty(aura::client::kShowStateKey, |
178 ui::SHOW_STATE_FULLSCREEN); | 178 ui::SHOW_STATE_FULLSCREEN); |
179 window_->SetParent(NULL); | 179 window_->SetParent(NULL); |
180 Show(); | 180 Show(); |
181 Focus(); | 181 Focus(); |
182 } | 182 } |
183 | 183 |
184 RenderWidgetHost* RenderWidgetHostViewAura::GetRenderWidgetHost() const { | 184 RenderWidgetHost* RenderWidgetHostViewAura::GetRenderWidgetHost() const { |
185 return host_; | 185 return host_; |
(...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1058 // static | 1058 // static |
1059 void RenderWidgetHostView::GetDefaultScreenInfo( | 1059 void RenderWidgetHostView::GetDefaultScreenInfo( |
1060 WebKit::WebScreenInfo* results) { | 1060 WebKit::WebScreenInfo* results) { |
1061 const gfx::Size size = gfx::Screen::GetPrimaryMonitorSize(); | 1061 const gfx::Size size = gfx::Screen::GetPrimaryMonitorSize(); |
1062 results->rect = WebKit::WebRect(0, 0, size.width(), size.height()); | 1062 results->rect = WebKit::WebRect(0, 0, size.width(), size.height()); |
1063 results->availableRect = results->rect; | 1063 results->availableRect = results->rect; |
1064 // TODO(derat): Don't hardcode this? | 1064 // TODO(derat): Don't hardcode this? |
1065 results->depth = 24; | 1065 results->depth = 24; |
1066 results->depthPerComponent = 8; | 1066 results->depthPerComponent = 8; |
1067 } | 1067 } |
OLD | NEW |