Chromium Code Reviews| 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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 166 RenderWidgetHostView* parent_host_view, | 166 RenderWidgetHostView* parent_host_view, |
| 167 const gfx::Rect& pos) { | 167 const gfx::Rect& pos) { |
| 168 popup_parent_host_view_ = | 168 popup_parent_host_view_ = |
| 169 static_cast<RenderWidgetHostViewAura*>(parent_host_view); | 169 static_cast<RenderWidgetHostViewAura*>(parent_host_view); |
| 170 popup_parent_host_view_->popup_child_host_view_ = this; | 170 popup_parent_host_view_->popup_child_host_view_ = this; |
| 171 window_->SetType(aura::client::WINDOW_TYPE_MENU); | 171 window_->SetType(aura::client::WINDOW_TYPE_MENU); |
| 172 window_->Init(ui::Layer::LAYER_TEXTURED); | 172 window_->Init(ui::Layer::LAYER_TEXTURED); |
| 173 window_->SetName("RenderWidgetHostViewAura"); | 173 window_->SetName("RenderWidgetHostViewAura"); |
| 174 | 174 |
| 175 window_->SetParent(NULL); | 175 window_->SetParent(NULL); |
| 176 SetBounds(pos); | |
| 176 Show(); | 177 Show(); |
| 177 | |
| 178 // |pos| is in root window coordinates. So convert it to | |
| 179 // |popup_parent_host_view_|'s coordinates first. | |
| 180 gfx::Point origin = pos.origin(); | |
| 181 aura::Window::ConvertPointToWindow( | |
| 182 window_->GetRootWindow(), | |
| 183 popup_parent_host_view_->window_, &origin); | |
| 184 SetBounds(gfx::Rect(origin, pos.size())); | |
| 185 } | 178 } |
| 186 | 179 |
| 187 void RenderWidgetHostViewAura::InitAsFullscreen( | 180 void RenderWidgetHostViewAura::InitAsFullscreen( |
| 188 RenderWidgetHostView* reference_host_view) { | 181 RenderWidgetHostView* reference_host_view) { |
| 189 is_fullscreen_ = true; | 182 is_fullscreen_ = true; |
| 190 window_->SetType(aura::client::WINDOW_TYPE_NORMAL); | 183 window_->SetType(aura::client::WINDOW_TYPE_NORMAL); |
| 191 window_->Init(ui::Layer::LAYER_TEXTURED); | 184 window_->Init(ui::Layer::LAYER_TEXTURED); |
| 192 window_->SetName("RenderWidgetHostViewAura"); | 185 window_->SetName("RenderWidgetHostViewAura"); |
| 193 window_->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); | 186 window_->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); |
| 194 window_->SetParent(NULL); | 187 window_->SetParent(NULL); |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 207 void RenderWidgetHostViewAura::WasHidden() { | 200 void RenderWidgetHostViewAura::WasHidden() { |
| 208 host_->WasHidden(); | 201 host_->WasHidden(); |
| 209 } | 202 } |
| 210 | 203 |
| 211 void RenderWidgetHostViewAura::SetSize(const gfx::Size& size) { | 204 void RenderWidgetHostViewAura::SetSize(const gfx::Size& size) { |
| 212 SetBounds(gfx::Rect(window_->bounds().origin(), size)); | 205 SetBounds(gfx::Rect(window_->bounds().origin(), size)); |
| 213 } | 206 } |
| 214 | 207 |
| 215 void RenderWidgetHostViewAura::SetBounds(const gfx::Rect& rect) { | 208 void RenderWidgetHostViewAura::SetBounds(const gfx::Rect& rect) { |
| 216 gfx::Rect adjusted_rect = rect; | 209 gfx::Rect adjusted_rect = rect; |
| 217 | |
| 218 if (popup_parent_host_view_) { | |
| 219 gfx::Point translated_origin = adjusted_rect.origin(); | |
| 220 // |rect| is relative to |popup_parent_host_view_|; translate it for the | |
| 221 // window's container. | |
| 222 aura::Window::ConvertPointToWindow( | |
| 223 popup_parent_host_view_->window_, | |
| 224 window_->parent(), | |
| 225 &translated_origin); | |
| 226 adjusted_rect.set_origin(translated_origin); | |
| 227 } | |
| 228 | |
| 229 window_->SetBounds(adjusted_rect); | 210 window_->SetBounds(adjusted_rect); |
|
tfarina
2012/02/29 16:35:59
nit: you don't need the temp here too. Just do:
wi
yoshiki
2012/03/01 03:05:10
Done.
| |
| 230 host_->WasResized(); | 211 host_->WasResized(); |
| 231 } | 212 } |
| 232 | 213 |
| 233 gfx::NativeView RenderWidgetHostViewAura::GetNativeView() const { | 214 gfx::NativeView RenderWidgetHostViewAura::GetNativeView() const { |
| 234 return window_; | 215 return window_; |
| 235 } | 216 } |
| 236 | 217 |
| 237 gfx::NativeViewId RenderWidgetHostViewAura::GetNativeViewId() const { | 218 gfx::NativeViewId RenderWidgetHostViewAura::GetNativeViewId() const { |
| 238 return static_cast<gfx::NativeViewId>(NULL); | 219 return static_cast<gfx::NativeViewId>(NULL); |
| 239 } | 220 } |
| (...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1090 // static | 1071 // static |
| 1091 void content::RenderWidgetHostViewPort::GetDefaultScreenInfo( | 1072 void content::RenderWidgetHostViewPort::GetDefaultScreenInfo( |
| 1092 WebKit::WebScreenInfo* results) { | 1073 WebKit::WebScreenInfo* results) { |
| 1093 const gfx::Size size = gfx::Screen::GetPrimaryMonitorSize(); | 1074 const gfx::Size size = gfx::Screen::GetPrimaryMonitorSize(); |
| 1094 results->rect = WebKit::WebRect(0, 0, size.width(), size.height()); | 1075 results->rect = WebKit::WebRect(0, 0, size.width(), size.height()); |
| 1095 results->availableRect = results->rect; | 1076 results->availableRect = results->rect; |
| 1096 // TODO(derat): Don't hardcode this? | 1077 // TODO(derat): Don't hardcode this? |
| 1097 results->depth = 24; | 1078 results->depth = 24; |
| 1098 results->depthPerComponent = 8; | 1079 results->depthPerComponent = 8; |
| 1099 } | 1080 } |
| OLD | NEW |