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/notifications/balloon_collection_impl.h" | 5 #include "chrome/browser/notifications/balloon_collection_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "chrome/browser/notifications/balloon.h" | 10 #include "chrome/browser/notifications/balloon.h" |
11 #include "chrome/browser/notifications/balloon_host.h" | 11 #include "chrome/browser/notifications/balloon_host.h" |
12 #include "chrome/browser/notifications/notification.h" | 12 #include "chrome/browser/notifications/notification.h" |
13 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
14 #include "chrome/browser/ui/panels/docked_panel_strip.h" | 14 #include "chrome/browser/ui/panels/docked_panel_strip.h" |
15 #include "chrome/browser/ui/panels/panel.h" | 15 #include "chrome/browser/ui/panels/panel.h" |
16 #include "chrome/browser/ui/panels/panel_manager.h" | 16 #include "chrome/browser/ui/panels/panel_manager.h" |
17 #include "chrome/common/chrome_notification_types.h" | 17 #include "chrome/common/chrome_notification_types.h" |
18 #include "content/public/browser/notification_registrar.h" | 18 #include "content/public/browser/notification_registrar.h" |
19 #include "content/public/browser/notification_service.h" | 19 #include "content/public/browser/notification_service.h" |
20 #include "ui/gfx/rect.h" | 20 #include "ui/gfx/rect.h" |
| 21 #include "ui/gfx/monitor.h" |
21 #include "ui/gfx/screen.h" | 22 #include "ui/gfx/screen.h" |
22 #include "ui/gfx/size.h" | 23 #include "ui/gfx/size.h" |
23 | 24 |
24 namespace { | 25 namespace { |
25 | 26 |
26 // Portion of the screen allotted for notifications. When notification balloons | 27 // Portion of the screen allotted for notifications. When notification balloons |
27 // extend over this, no new notifications are shown until some are closed. | 28 // extend over this, no new notifications are shown until some are closed. |
28 const double kPercentBalloonFillFactor = 0.7; | 29 const double kPercentBalloonFillFactor = 0.7; |
29 | 30 |
30 // Allow at least this number of balloons on the screen. | 31 // Allow at least this number of balloons on the screen. |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 offset_to_move_above_panels_ = offset_to_move_above_panels; | 480 offset_to_move_above_panels_ = offset_to_move_above_panels; |
480 return true; | 481 return true; |
481 } | 482 } |
482 | 483 |
483 bool BalloonCollectionImpl::Layout::RefreshSystemMetrics() { | 484 bool BalloonCollectionImpl::Layout::RefreshSystemMetrics() { |
484 bool changed = false; | 485 bool changed = false; |
485 | 486 |
486 #if defined(OS_MACOSX) | 487 #if defined(OS_MACOSX) |
487 gfx::Rect new_work_area = GetMacWorkArea(); | 488 gfx::Rect new_work_area = GetMacWorkArea(); |
488 #else | 489 #else |
489 gfx::Rect new_work_area = gfx::Screen::GetPrimaryMonitorWorkArea(); | 490 gfx::Rect new_work_area = gfx::Screen::GetPrimaryMonitor()->GetWorkArea(); |
490 #endif | 491 #endif |
491 if (!work_area_.Equals(new_work_area)) { | 492 if (!work_area_.Equals(new_work_area)) { |
492 work_area_.SetRect(new_work_area.x(), new_work_area.y(), | 493 work_area_.SetRect(new_work_area.x(), new_work_area.y(), |
493 new_work_area.width(), new_work_area.height()); | 494 new_work_area.width(), new_work_area.height()); |
494 changed = true; | 495 changed = true; |
495 } | 496 } |
496 | 497 |
497 return changed; | 498 return changed; |
498 } | 499 } |
OLD | NEW |