Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 11030017: Add context to gfx::Screen calls in support of simultaneous desktop+ash (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix some new gfx::Screen additions Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 return false; 139 return false;
140 default: 140 default:
141 break; 141 break;
142 } 142 }
143 #endif 143 #endif
144 return true; 144 return true;
145 } 145 }
146 146
147 void GetScreenInfoForWindow(WebScreenInfo* results, aura::Window* window) { 147 void GetScreenInfoForWindow(WebScreenInfo* results, aura::Window* window) {
148 const gfx::Display display = window ? 148 const gfx::Display display = window ?
149 gfx::Screen::GetDisplayNearestWindow(window) : 149 gfx::Screen::GetScreenFor(window)->GetDisplayNearestWindow(window) :
150 gfx::Screen::GetPrimaryDisplay(); 150 gfx::Screen::GetScreenFor(window)->GetPrimaryDisplay();
151 const gfx::Size size = display.size(); 151 const gfx::Size size = display.size();
152 results->rect = WebKit::WebRect(0, 0, size.width(), size.height()); 152 results->rect = WebKit::WebRect(0, 0, size.width(), size.height());
153 results->availableRect = results->rect; 153 results->availableRect = results->rect;
154 // TODO(derat|oshima): Don't hardcode this. Get this from display object. 154 // TODO(derat|oshima): Don't hardcode this. Get this from display object.
155 results->depth = 24; 155 results->depth = 24;
156 results->depthPerComponent = 8; 156 results->depthPerComponent = 8;
157 int default_dpi = display.device_scale_factor() * 160; 157 int default_dpi = display.device_scale_factor() * 160;
158 results->verticalDPI = default_dpi; 158 results->verticalDPI = default_dpi;
159 results->horizontalDPI = default_dpi; 159 results->horizontalDPI = default_dpi;
160 } 160 }
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 window_->SetName("RenderWidgetHostViewAura"); 312 window_->SetName("RenderWidgetHostViewAura");
313 window_->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); 313 window_->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
314 aura::Window* parent = NULL; 314 aura::Window* parent = NULL;
315 if (reference_host_view) { 315 if (reference_host_view) {
316 aura::Window* reference_window = 316 aura::Window* reference_window =
317 static_cast<RenderWidgetHostViewAura*>(reference_host_view)->window_; 317 static_cast<RenderWidgetHostViewAura*>(reference_host_view)->window_;
318 if (reference_window) { 318 if (reference_window) {
319 host_tracker_.reset(new aura::WindowTracker); 319 host_tracker_.reset(new aura::WindowTracker);
320 host_tracker_->Add(reference_window); 320 host_tracker_->Add(reference_window);
321 } 321 }
322 gfx::Display display = 322 gfx::Display display = gfx::Screen::GetScreenFor(window_)->
323 gfx::Screen::GetDisplayNearestWindow(reference_window); 323 GetDisplayNearestWindow(reference_window);
324 aura::client::StackingClient* stacking_client = 324 aura::client::StackingClient* stacking_client =
325 aura::client::GetStackingClient(); 325 aura::client::GetStackingClient();
326 if (stacking_client) 326 if (stacking_client)
327 parent = stacking_client->GetDefaultParent(window_, display.bounds()); 327 parent = stacking_client->GetDefaultParent(window_, display.bounds());
328 } 328 }
329 window_->SetParent(parent); 329 window_->SetParent(parent);
330 Show(); 330 Show();
331 Focus(); 331 Focus();
332 } 332 }
333 333
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 bool RenderWidgetHostViewAura::IsShowing() { 489 bool RenderWidgetHostViewAura::IsShowing() {
490 return window_->IsVisible(); 490 return window_->IsVisible();
491 } 491 }
492 492
493 gfx::Rect RenderWidgetHostViewAura::GetViewBounds() const { 493 gfx::Rect RenderWidgetHostViewAura::GetViewBounds() const {
494 return window_->GetBoundsInScreen(); 494 return window_->GetBoundsInScreen();
495 } 495 }
496 496
497 void RenderWidgetHostViewAura::UpdateCursor(const WebCursor& cursor) { 497 void RenderWidgetHostViewAura::UpdateCursor(const WebCursor& cursor) {
498 current_cursor_ = cursor; 498 current_cursor_ = cursor;
499 const gfx::Display display = gfx::Screen::GetDisplayNearestWindow(window_); 499 const gfx::Display display = gfx::Screen::GetScreenFor(window_)->
500 GetDisplayNearestWindow(window_);
500 current_cursor_.SetScaleFactor(display.device_scale_factor()); 501 current_cursor_.SetScaleFactor(display.device_scale_factor());
501 UpdateCursorIfOverSelf(); 502 UpdateCursorIfOverSelf();
502 } 503 }
503 504
504 void RenderWidgetHostViewAura::SetIsLoading(bool is_loading) { 505 void RenderWidgetHostViewAura::SetIsLoading(bool is_loading) {
505 is_loading_ = is_loading; 506 is_loading_ = is_loading;
506 UpdateCursorIfOverSelf(); 507 UpdateCursorIfOverSelf();
507 } 508 }
508 509
509 void RenderWidgetHostViewAura::TextInputStateChanged( 510 void RenderWidgetHostViewAura::TextInputStateChanged(
(...skipping 1189 matching lines...) Expand 10 before | Expand all | Expand 10 after
1699 for (size_t i = 0; i != pending_thumbnail_tasks_.size(); ++i) 1700 for (size_t i = 0; i != pending_thumbnail_tasks_.size(); ++i)
1700 pending_thumbnail_tasks_[i].Run(false); 1701 pending_thumbnail_tasks_[i].Run(false);
1701 1702
1702 // This call is usually no-op since |this| object is already removed from the 1703 // This call is usually no-op since |this| object is already removed from the
1703 // Aura root window and we don't have a way to get an input method object 1704 // Aura root window and we don't have a way to get an input method object
1704 // associated with the window, but just in case. 1705 // associated with the window, but just in case.
1705 DetachFromInputMethod(); 1706 DetachFromInputMethod();
1706 } 1707 }
1707 1708
1708 void RenderWidgetHostViewAura::UpdateCursorIfOverSelf() { 1709 void RenderWidgetHostViewAura::UpdateCursorIfOverSelf() {
1709 const gfx::Point screen_point = gfx::Screen::GetCursorScreenPoint(); 1710 const gfx::Point screen_point =
1711 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint();
1710 aura::RootWindow* root_window = window_->GetRootWindow(); 1712 aura::RootWindow* root_window = window_->GetRootWindow();
1711 if (!root_window) 1713 if (!root_window)
1712 return; 1714 return;
1713 1715
1714 gfx::Rect screen_rect = GetViewBounds(); 1716 gfx::Rect screen_rect = GetViewBounds();
1715 gfx::Point local_point = screen_point; 1717 gfx::Point local_point = screen_point;
1716 local_point.Offset(-screen_rect.x(), -screen_rect.y()); 1718 local_point.Offset(-screen_rect.x(), -screen_rect.y());
1717 1719
1718 if (root_window->GetEventHandlerForPoint(local_point) != window_) 1720 if (root_window->GetEventHandlerForPoint(local_point) != window_)
1719 return; 1721 return;
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
1874 RenderWidgetHost* widget) { 1876 RenderWidgetHost* widget) {
1875 return new RenderWidgetHostViewAura(widget); 1877 return new RenderWidgetHostViewAura(widget);
1876 } 1878 }
1877 1879
1878 // static 1880 // static
1879 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { 1881 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) {
1880 GetScreenInfoForWindow(results, NULL); 1882 GetScreenInfoForWindow(results, NULL);
1881 } 1883 }
1882 1884
1883 } // namespace content 1885 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698