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/extension_warning_set.h" | 5 #include "chrome/browser/extensions/extension_warning_set.h" |
6 | 6 |
7 #include "chrome/browser/browser_process.h" | 7 #include "chrome/browser/browser_process.h" |
8 #include "chrome/browser/extensions/extension_global_error_badge.h" | 8 #include "chrome/browser/extensions/extension_global_error_badge.h" |
9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 } | 137 } |
138 | 138 |
139 // static | 139 // static |
140 void ExtensionWarningSet::NotifyWarningsOnUI( | 140 void ExtensionWarningSet::NotifyWarningsOnUI( |
141 void* profile_id, | 141 void* profile_id, |
142 std::set<std::string> extension_ids, | 142 std::set<std::string> extension_ids, |
143 WarningType warning_type) { | 143 WarningType warning_type) { |
144 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 144 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
145 Profile* profile = reinterpret_cast<Profile*>(profile_id); | 145 Profile* profile = reinterpret_cast<Profile*>(profile_id); |
146 if (!profile || | 146 if (!profile || |
| 147 !g_browser_process->profile_manager() || |
147 !g_browser_process->profile_manager()->IsValidProfile(profile)) { | 148 !g_browser_process->profile_manager()->IsValidProfile(profile)) { |
148 return; | 149 return; |
149 } | 150 } |
150 | 151 |
151 ExtensionWarningSet* warnings = | 152 ExtensionWarningSet* warnings = |
152 profile->GetExtensionService()->extension_warnings(); | 153 profile->GetExtensionService()->extension_warnings(); |
153 | 154 |
154 for (std::set<std::string>::const_iterator i = extension_ids.begin(); | 155 for (std::set<std::string>::const_iterator i = extension_ids.begin(); |
155 i != extension_ids.end(); ++i) { | 156 i != extension_ids.end(); ++i) { |
156 warnings->SetWarning(warning_type, *i); | 157 warnings->SetWarning(warning_type, *i); |
(...skipping 28 matching lines...) Expand all Loading... |
185 ExtensionGlobalErrorBadge::GetMenuItemCommandID()); | 186 ExtensionGlobalErrorBadge::GetMenuItemCommandID()); |
186 | 187 |
187 // Activate or hide the warning badge in case the current state is incorrect. | 188 // Activate or hide the warning badge in case the current state is incorrect. |
188 if (error && !need_warning_badge) { | 189 if (error && !need_warning_badge) { |
189 service->RemoveGlobalError(error); | 190 service->RemoveGlobalError(error); |
190 delete error; | 191 delete error; |
191 } else if (!error && need_warning_badge) { | 192 } else if (!error && need_warning_badge) { |
192 service->AddGlobalError(new ExtensionGlobalErrorBadge); | 193 service->AddGlobalError(new ExtensionGlobalErrorBadge); |
193 } | 194 } |
194 } | 195 } |
OLD | NEW |