| 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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 202       menu_command_id_(GetMenuCommandID()) { | 202       menu_command_id_(GetMenuCommandID()) { | 
| 203   if (icon_.IsEmpty()) { | 203   if (icon_.IsEmpty()) { | 
| 204     icon_ = gfx::Image( | 204     icon_ = gfx::Image( | 
| 205         gfx::ImageSkiaOperations::CreateResizedImage( | 205         gfx::ImageSkiaOperations::CreateResizedImage( | 
| 206             extension_->is_app() ? | 206             extension_->is_app() ? | 
| 207                 extensions::IconsInfo::GetDefaultAppIcon() : | 207                 extensions::IconsInfo::GetDefaultAppIcon() : | 
| 208                 extensions::IconsInfo::GetDefaultExtensionIcon(), | 208                 extensions::IconsInfo::GetDefaultExtensionIcon(), | 
| 209             skia::ImageOperations::RESIZE_BEST, | 209             skia::ImageOperations::RESIZE_BEST, | 
| 210             gfx::Size(kIconSize, kIconSize))); | 210             gfx::Size(kIconSize, kIconSize))); | 
| 211   } | 211   } | 
| 212   registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, | 212   registrar_.Add(this, | 
|  | 213                  chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, | 
| 213                  content::Source<Profile>(service->profile())); | 214                  content::Source<Profile>(service->profile())); | 
| 214   registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_REMOVED, | 215   registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_REMOVED, | 
| 215                  content::Source<Profile>(service->profile())); | 216                  content::Source<Profile>(service->profile())); | 
| 216 } | 217 } | 
| 217 | 218 | 
| 218 ExtensionDisabledGlobalError::~ExtensionDisabledGlobalError() { | 219 ExtensionDisabledGlobalError::~ExtensionDisabledGlobalError() { | 
| 219   ReleaseMenuCommandID(menu_command_id_); | 220   ReleaseMenuCommandID(menu_command_id_); | 
| 220   UMA_HISTOGRAM_ENUMERATION("Extensions.DisabledUIUserResponse", | 221   UMA_HISTOGRAM_ENUMERATION("Extensions.DisabledUIUserResponse", | 
| 221                             user_response_, | 222                             user_response_, | 
| 222                             EXTENSION_DISABLED_UI_BUCKET_BOUNDARY); | 223                             EXTENSION_DISABLED_UI_BUCKET_BOUNDARY); | 
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 309 | 310 | 
| 310 void ExtensionDisabledGlobalError::ExtensionUninstallCanceled() { | 311 void ExtensionDisabledGlobalError::ExtensionUninstallCanceled() { | 
| 311   // Nothing happens, and the error is still there. | 312   // Nothing happens, and the error is still there. | 
| 312 } | 313 } | 
| 313 | 314 | 
| 314 void ExtensionDisabledGlobalError::Observe( | 315 void ExtensionDisabledGlobalError::Observe( | 
| 315     int type, | 316     int type, | 
| 316     const content::NotificationSource& source, | 317     const content::NotificationSource& source, | 
| 317     const content::NotificationDetails& details) { | 318     const content::NotificationDetails& details) { | 
| 318   // The error is invalidated if the extension has been loaded or removed. | 319   // The error is invalidated if the extension has been loaded or removed. | 
| 319   DCHECK(type == chrome::NOTIFICATION_EXTENSION_LOADED || | 320   DCHECK(type == chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED || | 
| 320          type == chrome::NOTIFICATION_EXTENSION_REMOVED); | 321          type == chrome::NOTIFICATION_EXTENSION_REMOVED); | 
| 321   const Extension* extension = content::Details<const Extension>(details).ptr(); | 322   const Extension* extension = content::Details<const Extension>(details).ptr(); | 
| 322   if (extension != extension_) | 323   if (extension != extension_) | 
| 323     return; | 324     return; | 
| 324   GlobalErrorServiceFactory::GetForProfile(service_->profile())-> | 325   GlobalErrorServiceFactory::GetForProfile(service_->profile())-> | 
| 325       RemoveGlobalError(this); | 326       RemoveGlobalError(this); | 
| 326 | 327 | 
| 327   if (type == chrome::NOTIFICATION_EXTENSION_LOADED) | 328   if (type == chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED) | 
| 328     user_response_ = REENABLE; | 329     user_response_ = REENABLE; | 
| 329   else if (type == chrome::NOTIFICATION_EXTENSION_REMOVED) | 330   else if (type == chrome::NOTIFICATION_EXTENSION_REMOVED) | 
| 330     user_response_ = UNINSTALL; | 331     user_response_ = UNINSTALL; | 
| 331   delete this; | 332   delete this; | 
| 332 } | 333 } | 
| 333 | 334 | 
| 334 // Globals -------------------------------------------------------------------- | 335 // Globals -------------------------------------------------------------------- | 
| 335 | 336 | 
| 336 namespace extensions { | 337 namespace extensions { | 
| 337 | 338 | 
| (...skipping 29 matching lines...) Expand all  Loading... | 
| 367 void ShowExtensionDisabledDialog(ExtensionService* service, | 368 void ShowExtensionDisabledDialog(ExtensionService* service, | 
| 368                                  content::WebContents* web_contents, | 369                                  content::WebContents* web_contents, | 
| 369                                  const Extension* extension) { | 370                                  const Extension* extension) { | 
| 370   scoped_ptr<ExtensionInstallPrompt> install_ui( | 371   scoped_ptr<ExtensionInstallPrompt> install_ui( | 
| 371       new ExtensionInstallPrompt(web_contents)); | 372       new ExtensionInstallPrompt(web_contents)); | 
| 372   // This object manages its own lifetime. | 373   // This object manages its own lifetime. | 
| 373   new ExtensionDisabledDialogDelegate(service, install_ui.Pass(), extension); | 374   new ExtensionDisabledDialogDelegate(service, install_ui.Pass(), extension); | 
| 374 } | 375 } | 
| 375 | 376 | 
| 376 }  // namespace extensions | 377 }  // namespace extensions | 
| OLD | NEW | 
|---|