OLD | NEW |
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 "base/stl_util.h" | 7 #include "base/stl_util.h" |
8 #include "chrome/app/chrome_command_ids.h" | 8 #include "chrome/app/chrome_command_ids.h" |
9 #include "chrome/browser/extensions/warning_badge_service_factory.h" | 9 #include "chrome/browser/extensions/warning_badge_service_factory.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 suppressed_warnings_.insert(warnings.begin(), warnings.end()); | 118 suppressed_warnings_.insert(warnings.begin(), warnings.end()); |
119 | 119 |
120 if (old_size != suppressed_warnings_.size()) | 120 if (old_size != suppressed_warnings_.size()) |
121 UpdateBadgeStatus(); | 121 UpdateBadgeStatus(); |
122 } | 122 } |
123 | 123 |
124 const WarningSet& WarningBadgeService::GetCurrentWarnings() const { | 124 const WarningSet& WarningBadgeService::GetCurrentWarnings() const { |
125 return WarningService::Get(profile_)->warnings(); | 125 return WarningService::Get(profile_)->warnings(); |
126 } | 126 } |
127 | 127 |
128 void WarningBadgeService::ExtensionWarningsChanged() { | 128 void WarningBadgeService::ExtensionWarningsChanged( |
| 129 const ExtensionIdSet& affected_extensions) { |
129 DCHECK(CalledOnValidThread()); | 130 DCHECK(CalledOnValidThread()); |
130 UpdateBadgeStatus(); | 131 UpdateBadgeStatus(); |
131 } | 132 } |
132 | 133 |
133 void WarningBadgeService::UpdateBadgeStatus() { | 134 void WarningBadgeService::UpdateBadgeStatus() { |
134 const std::set<Warning>& warnings = GetCurrentWarnings(); | 135 const std::set<Warning>& warnings = GetCurrentWarnings(); |
135 bool non_suppressed_warnings_exist = false; | 136 bool non_suppressed_warnings_exist = false; |
136 for (std::set<Warning>::const_iterator i = warnings.begin(); | 137 for (std::set<Warning>::const_iterator i = warnings.begin(); |
137 i != warnings.end(); ++i) { | 138 i != warnings.end(); ++i) { |
138 if (!ContainsKey(suppressed_warnings_, *i)) { | 139 if (!ContainsKey(suppressed_warnings_, *i)) { |
(...skipping 13 matching lines...) Expand all Loading... |
152 // Activate or hide the warning badge in case the current state is incorrect. | 153 // Activate or hide the warning badge in case the current state is incorrect. |
153 if (error && !show) { | 154 if (error && !show) { |
154 service->RemoveGlobalError(error); | 155 service->RemoveGlobalError(error); |
155 delete error; | 156 delete error; |
156 } else if (!error && show) { | 157 } else if (!error && show) { |
157 service->AddGlobalError(new ErrorBadge(this)); | 158 service->AddGlobalError(new ErrorBadge(this)); |
158 } | 159 } |
159 } | 160 } |
160 | 161 |
161 } // namespace extensions | 162 } // namespace extensions |
OLD | NEW |