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 "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/system/web_notification/web_notification_tray.h" | 8 #include "ash/system/web_notification/web_notification_tray.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
11 #include "chrome/browser/notifications/balloon.h" | 11 #include "chrome/browser/notifications/balloon.h" |
12 #include "chrome/browser/notifications/desktop_notification_service.h" | 12 #include "chrome/browser/notifications/desktop_notification_service.h" |
13 #include "chrome/browser/notifications/desktop_notification_service_factory.h" | 13 #include "chrome/browser/notifications/desktop_notification_service_factory.h" |
14 #include "chrome/browser/notifications/notification.h" | 14 #include "chrome/browser/notifications/notification.h" |
15 #include "chrome/browser/profiles/profile_manager.h" | 15 #include "chrome/browser/profiles/profile_manager.h" |
16 #include "chrome/browser/ui/browser_finder.h" | 16 #include "chrome/browser/ui/browser_finder.h" |
17 #include "chrome/browser/ui/chrome_pages.h" | 17 #include "chrome/browser/ui/chrome_pages.h" |
18 #include "chrome/browser/ui/views/ash/balloon_view_ash.h" | 18 #include "chrome/browser/ui/views/ash/balloon_view_ash.h" |
19 #include "chrome/browser/ui/views/notifications/balloon_view_host.h" | 19 #include "chrome/browser/ui/views/notifications/balloon_view_host.h" |
20 #include "chrome/browser/ui/views/notifications/balloon_view_views.h" | 20 #include "chrome/browser/ui/views/notifications/balloon_view_views.h" |
21 #include "chrome/common/extensions/extension.h" | 21 #include "chrome/common/extensions/extension.h" |
22 #include "chrome/common/extensions/extension_set.h" | 22 #include "chrome/common/extensions/extension_set.h" |
23 #include "chrome/common/extensions/permissions/api_permission.h" | 23 #include "chrome/common/extensions/permissions/api_permission.h" |
24 #include "ui/views/widget/widget.h" | |
24 | 25 |
25 using message_center::NotifierSettingsView; | 26 using message_center::NotifierSettingsView; |
26 | 27 |
27 BalloonCollectionImplAsh::BalloonCollectionImplAsh() | 28 BalloonCollectionImplAsh::BalloonCollectionImplAsh() |
28 : settings_view_(NULL) { | 29 : settings_view_(NULL) { |
29 ash::Shell::GetInstance()->GetWebNotificationTray()->message_center()-> | 30 ash::Shell::GetInstance()->GetWebNotificationTray()->message_center()-> |
30 SetDelegate(this); | 31 SetDelegate(this); |
31 } | 32 } |
32 | 33 |
33 BalloonCollectionImplAsh::~BalloonCollectionImplAsh() { | 34 BalloonCollectionImplAsh::~BalloonCollectionImplAsh() { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
78 balloon ? balloon->profile() : ProfileManager::GetDefaultProfile(); | 79 balloon ? balloon->profile() : ProfileManager::GetDefaultProfile(); |
79 Browser* browser = | 80 Browser* browser = |
80 chrome::FindOrCreateTabbedBrowser(profile, | 81 chrome::FindOrCreateTabbedBrowser(profile, |
81 chrome::HOST_DESKTOP_TYPE_ASH); | 82 chrome::HOST_DESKTOP_TYPE_ASH); |
82 if (GetBalloonExtension(balloon)) | 83 if (GetBalloonExtension(balloon)) |
83 chrome::ShowExtensions(browser); | 84 chrome::ShowExtensions(browser); |
84 else | 85 else |
85 chrome::ShowContentSettings(browser, CONTENT_SETTINGS_TYPE_NOTIFICATIONS); | 86 chrome::ShowContentSettings(browser, CONTENT_SETTINGS_TYPE_NOTIFICATIONS); |
86 } | 87 } |
87 | 88 |
89 void BalloonCollectionImplAsh::ShowSettingsDialog(gfx::NativeView context) { | |
90 if (settings_view_) { | |
91 settings_view_->GetWidget()->StackAtTop(); | |
92 } else { | |
miket_OOO
2013/01/25 00:32:10
No braces, don't really care.
Jun Mukai
2013/01/25 00:37:50
hmm, else-clause has two lines (it doesn't fit to
| |
93 settings_view_ = | |
94 message_center::NotifierSettingsView::Create(this, context); | |
95 } | |
96 } | |
97 | |
88 void BalloonCollectionImplAsh::OnClicked(const std::string& notification_id) { | 98 void BalloonCollectionImplAsh::OnClicked(const std::string& notification_id) { |
89 Balloon* balloon = base().FindBalloonById(notification_id); | 99 Balloon* balloon = base().FindBalloonById(notification_id); |
90 if (!balloon) | 100 if (!balloon) |
91 return; | 101 return; |
92 balloon->OnClick(); | 102 balloon->OnClick(); |
93 } | 103 } |
94 | 104 |
95 void BalloonCollectionImplAsh::OnButtonClicked( | 105 void BalloonCollectionImplAsh::OnButtonClicked( |
96 const std::string& notification_id, int button_index) { | 106 const std::string& notification_id, int button_index) { |
97 Balloon* balloon = base().FindBalloonById(notification_id); | 107 Balloon* balloon = base().FindBalloonById(notification_id); |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
208 return extension_service->extensions()->GetExtensionOrAppByURL( | 218 return extension_service->extensions()->GetExtensionOrAppByURL( |
209 ExtensionURLInfo(origin)); | 219 ExtensionURLInfo(origin)); |
210 } | 220 } |
211 | 221 |
212 #if defined(OS_CHROMEOS) | 222 #if defined(OS_CHROMEOS) |
213 // static | 223 // static |
214 BalloonCollection* BalloonCollection::Create() { | 224 BalloonCollection* BalloonCollection::Create() { |
215 return new BalloonCollectionImplAsh(); | 225 return new BalloonCollectionImplAsh(); |
216 } | 226 } |
217 #endif | 227 #endif |
OLD | NEW |