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_disabled_ui.h" | 5 #include "chrome/browser/extensions/extension_disabled_ui.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "chrome/common/extensions/extension.h" | 26 #include "chrome/common/extensions/extension.h" |
27 #include "content/public/browser/notification_details.h" | 27 #include "content/public/browser/notification_details.h" |
28 #include "content/public/browser/notification_observer.h" | 28 #include "content/public/browser/notification_observer.h" |
29 #include "content/public/browser/notification_registrar.h" | 29 #include "content/public/browser/notification_registrar.h" |
30 #include "content/public/browser/notification_source.h" | 30 #include "content/public/browser/notification_source.h" |
31 #include "grit/chromium_strings.h" | 31 #include "grit/chromium_strings.h" |
32 #include "grit/generated_resources.h" | 32 #include "grit/generated_resources.h" |
33 #include "grit/theme_resources.h" | 33 #include "grit/theme_resources.h" |
34 #include "ui/base/l10n/l10n_util.h" | 34 #include "ui/base/l10n/l10n_util.h" |
35 | 35 |
| 36 using extensions::Extension; |
| 37 |
36 namespace { | 38 namespace { |
37 | 39 |
38 static base::LazyInstance< | 40 static base::LazyInstance< |
39 std::bitset<IDC_EXTENSION_DISABLED_LAST - | 41 std::bitset<IDC_EXTENSION_DISABLED_LAST - |
40 IDC_EXTENSION_DISABLED_FIRST + 1> > | 42 IDC_EXTENSION_DISABLED_FIRST + 1> > |
41 menu_command_ids = LAZY_INSTANCE_INITIALIZER; | 43 menu_command_ids = LAZY_INSTANCE_INITIALIZER; |
42 | 44 |
43 // Get an available menu ID. | 45 // Get an available menu ID. |
44 int GetMenuCommandID() { | 46 int GetMenuCommandID() { |
45 int id; | 47 int id; |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 int type, | 285 int type, |
284 const content::NotificationSource& source, | 286 const content::NotificationSource& source, |
285 const content::NotificationDetails& details) { | 287 const content::NotificationDetails& details) { |
286 const Extension* extension = NULL; | 288 const Extension* extension = NULL; |
287 // The error is invalidated if the extension has been reloaded | 289 // The error is invalidated if the extension has been reloaded |
288 // or unloaded. | 290 // or unloaded. |
289 if (type == chrome::NOTIFICATION_EXTENSION_LOADED) { | 291 if (type == chrome::NOTIFICATION_EXTENSION_LOADED) { |
290 extension = content::Details<const Extension>(details).ptr(); | 292 extension = content::Details<const Extension>(details).ptr(); |
291 } else { | 293 } else { |
292 DCHECK_EQ(chrome::NOTIFICATION_EXTENSION_UNLOADED, type); | 294 DCHECK_EQ(chrome::NOTIFICATION_EXTENSION_UNLOADED, type); |
293 UnloadedExtensionInfo* info = | 295 extensions::UnloadedExtensionInfo* info = |
294 content::Details<UnloadedExtensionInfo>(details).ptr(); | 296 content::Details<extensions::UnloadedExtensionInfo>(details).ptr(); |
295 extension = info->extension; | 297 extension = info->extension; |
296 } | 298 } |
297 if (extension == extension_) { | 299 if (extension == extension_) { |
298 GlobalErrorServiceFactory::GetForProfile(service_->profile())-> | 300 GlobalErrorServiceFactory::GetForProfile(service_->profile())-> |
299 RemoveGlobalError(this); | 301 RemoveGlobalError(this); |
300 | 302 |
301 if (type == chrome::NOTIFICATION_EXTENSION_LOADED) | 303 if (type == chrome::NOTIFICATION_EXTENSION_LOADED) |
302 user_response_ = REENABLE; | 304 user_response_ = REENABLE; |
303 else if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) | 305 else if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) |
304 user_response_ = UNINSTALL; | 306 user_response_ = UNINSTALL; |
(...skipping 11 matching lines...) Expand all Loading... |
316 AddGlobalError(new ExtensionDisabledGlobalError(service, extension)); | 318 AddGlobalError(new ExtensionDisabledGlobalError(service, extension)); |
317 } | 319 } |
318 | 320 |
319 void ShowExtensionDisabledDialog(ExtensionService* service, Profile* profile, | 321 void ShowExtensionDisabledDialog(ExtensionService* service, Profile* profile, |
320 const Extension* extension) { | 322 const Extension* extension) { |
321 // This object manages its own lifetime. | 323 // This object manages its own lifetime. |
322 new ExtensionDisabledDialogDelegate(profile, service, extension); | 324 new ExtensionDisabledDialogDelegate(profile, service, extension); |
323 } | 325 } |
324 | 326 |
325 } // namespace extensions | 327 } // namespace extensions |
OLD | NEW |