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

Side by Side Diff: chrome/browser/ui/views/fullscreen_exit_bubble_views.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: new android code 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 "chrome/browser/ui/views/fullscreen_exit_bubble_views.h" 5 #include "chrome/browser/ui/views/fullscreen_exit_bubble_views.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/app/chrome_command_ids.h" 9 #include "chrome/app/chrome_command_ids.h"
10 #include "googleurl/src/gurl.h" 10 #include "googleurl/src/gurl.h"
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 void FullscreenExitBubbleViews::AnimationEnded( 333 void FullscreenExitBubbleViews::AnimationEnded(
334 const ui::Animation* animation) { 334 const ui::Animation* animation) {
335 AnimationProgressed(animation); 335 AnimationProgressed(animation);
336 } 336 }
337 337
338 gfx::Rect FullscreenExitBubbleViews::GetPopupRect( 338 gfx::Rect FullscreenExitBubbleViews::GetPopupRect(
339 bool ignore_animation_state) const { 339 bool ignore_animation_state) const {
340 gfx::Size size(view_->GetPreferredSize()); 340 gfx::Size size(view_->GetPreferredSize());
341 // NOTE: don't use the bounds of the root_view_. On linux changing window 341 // NOTE: don't use the bounds of the root_view_. On linux changing window
342 // size is async. Instead we use the size of the screen. 342 // size is async. Instead we use the size of the screen.
343 gfx::Rect screen_bounds = gfx::Screen::GetDisplayNearestWindow( 343 gfx::Screen* screen =
344 gfx::Screen::GetScreenFor(root_view_->GetWidget()->GetNativeView());
345 gfx::Rect screen_bounds = screen->GetDisplayNearestWindow(
344 root_view_->GetWidget()->GetNativeView()).bounds(); 346 root_view_->GetWidget()->GetNativeView()).bounds();
345 gfx::Point origin(screen_bounds.x() + 347 gfx::Point origin(screen_bounds.x() +
346 (screen_bounds.width() - size.width()) / 2, 348 (screen_bounds.width() - size.width()) / 2,
347 kPopupTopPx + screen_bounds.y()); 349 kPopupTopPx + screen_bounds.y());
348 if (!ignore_animation_state) { 350 if (!ignore_animation_state) {
349 int total_height = size.height() + kPopupTopPx; 351 int total_height = size.height() + kPopupTopPx;
350 int popup_bottom = size_animation_->CurrentValueBetween( 352 int popup_bottom = size_animation_->CurrentValueBetween(
351 static_cast<double>(total_height), 0.0f); 353 static_cast<double>(total_height), 0.0f);
352 int y_offset = std::min(popup_bottom, kPopupTopPx); 354 int y_offset = std::min(popup_bottom, kPopupTopPx);
353 size.set_height(size.height() - popup_bottom + y_offset); 355 size.set_height(size.height() - popup_bottom + y_offset);
354 origin.set_y(origin.y() - y_offset); 356 origin.set_y(origin.y() - y_offset);
355 } 357 }
356 return gfx::Rect(origin, size); 358 return gfx::Rect(origin, size);
357 } 359 }
358 360
359 gfx::Point FullscreenExitBubbleViews::GetCursorScreenPoint() { 361 gfx::Point FullscreenExitBubbleViews::GetCursorScreenPoint() {
360 gfx::Point cursor_pos = gfx::Screen::GetCursorScreenPoint(); 362 gfx::Point cursor_pos = gfx::Screen::GetScreenFor(
363 root_view_->GetWidget()->GetNativeView())->GetCursorScreenPoint();
361 views::View::ConvertPointToTarget(NULL, root_view_, &cursor_pos); 364 views::View::ConvertPointToTarget(NULL, root_view_, &cursor_pos);
362 return cursor_pos; 365 return cursor_pos;
363 } 366 }
364 367
365 bool FullscreenExitBubbleViews::WindowContainsPoint(gfx::Point pos) { 368 bool FullscreenExitBubbleViews::WindowContainsPoint(gfx::Point pos) {
366 return root_view_->HitTestPoint(pos); 369 return root_view_->HitTestPoint(pos);
367 } 370 }
368 371
369 bool FullscreenExitBubbleViews::IsWindowActive() { 372 bool FullscreenExitBubbleViews::IsWindowActive() {
370 return root_view_->GetWidget()->IsActive(); 373 return root_view_->GetWidget()->IsActive();
(...skipping 10 matching lines...) Expand all
381 } 384 }
382 385
383 bool FullscreenExitBubbleViews::IsAnimating() { 386 bool FullscreenExitBubbleViews::IsAnimating() {
384 return size_animation_->GetCurrentValue() != 0; 387 return size_animation_->GetCurrentValue() != 0;
385 } 388 }
386 389
387 void FullscreenExitBubbleViews::StartWatchingMouseIfNecessary() { 390 void FullscreenExitBubbleViews::StartWatchingMouseIfNecessary() {
388 if (!fullscreen_bubble::ShowButtonsForType(bubble_type_)) 391 if (!fullscreen_bubble::ShowButtonsForType(bubble_type_))
389 StartWatchingMouse(); 392 StartWatchingMouse();
390 } 393 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698