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

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

Issue 2230203002: chrome: Use stl utilities from the base namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed accidental components/ change Created 4 years, 4 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/extensions/warning_badge_service.h" 5 #include "chrome/browser/extensions/warning_badge_service.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 const ExtensionIdSet& affected_extensions) { 132 const ExtensionIdSet& affected_extensions) {
133 DCHECK(CalledOnValidThread()); 133 DCHECK(CalledOnValidThread());
134 UpdateBadgeStatus(); 134 UpdateBadgeStatus();
135 } 135 }
136 136
137 void WarningBadgeService::UpdateBadgeStatus() { 137 void WarningBadgeService::UpdateBadgeStatus() {
138 const std::set<Warning>& warnings = GetCurrentWarnings(); 138 const std::set<Warning>& warnings = GetCurrentWarnings();
139 bool non_suppressed_warnings_exist = false; 139 bool non_suppressed_warnings_exist = false;
140 for (std::set<Warning>::const_iterator i = warnings.begin(); 140 for (std::set<Warning>::const_iterator i = warnings.begin();
141 i != warnings.end(); ++i) { 141 i != warnings.end(); ++i) {
142 if (!ContainsKey(suppressed_warnings_, *i)) { 142 if (!base::ContainsKey(suppressed_warnings_, *i)) {
143 non_suppressed_warnings_exist = true; 143 non_suppressed_warnings_exist = true;
144 break; 144 break;
145 } 145 }
146 } 146 }
147 ShowBadge(non_suppressed_warnings_exist); 147 ShowBadge(non_suppressed_warnings_exist);
148 } 148 }
149 149
150 void WarningBadgeService::ShowBadge(bool show) { 150 void WarningBadgeService::ShowBadge(bool show) {
151 GlobalErrorService* service = 151 GlobalErrorService* service =
152 GlobalErrorServiceFactory::GetForProfile(profile_); 152 GlobalErrorServiceFactory::GetForProfile(profile_);
153 GlobalError* error = service->GetGlobalErrorByMenuItemCommandID( 153 GlobalError* error = service->GetGlobalErrorByMenuItemCommandID(
154 ErrorBadge::GetMenuItemCommandID()); 154 ErrorBadge::GetMenuItemCommandID());
155 155
156 // Activate or hide the warning badge in case the current state is incorrect. 156 // Activate or hide the warning badge in case the current state is incorrect.
157 if (error && !show) { 157 if (error && !show) {
158 service->RemoveGlobalError(error); 158 service->RemoveGlobalError(error);
159 delete error; 159 delete error;
160 } else if (!error && show) { 160 } else if (!error && show) {
161 service->AddGlobalError(new ErrorBadge(this)); 161 service->AddGlobalError(new ErrorBadge(this));
162 } 162 }
163 } 163 }
164 164
165 } // namespace extensions 165 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/updater/extension_updater_unittest.cc ('k') | chrome/browser/icon_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698