Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Side by Side Diff: chrome/browser/notifications/message_center_notification_manager.cc

Issue 1509923002: Implement native web notifications for mac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/message_center_notification_manager.h" 5 #include "chrome/browser/notifications/message_center_notification_manager.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 29 matching lines...) Expand all
40 #include "ash/system/web_notification/web_notification_tray.h" 40 #include "ash/system/web_notification/web_notification_tray.h"
41 #endif 41 #endif
42 42
43 MessageCenterNotificationManager::MessageCenterNotificationManager( 43 MessageCenterNotificationManager::MessageCenterNotificationManager(
44 message_center::MessageCenter* message_center, 44 message_center::MessageCenter* message_center,
45 scoped_ptr<message_center::NotifierSettingsProvider> settings_provider) 45 scoped_ptr<message_center::NotifierSettingsProvider> settings_provider)
46 : message_center_(message_center), 46 : message_center_(message_center),
47 settings_provider_(settings_provider.Pass()), 47 settings_provider_(settings_provider.Pass()),
48 system_observer_(this), 48 system_observer_(this),
49 stats_collector_(message_center), 49 stats_collector_(message_center),
50 google_now_stats_collector_(message_center) 50 google_now_stats_collector_(message_center) {
51 {
52 message_center_->AddObserver(this); 51 message_center_->AddObserver(this);
53 message_center_->SetNotifierSettingsProvider(settings_provider_.get()); 52 message_center_->SetNotifierSettingsProvider(settings_provider_.get());
54 53
55 #if defined(OS_CHROMEOS) 54 #if defined(OS_CHROMEOS)
56 blockers_.push_back(make_scoped_ptr( 55 blockers_.push_back(make_scoped_ptr(
57 new LoginStateNotificationBlockerChromeOS(message_center))); 56 new LoginStateNotificationBlockerChromeOS(message_center)));
58 #else 57 #else
59 blockers_.push_back(make_scoped_ptr( 58 blockers_.push_back(make_scoped_ptr(
60 new ScreenLockNotificationBlocker(message_center))); 59 new ScreenLockNotificationBlocker(message_center)));
61 #endif 60 #endif
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 removed = true; 261 removed = true;
263 } 262 }
264 } 263 }
265 return removed; 264 return removed;
266 } 265 }
267 266
268 void MessageCenterNotificationManager::CancelAll() { 267 void MessageCenterNotificationManager::CancelAll() {
269 message_center_->RemoveAllNotifications(/* by_user */ false); 268 message_center_->RemoveAllNotifications(/* by_user */ false);
270 } 269 }
271 270
271 bool MessageCenterNotificationManager::AcceptNativeNotifications() {
272 return false;
273 }
274
272 //////////////////////////////////////////////////////////////////////////////// 275 ////////////////////////////////////////////////////////////////////////////////
273 // MessageCenter::Observer 276 // MessageCenter::Observer
274 void MessageCenterNotificationManager::OnNotificationRemoved( 277 void MessageCenterNotificationManager::OnNotificationRemoved(
275 const std::string& id, 278 const std::string& id,
276 bool by_user) { 279 bool by_user) {
277 NotificationMap::const_iterator iter = profile_notifications_.find(id); 280 NotificationMap::const_iterator iter = profile_notifications_.find(id);
278 if (iter != profile_notifications_.end()) 281 if (iter != profile_notifications_.end())
279 RemoveProfileNotification(iter->second); 282 RemoveProfileNotification(iter->second);
280 } 283 }
281 284
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 it != registry->enabled_extensions().end(); 376 it != registry->enabled_extensions().end();
374 ++it) { 377 ++it) {
375 if ((*it->get()).permissions_data()->HasAPIPermission( 378 if ((*it->get()).permissions_data()->HasAPIPermission(
376 extensions::APIPermission::ID::kNotificationProvider)) { 379 extensions::APIPermission::ID::kNotificationProvider)) {
377 extension_id = (*it->get()).id(); 380 extension_id = (*it->get()).id();
378 return extension_id; 381 return extension_id;
379 } 382 }
380 } 383 }
381 return extension_id; 384 return extension_id;
382 } 385 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698