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/ash/balloon_collection_impl_ash.h" | 5 #include "chrome/browser/ui/views/ash/balloon_collection_impl_ash.h" |
6 | 6 |
7 #include "chrome/browser/notifications/balloon.h" | 7 #include "chrome/browser/notifications/balloon.h" |
8 #include "chrome/browser/notifications/notification.h" | 8 #include "chrome/browser/notifications/notification.h" |
9 #include "chrome/browser/ui/views/notifications/balloon_view_views.h" | 9 #include "chrome/browser/ui/views/notifications/balloon_view_views.h" |
10 #include "chrome/browser/ui/views/notifications/balloon_view_host.h" | 10 #include "chrome/browser/ui/views/notifications/balloon_view_host.h" |
11 | 11 |
12 BalloonCollectionImplAsh::BalloonCollectionImplAsh() { | 12 BalloonCollectionImplAsh::BalloonCollectionImplAsh() { |
13 } | 13 } |
14 | 14 |
15 BalloonCollectionImplAsh::~BalloonCollectionImplAsh() { | 15 BalloonCollectionImplAsh::~BalloonCollectionImplAsh() { |
16 } | 16 } |
17 | 17 |
18 bool BalloonCollectionImplAsh::AddWebUIMessageCallback( | 18 bool BalloonCollectionImplAsh::AddWebUIMessageCallback( |
19 const Notification& notification, | 19 const Notification& notification, |
20 const std::string& message, | 20 const std::string& message, |
21 const chromeos::BalloonViewHost::MessageCallback& callback) { | 21 const chromeos::BalloonViewHost::MessageCallback& callback) { |
| 22 #if defined(OS_CHROMEOS) |
22 Balloon* balloon = base().FindBalloon(notification); | 23 Balloon* balloon = base().FindBalloon(notification); |
23 if (!balloon) | 24 if (!balloon) |
24 return false; | 25 return false; |
25 | 26 |
26 BalloonHost* balloon_host = balloon->balloon_view()->GetHost(); | 27 BalloonHost* balloon_host = balloon->balloon_view()->GetHost(); |
27 if (!balloon_host) | 28 if (!balloon_host) |
28 return false; | 29 return false; |
29 chromeos::BalloonViewHost* balloon_view_host = | 30 chromeos::BalloonViewHost* balloon_view_host = |
30 static_cast<chromeos::BalloonViewHost*>(balloon_host); | 31 static_cast<chromeos::BalloonViewHost*>(balloon_host); |
31 return balloon_view_host->AddWebUIMessageCallback(message, callback); | 32 return balloon_view_host->AddWebUIMessageCallback(message, callback); |
| 33 #else |
| 34 return false; |
| 35 #endif |
32 } | 36 } |
33 | 37 |
34 void BalloonCollectionImplAsh::AddSystemNotification( | 38 void BalloonCollectionImplAsh::AddSystemNotification( |
35 const Notification& notification, | 39 const Notification& notification, |
36 Profile* profile, | 40 Profile* profile, |
37 bool sticky) { | 41 bool sticky) { |
38 system_notifications_.insert(notification.notification_id()); | 42 system_notifications_.insert(notification.notification_id()); |
39 | 43 |
40 // Add balloons to the front of the stack. This ensures that system | 44 // Add balloons to the front of the stack. This ensures that system |
41 // notifications will always be displayed. NOTE: This has the side effect | 45 // notifications will always be displayed. NOTE: This has the side effect |
(...skipping 30 matching lines...) Expand all Loading... |
72 } | 76 } |
73 | 77 |
74 // For now, only use BalloonCollectionImplAsh on ChromeOS, until | 78 // For now, only use BalloonCollectionImplAsh on ChromeOS, until |
75 // system_notifications_ is replaced with status area notifications. | 79 // system_notifications_ is replaced with status area notifications. |
76 #if defined(OS_CHROMEOS) | 80 #if defined(OS_CHROMEOS) |
77 // static | 81 // static |
78 BalloonCollection* BalloonCollection::Create() { | 82 BalloonCollection* BalloonCollection::Create() { |
79 return new BalloonCollectionImplAsh(); | 83 return new BalloonCollectionImplAsh(); |
80 } | 84 } |
81 #endif | 85 #endif |
OLD | NEW |