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/monitor_info_provider.h" |
| 15 #include "chrome/browser/ui/panels/panel.h" |
14 #include "chrome/browser/ui/panels/panel_manager.h" | 16 #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" | 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/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. |
(...skipping 431 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 scoped_ptr<MonitorInfoProvider> monitor_info(MonitorInfoProvider::Create()); |
469 WindowSizer::CreateDefaultMonitorInfoProvider()); | 469 gfx::Rect new_work_area = monitor_info->GetPrimaryMonitorWorkArea(); |
470 gfx::Rect new_work_area = info_provider->GetPrimaryMonitorWorkArea(); | |
471 #endif | 470 #endif |
472 if (!work_area_.Equals(new_work_area)) { | 471 if (!work_area_.Equals(new_work_area)) { |
473 work_area_.SetRect(new_work_area.x(), new_work_area.y(), | 472 work_area_.SetRect(new_work_area.x(), new_work_area.y(), |
474 new_work_area.width(), new_work_area.height()); | 473 new_work_area.width(), new_work_area.height()); |
475 changed = true; | 474 changed = true; |
476 } | 475 } |
477 | 476 |
478 return changed; | 477 return changed; |
479 } | 478 } |
OLD | NEW |