| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 skip_schedule_paint_(false) { | 106 skip_schedule_paint_(false) { |
| 107 host_->SetView(this); | 107 host_->SetView(this); |
| 108 window_->SetProperty(aura::kTooltipTextKey, &tooltip_); | 108 window_->SetProperty(aura::kTooltipTextKey, &tooltip_); |
| 109 } | 109 } |
| 110 | 110 |
| 111 RenderWidgetHostViewAura::~RenderWidgetHostViewAura() { | 111 RenderWidgetHostViewAura::~RenderWidgetHostViewAura() { |
| 112 } | 112 } |
| 113 | 113 |
| 114 void RenderWidgetHostViewAura::InitAsChild() { | 114 void RenderWidgetHostViewAura::InitAsChild() { |
| 115 window_->Init(ui::Layer::LAYER_HAS_TEXTURE); | 115 window_->Init(ui::Layer::LAYER_HAS_TEXTURE); |
| 116 window_->SetName("RenderWidgetHostViewAura"); |
| 116 } | 117 } |
| 117 | 118 |
| 118 //////////////////////////////////////////////////////////////////////////////// | 119 //////////////////////////////////////////////////////////////////////////////// |
| 119 // RenderWidgetHostViewAura, RenderWidgetHostView implementation: | 120 // RenderWidgetHostViewAura, RenderWidgetHostView implementation: |
| 120 | 121 |
| 121 void RenderWidgetHostViewAura::InitAsPopup( | 122 void RenderWidgetHostViewAura::InitAsPopup( |
| 122 RenderWidgetHostView* parent_host_view, | 123 RenderWidgetHostView* parent_host_view, |
| 123 const gfx::Rect& pos) { | 124 const gfx::Rect& pos) { |
| 124 popup_parent_host_view_ = | 125 popup_parent_host_view_ = |
| 125 static_cast<RenderWidgetHostViewAura*>(parent_host_view); | 126 static_cast<RenderWidgetHostViewAura*>(parent_host_view); |
| 126 window_->SetType(aura::WINDOW_TYPE_MENU); | 127 window_->SetType(aura::WINDOW_TYPE_MENU); |
| 127 window_->Init(ui::Layer::LAYER_HAS_TEXTURE); | 128 window_->Init(ui::Layer::LAYER_HAS_TEXTURE); |
| 129 window_->SetName("RenderWidgetHostViewAura"); |
| 128 | 130 |
| 129 window_->SetParent(NULL); | 131 window_->SetParent(NULL); |
| 130 Show(); | 132 Show(); |
| 131 | 133 |
| 132 // |pos| is in desktop coordinates. So convert it to | 134 // |pos| is in desktop coordinates. So convert it to |
| 133 // |popup_parent_host_view_|'s coordinates first. | 135 // |popup_parent_host_view_|'s coordinates first. |
| 134 gfx::Point origin = pos.origin(); | 136 gfx::Point origin = pos.origin(); |
| 135 aura::Window::ConvertPointToWindow( | 137 aura::Window::ConvertPointToWindow( |
| 136 aura::Desktop::GetInstance(), | 138 aura::Desktop::GetInstance(), |
| 137 popup_parent_host_view_->window_, &origin); | 139 popup_parent_host_view_->window_, &origin); |
| 138 SetBounds(gfx::Rect(origin, pos.size())); | 140 SetBounds(gfx::Rect(origin, pos.size())); |
| 139 } | 141 } |
| 140 | 142 |
| 141 void RenderWidgetHostViewAura::InitAsFullscreen( | 143 void RenderWidgetHostViewAura::InitAsFullscreen( |
| 142 RenderWidgetHostView* reference_host_view) { | 144 RenderWidgetHostView* reference_host_view) { |
| 143 is_fullscreen_ = true; | 145 is_fullscreen_ = true; |
| 144 window_->SetType(aura::WINDOW_TYPE_NORMAL); | 146 window_->SetType(aura::WINDOW_TYPE_NORMAL); |
| 145 window_->Init(ui::Layer::LAYER_HAS_TEXTURE); | 147 window_->Init(ui::Layer::LAYER_HAS_TEXTURE); |
| 148 window_->SetName("RenderWidgetHostViewAura"); |
| 146 window_->SetIntProperty(aura::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); | 149 window_->SetIntProperty(aura::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); |
| 147 window_->SetParent(NULL); | 150 window_->SetParent(NULL); |
| 148 Show(); | 151 Show(); |
| 149 Focus(); | 152 Focus(); |
| 150 } | 153 } |
| 151 | 154 |
| 152 RenderWidgetHost* RenderWidgetHostViewAura::GetRenderWidgetHost() const { | 155 RenderWidgetHost* RenderWidgetHostViewAura::GetRenderWidgetHost() const { |
| 153 return host_; | 156 return host_; |
| 154 } | 157 } |
| 155 | 158 |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 // static | 544 // static |
| 542 void RenderWidgetHostView::GetDefaultScreenInfo( | 545 void RenderWidgetHostView::GetDefaultScreenInfo( |
| 543 WebKit::WebScreenInfo* results) { | 546 WebKit::WebScreenInfo* results) { |
| 544 const gfx::Size size = gfx::Screen::GetPrimaryMonitorSize(); | 547 const gfx::Size size = gfx::Screen::GetPrimaryMonitorSize(); |
| 545 results->rect = WebKit::WebRect(0, 0, size.width(), size.height()); | 548 results->rect = WebKit::WebRect(0, 0, size.width(), size.height()); |
| 546 results->availableRect = results->rect; | 549 results->availableRect = results->rect; |
| 547 // TODO(derat): Don't hardcode this? | 550 // TODO(derat): Don't hardcode this? |
| 548 results->depth = 24; | 551 results->depth = 24; |
| 549 results->depthPerComponent = 8; | 552 results->depthPerComponent = 8; |
| 550 } | 553 } |
| OLD | NEW |