| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 skip_schedule_paint_(false) { | 99 skip_schedule_paint_(false) { |
| 100 host_->SetView(this); | 100 host_->SetView(this); |
| 101 window_->SetProperty(aura::kTooltipTextKey, &tooltip_); | 101 window_->SetProperty(aura::kTooltipTextKey, &tooltip_); |
| 102 } | 102 } |
| 103 | 103 |
| 104 RenderWidgetHostViewAura::~RenderWidgetHostViewAura() { | 104 RenderWidgetHostViewAura::~RenderWidgetHostViewAura() { |
| 105 } | 105 } |
| 106 | 106 |
| 107 void RenderWidgetHostViewAura::InitAsChild() { | 107 void RenderWidgetHostViewAura::InitAsChild() { |
| 108 window_->Init(ui::Layer::LAYER_HAS_TEXTURE); | 108 window_->Init(ui::Layer::LAYER_HAS_TEXTURE); |
| 109 window_->SetName("RenderWidgetHostViewAura"); |
| 109 } | 110 } |
| 110 | 111 |
| 111 //////////////////////////////////////////////////////////////////////////////// | 112 //////////////////////////////////////////////////////////////////////////////// |
| 112 // RenderWidgetHostViewAura, RenderWidgetHostView implementation: | 113 // RenderWidgetHostViewAura, RenderWidgetHostView implementation: |
| 113 | 114 |
| 114 void RenderWidgetHostViewAura::InitAsPopup( | 115 void RenderWidgetHostViewAura::InitAsPopup( |
| 115 RenderWidgetHostView* parent_host_view, | 116 RenderWidgetHostView* parent_host_view, |
| 116 const gfx::Rect& pos) { | 117 const gfx::Rect& pos) { |
| 117 popup_parent_host_view_ = | 118 popup_parent_host_view_ = |
| 118 static_cast<RenderWidgetHostViewAura*>(parent_host_view); | 119 static_cast<RenderWidgetHostViewAura*>(parent_host_view); |
| 119 window_->SetType(aura::WINDOW_TYPE_MENU); | 120 window_->SetType(aura::WINDOW_TYPE_MENU); |
| 120 window_->Init(ui::Layer::LAYER_HAS_TEXTURE); | 121 window_->Init(ui::Layer::LAYER_HAS_TEXTURE); |
| 122 window_->SetName("RenderWidgetHostViewAura"); |
| 121 | 123 |
| 122 window_->SetParent(NULL); | 124 window_->SetParent(NULL); |
| 123 Show(); | 125 Show(); |
| 124 | 126 |
| 125 // |pos| is in desktop coordinates. So convert it to | 127 // |pos| is in desktop coordinates. So convert it to |
| 126 // |popup_parent_host_view_|'s coordinates first. | 128 // |popup_parent_host_view_|'s coordinates first. |
| 127 gfx::Point origin = pos.origin(); | 129 gfx::Point origin = pos.origin(); |
| 128 aura::Window::ConvertPointToWindow( | 130 aura::Window::ConvertPointToWindow( |
| 129 aura::Desktop::GetInstance(), | 131 aura::Desktop::GetInstance(), |
| 130 popup_parent_host_view_->window_, &origin); | 132 popup_parent_host_view_->window_, &origin); |
| 131 SetBounds(gfx::Rect(origin, pos.size())); | 133 SetBounds(gfx::Rect(origin, pos.size())); |
| 132 } | 134 } |
| 133 | 135 |
| 134 void RenderWidgetHostViewAura::InitAsFullscreen( | 136 void RenderWidgetHostViewAura::InitAsFullscreen( |
| 135 RenderWidgetHostView* reference_host_view) { | 137 RenderWidgetHostView* reference_host_view) { |
| 136 is_fullscreen_ = true; | 138 is_fullscreen_ = true; |
| 137 window_->SetType(aura::WINDOW_TYPE_NORMAL); | 139 window_->SetType(aura::WINDOW_TYPE_NORMAL); |
| 138 window_->Init(ui::Layer::LAYER_HAS_TEXTURE); | 140 window_->Init(ui::Layer::LAYER_HAS_TEXTURE); |
| 141 window_->SetName("RenderWidgetHostViewAura"); |
| 139 window_->SetIntProperty(aura::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); | 142 window_->SetIntProperty(aura::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); |
| 140 window_->SetParent(NULL); | 143 window_->SetParent(NULL); |
| 141 Show(); | 144 Show(); |
| 142 Focus(); | 145 Focus(); |
| 143 } | 146 } |
| 144 | 147 |
| 145 RenderWidgetHost* RenderWidgetHostViewAura::GetRenderWidgetHost() const { | 148 RenderWidgetHost* RenderWidgetHostViewAura::GetRenderWidgetHost() const { |
| 146 return host_; | 149 return host_; |
| 147 } | 150 } |
| 148 | 151 |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 // static | 596 // static |
| 594 void RenderWidgetHostView::GetDefaultScreenInfo( | 597 void RenderWidgetHostView::GetDefaultScreenInfo( |
| 595 WebKit::WebScreenInfo* results) { | 598 WebKit::WebScreenInfo* results) { |
| 596 const gfx::Size size = gfx::Screen::GetPrimaryMonitorSize(); | 599 const gfx::Size size = gfx::Screen::GetPrimaryMonitorSize(); |
| 597 results->rect = WebKit::WebRect(0, 0, size.width(), size.height()); | 600 results->rect = WebKit::WebRect(0, 0, size.width(), size.height()); |
| 598 results->availableRect = results->rect; | 601 results->availableRect = results->rect; |
| 599 // TODO(derat): Don't hardcode this? | 602 // TODO(derat): Don't hardcode this? |
| 600 results->depth = 24; | 603 results->depth = 24; |
| 601 results->depthPerComponent = 8; | 604 results->depthPerComponent = 8; |
| 602 } | 605 } |
| OLD | NEW |