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