OLD | NEW |
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 Loading... |
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::GetMonitorAreaNearestWindow( | 343 gfx::Rect screen_bounds = gfx::Screen::GetMonitorNearestWindow( |
344 root_view_->GetWidget()->GetNativeView()); | 344 root_view_->GetWidget()->GetNativeView()).bounds(); |
345 gfx::Point origin(screen_bounds.x() + | 345 gfx::Point origin(screen_bounds.x() + |
346 (screen_bounds.width() - size.width()) / 2, | 346 (screen_bounds.width() - size.width()) / 2, |
347 kPopupTopPx + screen_bounds.y()); | 347 kPopupTopPx + screen_bounds.y()); |
348 if (!ignore_animation_state) { | 348 if (!ignore_animation_state) { |
349 int total_height = size.height() + kPopupTopPx; | 349 int total_height = size.height() + kPopupTopPx; |
350 int popup_bottom = size_animation_->CurrentValueBetween( | 350 int popup_bottom = size_animation_->CurrentValueBetween( |
351 static_cast<double>(total_height), 0.0f); | 351 static_cast<double>(total_height), 0.0f); |
352 int y_offset = std::min(popup_bottom, kPopupTopPx); | 352 int y_offset = std::min(popup_bottom, kPopupTopPx); |
353 size.set_height(size.height() - popup_bottom + y_offset); | 353 size.set_height(size.height() - popup_bottom + y_offset); |
354 origin.set_y(origin.y() - y_offset); | 354 origin.set_y(origin.y() - y_offset); |
(...skipping 26 matching lines...) Expand all Loading... |
381 } | 381 } |
382 | 382 |
383 bool FullscreenExitBubbleViews::IsAnimating() { | 383 bool FullscreenExitBubbleViews::IsAnimating() { |
384 return size_animation_->GetCurrentValue() != 0; | 384 return size_animation_->GetCurrentValue() != 0; |
385 } | 385 } |
386 | 386 |
387 void FullscreenExitBubbleViews::StartWatchingMouseIfNecessary() { | 387 void FullscreenExitBubbleViews::StartWatchingMouseIfNecessary() { |
388 if (!fullscreen_bubble::ShowButtonsForType(bubble_type_)) | 388 if (!fullscreen_bubble::ShowButtonsForType(bubble_type_)) |
389 StartWatchingMouse(); | 389 StartWatchingMouse(); |
390 } | 390 } |
OLD | NEW |