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

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: rebase Created 4 years, 11 months 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 <utility> 7 #include <utility>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 #include "ash/system/web_notification/web_notification_tray.h" 43 #include "ash/system/web_notification/web_notification_tray.h"
44 #endif 44 #endif
45 45
46 MessageCenterNotificationManager::MessageCenterNotificationManager( 46 MessageCenterNotificationManager::MessageCenterNotificationManager(
47 message_center::MessageCenter* message_center, 47 message_center::MessageCenter* message_center,
48 scoped_ptr<message_center::NotifierSettingsProvider> settings_provider) 48 scoped_ptr<message_center::NotifierSettingsProvider> settings_provider)
49 : message_center_(message_center), 49 : message_center_(message_center),
50 settings_provider_(std::move(settings_provider)), 50 settings_provider_(std::move(settings_provider)),
51 system_observer_(this), 51 system_observer_(this),
52 stats_collector_(message_center), 52 stats_collector_(message_center),
53 google_now_stats_collector_(message_center) 53 google_now_stats_collector_(message_center) {
54 {
55 message_center_->AddObserver(this); 54 message_center_->AddObserver(this);
56 message_center_->SetNotifierSettingsProvider(settings_provider_.get()); 55 message_center_->SetNotifierSettingsProvider(settings_provider_.get());
57 56
58 #if defined(OS_CHROMEOS) 57 #if defined(OS_CHROMEOS)
59 blockers_.push_back(make_scoped_ptr( 58 blockers_.push_back(make_scoped_ptr(
60 new LoginStateNotificationBlockerChromeOS(message_center))); 59 new LoginStateNotificationBlockerChromeOS(message_center)));
61 #else 60 #else
62 blockers_.push_back(make_scoped_ptr( 61 blockers_.push_back(make_scoped_ptr(
63 new ScreenLockNotificationBlocker(message_center))); 62 new ScreenLockNotificationBlocker(message_center)));
64 #endif 63 #endif
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 removed = true; 264 removed = true;
266 } 265 }
267 } 266 }
268 return removed; 267 return removed;
269 } 268 }
270 269
271 void MessageCenterNotificationManager::CancelAll() { 270 void MessageCenterNotificationManager::CancelAll() {
272 message_center_->RemoveAllNotifications(/* by_user */ false); 271 message_center_->RemoveAllNotifications(/* by_user */ false);
273 } 272 }
274 273
274 bool MessageCenterNotificationManager::AcceptNativeNotifications() {
275 return false;
276 }
277
275 //////////////////////////////////////////////////////////////////////////////// 278 ////////////////////////////////////////////////////////////////////////////////
276 // MessageCenter::Observer 279 // MessageCenter::Observer
277 void MessageCenterNotificationManager::OnNotificationRemoved( 280 void MessageCenterNotificationManager::OnNotificationRemoved(
278 const std::string& id, 281 const std::string& id,
279 bool by_user) { 282 bool by_user) {
280 NotificationMap::const_iterator iter = profile_notifications_.find(id); 283 NotificationMap::const_iterator iter = profile_notifications_.find(id);
281 if (iter != profile_notifications_.end()) 284 if (iter != profile_notifications_.end())
282 RemoveProfileNotification(iter->second); 285 RemoveProfileNotification(iter->second);
283 } 286 }
284 287
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 it != registry->enabled_extensions().end(); 379 it != registry->enabled_extensions().end();
377 ++it) { 380 ++it) {
378 if ((*it->get()).permissions_data()->HasAPIPermission( 381 if ((*it->get()).permissions_data()->HasAPIPermission(
379 extensions::APIPermission::ID::kNotificationProvider)) { 382 extensions::APIPermission::ID::kNotificationProvider)) {
380 extension_id = (*it->get()).id(); 383 extension_id = (*it->get()).id();
381 return extension_id; 384 return extension_id;
382 } 385 }
383 } 386 }
384 return extension_id; 387 return extension_id;
385 } 388 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698