| 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" |
| 11 #include "content/public/browser/native_web_keyboard_event.h" | 11 #include "content/public/browser/native_web_keyboard_event.h" |
| 12 #include "content/common/gpu/gpu_messages.h" | 12 #include "content/common/gpu/gpu_messages.h" |
| 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
| 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" | 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" |
| 15 #include "ui/aura/client/aura_constants.h" | 15 #include "ui/aura/client/aura_constants.h" |
| 16 #include "ui/aura/client/tooltip_client.h" | 16 #include "ui/aura/client/tooltip_client.h" |
| 17 #include "ui/aura/client/window_types.h" |
| 17 #include "ui/aura/event.h" | 18 #include "ui/aura/event.h" |
| 18 #include "ui/aura/root_window.h" | 19 #include "ui/aura/root_window.h" |
| 19 #include "ui/aura/window.h" | 20 #include "ui/aura/window.h" |
| 20 #include "ui/aura/window_types.h" | |
| 21 #include "ui/base/hit_test.h" | 21 #include "ui/base/hit_test.h" |
| 22 #include "ui/base/ui_base_types.h" | 22 #include "ui/base/ui_base_types.h" |
| 23 #include "ui/gfx/canvas.h" | 23 #include "ui/gfx/canvas.h" |
| 24 #include "ui/gfx/compositor/layer.h" | 24 #include "ui/gfx/compositor/layer.h" |
| 25 #include "ui/gfx/screen.h" | 25 #include "ui/gfx/screen.h" |
| 26 | 26 |
| 27 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) | 27 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) |
| 28 #include "base/bind.h" | 28 #include "base/bind.h" |
| 29 #include "content/browser/renderer_host/accelerated_surface_container_linux.h" | 29 #include "content/browser/renderer_host/accelerated_surface_container_linux.h" |
| 30 #include "ui/gfx/gl/gl_bindings.h" | 30 #include "ui/gfx/gl/gl_bindings.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 : host_(host), | 92 : host_(host), |
| 93 ALLOW_THIS_IN_INITIALIZER_LIST(window_(new aura::Window(this))), | 93 ALLOW_THIS_IN_INITIALIZER_LIST(window_(new aura::Window(this))), |
| 94 is_fullscreen_(false), | 94 is_fullscreen_(false), |
| 95 popup_parent_host_view_(NULL), | 95 popup_parent_host_view_(NULL), |
| 96 is_loading_(false), | 96 is_loading_(false), |
| 97 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) | 97 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) |
| 98 current_surface_(gfx::kNullPluginWindow), | 98 current_surface_(gfx::kNullPluginWindow), |
| 99 #endif | 99 #endif |
| 100 skip_schedule_paint_(false) { | 100 skip_schedule_paint_(false) { |
| 101 host_->SetView(this); | 101 host_->SetView(this); |
| 102 window_->SetProperty(aura::kTooltipTextKey, &tooltip_); | 102 window_->SetProperty(aura::client::kTooltipTextKey, &tooltip_); |
| 103 aura::client::SetActivationDelegate(window_, this); | 103 aura::client::SetActivationDelegate(window_, this); |
| 104 } | 104 } |
| 105 | 105 |
| 106 RenderWidgetHostViewAura::~RenderWidgetHostViewAura() { | 106 RenderWidgetHostViewAura::~RenderWidgetHostViewAura() { |
| 107 } | 107 } |
| 108 | 108 |
| 109 void RenderWidgetHostViewAura::InitAsChild() { | 109 void RenderWidgetHostViewAura::InitAsChild() { |
| 110 window_->Init(ui::Layer::LAYER_HAS_TEXTURE); | 110 window_->Init(ui::Layer::LAYER_HAS_TEXTURE); |
| 111 window_->SetName("RenderWidgetHostViewAura"); | 111 window_->SetName("RenderWidgetHostViewAura"); |
| 112 } | 112 } |
| 113 | 113 |
| 114 //////////////////////////////////////////////////////////////////////////////// | 114 //////////////////////////////////////////////////////////////////////////////// |
| 115 // RenderWidgetHostViewAura, RenderWidgetHostView implementation: | 115 // RenderWidgetHostViewAura, RenderWidgetHostView implementation: |
| 116 | 116 |
| 117 void RenderWidgetHostViewAura::InitAsPopup( | 117 void RenderWidgetHostViewAura::InitAsPopup( |
| 118 RenderWidgetHostView* parent_host_view, | 118 RenderWidgetHostView* parent_host_view, |
| 119 const gfx::Rect& pos) { | 119 const gfx::Rect& pos) { |
| 120 popup_parent_host_view_ = | 120 popup_parent_host_view_ = |
| 121 static_cast<RenderWidgetHostViewAura*>(parent_host_view); | 121 static_cast<RenderWidgetHostViewAura*>(parent_host_view); |
| 122 window_->SetType(aura::WINDOW_TYPE_MENU); | 122 window_->SetType(aura::client::WINDOW_TYPE_MENU); |
| 123 window_->Init(ui::Layer::LAYER_HAS_TEXTURE); | 123 window_->Init(ui::Layer::LAYER_HAS_TEXTURE); |
| 124 window_->SetName("RenderWidgetHostViewAura"); | 124 window_->SetName("RenderWidgetHostViewAura"); |
| 125 | 125 |
| 126 window_->SetParent(NULL); | 126 window_->SetParent(NULL); |
| 127 Show(); | 127 Show(); |
| 128 | 128 |
| 129 // |pos| is in root window coordinates. So convert it to | 129 // |pos| is in root window coordinates. So convert it to |
| 130 // |popup_parent_host_view_|'s coordinates first. | 130 // |popup_parent_host_view_|'s coordinates first. |
| 131 gfx::Point origin = pos.origin(); | 131 gfx::Point origin = pos.origin(); |
| 132 aura::Window::ConvertPointToWindow( | 132 aura::Window::ConvertPointToWindow( |
| 133 aura::RootWindow::GetInstance(), | 133 aura::RootWindow::GetInstance(), |
| 134 popup_parent_host_view_->window_, &origin); | 134 popup_parent_host_view_->window_, &origin); |
| 135 SetBounds(gfx::Rect(origin, pos.size())); | 135 SetBounds(gfx::Rect(origin, pos.size())); |
| 136 } | 136 } |
| 137 | 137 |
| 138 void RenderWidgetHostViewAura::InitAsFullscreen( | 138 void RenderWidgetHostViewAura::InitAsFullscreen( |
| 139 RenderWidgetHostView* reference_host_view) { | 139 RenderWidgetHostView* reference_host_view) { |
| 140 is_fullscreen_ = true; | 140 is_fullscreen_ = true; |
| 141 window_->SetType(aura::WINDOW_TYPE_NORMAL); | 141 window_->SetType(aura::client::WINDOW_TYPE_NORMAL); |
| 142 window_->Init(ui::Layer::LAYER_HAS_TEXTURE); | 142 window_->Init(ui::Layer::LAYER_HAS_TEXTURE); |
| 143 window_->SetName("RenderWidgetHostViewAura"); | 143 window_->SetName("RenderWidgetHostViewAura"); |
| 144 window_->SetIntProperty(aura::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); | 144 window_->SetIntProperty(aura::client::kShowStateKey, |
| 145 ui::SHOW_STATE_FULLSCREEN); |
| 145 window_->SetParent(NULL); | 146 window_->SetParent(NULL); |
| 146 Show(); | 147 Show(); |
| 147 Focus(); | 148 Focus(); |
| 148 } | 149 } |
| 149 | 150 |
| 150 RenderWidgetHost* RenderWidgetHostViewAura::GetRenderWidgetHost() const { | 151 RenderWidgetHost* RenderWidgetHostViewAura::GetRenderWidgetHost() const { |
| 151 return host_; | 152 return host_; |
| 152 } | 153 } |
| 153 | 154 |
| 154 void RenderWidgetHostViewAura::DidBecomeSelected() { | 155 void RenderWidgetHostViewAura::DidBecomeSelected() { |
| (...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 // static | 631 // static |
| 631 void RenderWidgetHostView::GetDefaultScreenInfo( | 632 void RenderWidgetHostView::GetDefaultScreenInfo( |
| 632 WebKit::WebScreenInfo* results) { | 633 WebKit::WebScreenInfo* results) { |
| 633 const gfx::Size size = gfx::Screen::GetPrimaryMonitorSize(); | 634 const gfx::Size size = gfx::Screen::GetPrimaryMonitorSize(); |
| 634 results->rect = WebKit::WebRect(0, 0, size.width(), size.height()); | 635 results->rect = WebKit::WebRect(0, 0, size.width(), size.height()); |
| 635 results->availableRect = results->rect; | 636 results->availableRect = results->rect; |
| 636 // TODO(derat): Don't hardcode this? | 637 // TODO(derat): Don't hardcode this? |
| 637 results->depth = 24; | 638 results->depth = 24; |
| 638 results->depthPerComponent = 8; | 639 results->depthPerComponent = 8; |
| 639 } | 640 } |
| OLD | NEW |