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

Side by Side Diff: chrome/browser/extensions/extension_warning_set.cc

Issue 8342048: Make NotificationService an interface in the content namespace, and switch callers to use it. Mov... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/extensions/extension_warning_set.h" 5 #include "chrome/browser/extensions/extension_warning_set.h"
6 6
7 #include "chrome/browser/extensions/extension_global_error_badge.h" 7 #include "chrome/browser/extensions/extension_global_error_badge.h"
8 #include "chrome/browser/ui/global_error_service.h" 8 #include "chrome/browser/ui/global_error_service.h"
9 #include "chrome/browser/ui/global_error_service_factory.h" 9 #include "chrome/browser/ui/global_error_service_factory.h"
10 #include "chrome/common/chrome_notification_types.h" 10 #include "chrome/common/chrome_notification_types.h"
11 #include "content/common/notification_service.h" 11 #include "content/public/browser/notification_service.h"
12 #include "grit/chromium_strings.h" 12 #include "grit/chromium_strings.h"
13 #include "grit/generated_resources.h" 13 #include "grit/generated_resources.h"
14 #include "ui/base/l10n/l10n_util.h" 14 #include "ui/base/l10n/l10n_util.h"
15 15
16 // This class is used to represent warnings if extensions misbehave. 16 // This class is used to represent warnings if extensions misbehave.
17 class ExtensionWarning { 17 class ExtensionWarning {
18 public: 18 public:
19 // Default constructor for storing ExtensionServiceWarning in STL containers 19 // Default constructor for storing ExtensionServiceWarning in STL containers
20 // do not use. 20 // do not use.
21 ExtensionWarning(); 21 ExtensionWarning();
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 result->insert(i->warning_type()); 119 result->insert(i->warning_type());
120 } 120 }
121 } 121 }
122 122
123 void ExtensionWarningSet::SuppressBadgeForCurrentWarnings() { 123 void ExtensionWarningSet::SuppressBadgeForCurrentWarnings() {
124 badge_suppressions_.insert(warnings_.begin(), warnings_.end()); 124 badge_suppressions_.insert(warnings_.begin(), warnings_.end());
125 UpdateWarningBadge(); 125 UpdateWarningBadge();
126 } 126 }
127 127
128 void ExtensionWarningSet::NotifyWarningsChanged() { 128 void ExtensionWarningSet::NotifyWarningsChanged() {
129 NotificationService::current()->Notify( 129 content::NotificationService::current()->Notify(
130 chrome::NOTIFICATION_EXTENSION_WARNING_CHANGED, 130 chrome::NOTIFICATION_EXTENSION_WARNING_CHANGED,
131 content::Source<Profile>(profile_), 131 content::Source<Profile>(profile_),
132 NotificationService::NoDetails()); 132 content::NotificationService::NoDetails());
133 } 133 }
134 134
135 void ExtensionWarningSet::ActivateBadge() { 135 void ExtensionWarningSet::ActivateBadge() {
136 DCHECK(!extension_global_error_badge_); 136 DCHECK(!extension_global_error_badge_);
137 DCHECK(profile_); 137 DCHECK(profile_);
138 extension_global_error_badge_ = new ExtensionGlobalErrorBadge; 138 extension_global_error_badge_ = new ExtensionGlobalErrorBadge;
139 GlobalErrorServiceFactory::GetForProfile(profile_)->AddGlobalError( 139 GlobalErrorServiceFactory::GetForProfile(profile_)->AddGlobalError(
140 extension_global_error_badge_); 140 extension_global_error_badge_);
141 } 141 }
142 142
(...skipping 15 matching lines...) Expand all
158 break; 158 break;
159 } 159 }
160 } 160 }
161 161
162 // Activate or hide the warning badge in case the current state is incorrect. 162 // Activate or hide the warning badge in case the current state is incorrect.
163 if (extension_global_error_badge_ && !need_warning_badge) 163 if (extension_global_error_badge_ && !need_warning_badge)
164 DeactivateBadge(); 164 DeactivateBadge();
165 else if (!extension_global_error_badge_ && need_warning_badge) 165 else if (!extension_global_error_badge_ && need_warning_badge)
166 ActivateBadge(); 166 ActivateBadge();
167 } 167 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_updater.cc ('k') | chrome/browser/extensions/extension_web_socket_proxy_private_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698