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