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

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

Issue 13421008: Fix menu for 'disable extension'. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
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/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 166
167 //////////////////////////////////////////////////////////////////////////////// 167 ////////////////////////////////////////////////////////////////////////////////
168 // MessageCenter::Delegate 168 // MessageCenter::Delegate
169 169
170 void MessageCenterNotificationManager::DisableExtension( 170 void MessageCenterNotificationManager::DisableExtension(
171 const std::string& notification_id) { 171 const std::string& notification_id) {
172 ProfileNotification* profile_notification = 172 ProfileNotification* profile_notification =
173 FindProfileNotification(notification_id); 173 FindProfileNotification(notification_id);
174 std::string extension_id = profile_notification->GetExtensionId(); 174 std::string extension_id = profile_notification->GetExtensionId();
175 DCHECK(!extension_id.empty()); // or UI should not have enabled the command. 175 DCHECK(!extension_id.empty()); // or UI should not have enabled the command.
176 profile_notification->profile()->GetExtensionService()->DisableExtension( 176 DesktopNotificationService* service =
177 extension_id, extensions::Extension::DISABLE_USER_ACTION); 177 DesktopNotificationServiceFactory::GetForProfile(
178 profile_notification->profile());
179 service->SetExtensionEnabled(extension_id, false);
178 } 180 }
179 181
180 void MessageCenterNotificationManager::DisableNotificationsFromSource( 182 void MessageCenterNotificationManager::DisableNotificationsFromSource(
181 const std::string& notification_id) { 183 const std::string& notification_id) {
182 ProfileNotification* profile_notification = 184 ProfileNotification* profile_notification =
183 FindProfileNotification(notification_id); 185 FindProfileNotification(notification_id);
184 // UI should not have enabled the command if there is no valid source. 186 // UI should not have enabled the command if there is no valid source.
185 DCHECK(profile_notification->notification().origin_url().is_valid()); 187 DCHECK(profile_notification->notification().origin_url().is_valid());
186 DesktopNotificationService* service = 188 DesktopNotificationService* service =
187 DesktopNotificationServiceFactory::GetForProfile( 189 DesktopNotificationServiceFactory::GetForProfile(
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 406
405 MessageCenterNotificationManager::ProfileNotification* 407 MessageCenterNotificationManager::ProfileNotification*
406 MessageCenterNotificationManager::FindProfileNotification( 408 MessageCenterNotificationManager::FindProfileNotification(
407 const std::string& id) const { 409 const std::string& id) const {
408 NotificationMap::const_iterator iter = profile_notifications_.find(id); 410 NotificationMap::const_iterator iter = profile_notifications_.find(id);
409 // If the notification is shown in UI, it must be in the map. 411 // If the notification is shown in UI, it must be in the map.
410 DCHECK(iter != profile_notifications_.end()); 412 DCHECK(iter != profile_notifications_.end());
411 DCHECK((*iter).second); 413 DCHECK((*iter).second);
412 return (*iter).second; 414 return (*iter).second;
413 } 415 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/notifications/notifications_api.cc ('k') | ui/base/strings/ui_strings.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698