| 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 "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/panel.h" |
| 14 #include "chrome/browser/ui/panels/panel_manager.h" | 15 #include "chrome/browser/ui/panels/panel_manager.h" |
| 15 #include "chrome/browser/ui/panels/panel.h" | |
| 16 #include "chrome/browser/ui/window_sizer.h" | |
| 17 #include "chrome/common/chrome_notification_types.h" | 16 #include "chrome/common/chrome_notification_types.h" |
| 18 #include "content/public/browser/notification_registrar.h" | 17 #include "content/public/browser/notification_registrar.h" |
| 19 #include "content/public/browser/notification_service.h" | 18 #include "content/public/browser/notification_service.h" |
| 20 #include "ui/gfx/rect.h" | 19 #include "ui/gfx/rect.h" |
| 20 #include "ui/gfx/screen.h" |
| 21 #include "ui/gfx/size.h" | 21 #include "ui/gfx/size.h" |
| 22 | 22 |
| 23 namespace { | 23 namespace { |
| 24 | 24 |
| 25 // Portion of the screen allotted for notifications. When notification balloons | 25 // Portion of the screen allotted for notifications. When notification balloons |
| 26 // extend over this, no new notifications are shown until some are closed. | 26 // extend over this, no new notifications are shown until some are closed. |
| 27 const double kPercentBalloonFillFactor = 0.7; | 27 const double kPercentBalloonFillFactor = 0.7; |
| 28 | 28 |
| 29 // Allow at least this number of balloons on the screen. | 29 // Allow at least this number of balloons on the screen. |
| 30 const int kMinAllowedBalloonCount = 2; | 30 const int kMinAllowedBalloonCount = 2; |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 offset_to_move_above_panels_ = offset_to_move_above_panels; | 458 offset_to_move_above_panels_ = offset_to_move_above_panels; |
| 459 return true; | 459 return true; |
| 460 } | 460 } |
| 461 | 461 |
| 462 bool BalloonCollectionImpl::Layout::RefreshSystemMetrics() { | 462 bool BalloonCollectionImpl::Layout::RefreshSystemMetrics() { |
| 463 bool changed = false; | 463 bool changed = false; |
| 464 | 464 |
| 465 #if defined(OS_MACOSX) | 465 #if defined(OS_MACOSX) |
| 466 gfx::Rect new_work_area = GetMacWorkArea(); | 466 gfx::Rect new_work_area = GetMacWorkArea(); |
| 467 #else | 467 #else |
| 468 scoped_ptr<WindowSizer::MonitorInfoProvider> info_provider( | 468 gfx::Rect new_work_area = gfx::Screen::GetPrimaryMonitorWorkArea(); |
| 469 WindowSizer::CreateDefaultMonitorInfoProvider()); | |
| 470 gfx::Rect new_work_area = info_provider->GetPrimaryMonitorWorkArea(); | |
| 471 #endif | 469 #endif |
| 472 if (!work_area_.Equals(new_work_area)) { | 470 if (!work_area_.Equals(new_work_area)) { |
| 473 work_area_.SetRect(new_work_area.x(), new_work_area.y(), | 471 work_area_.SetRect(new_work_area.x(), new_work_area.y(), |
| 474 new_work_area.width(), new_work_area.height()); | 472 new_work_area.width(), new_work_area.height()); |
| 475 changed = true; | 473 changed = true; |
| 476 } | 474 } |
| 477 | 475 |
| 478 return changed; | 476 return changed; |
| 479 } | 477 } |
| OLD | NEW |