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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 | 345 |
346 namespace extensions { | 346 namespace extensions { |
347 | 347 |
348 void AddExtensionDisabledErrorWithIcon(base::WeakPtr<ExtensionService> service, | 348 void AddExtensionDisabledErrorWithIcon(base::WeakPtr<ExtensionService> service, |
349 const std::string& extension_id, | 349 const std::string& extension_id, |
350 const gfx::Image& icon) { | 350 const gfx::Image& icon) { |
351 if (!service.get()) | 351 if (!service.get()) |
352 return; | 352 return; |
353 const Extension* extension = service->GetInstalledExtension(extension_id); | 353 const Extension* extension = service->GetInstalledExtension(extension_id); |
354 if (extension) { | 354 if (extension) { |
355 GlobalErrorServiceFactory::GetForProfile(service->profile())-> | 355 GlobalErrorServiceFactory::GetForProfile(service->profile()) |
356 AddGlobalError(new ExtensionDisabledGlobalError( | 356 ->AddGlobalError( |
357 service, extension, icon)); | 357 new ExtensionDisabledGlobalError(service.get(), extension, icon)); |
358 } | 358 } |
359 } | 359 } |
360 | 360 |
361 void AddExtensionDisabledError(ExtensionService* service, | 361 void AddExtensionDisabledError(ExtensionService* service, |
362 const Extension* extension) { | 362 const Extension* extension) { |
363 extensions::ExtensionResource image = extensions::IconsInfo::GetIconResource( | 363 extensions::ExtensionResource image = extensions::IconsInfo::GetIconResource( |
364 extension, kIconSize, ExtensionIconSet::MATCH_BIGGER); | 364 extension, kIconSize, ExtensionIconSet::MATCH_BIGGER); |
365 gfx::Size size(kIconSize, kIconSize); | 365 gfx::Size size(kIconSize, kIconSize); |
366 ImageLoader::Get(service->profile())->LoadImageAsync( | 366 ImageLoader::Get(service->profile())->LoadImageAsync( |
367 extension, image, size, | 367 extension, image, size, |
368 base::Bind(&AddExtensionDisabledErrorWithIcon, | 368 base::Bind(&AddExtensionDisabledErrorWithIcon, |
369 service->AsWeakPtr(), extension->id())); | 369 service->AsWeakPtr(), extension->id())); |
370 } | 370 } |
371 | 371 |
372 void ShowExtensionDisabledDialog(ExtensionService* service, | 372 void ShowExtensionDisabledDialog(ExtensionService* service, |
373 content::WebContents* web_contents, | 373 content::WebContents* web_contents, |
374 const Extension* extension) { | 374 const Extension* extension) { |
375 scoped_ptr<ExtensionInstallPrompt> install_ui( | 375 scoped_ptr<ExtensionInstallPrompt> install_ui( |
376 new ExtensionInstallPrompt(web_contents)); | 376 new ExtensionInstallPrompt(web_contents)); |
377 // This object manages its own lifetime. | 377 // This object manages its own lifetime. |
378 new ExtensionDisabledDialogDelegate(service, install_ui.Pass(), extension); | 378 new ExtensionDisabledDialogDelegate(service, install_ui.Pass(), extension); |
379 } | 379 } |
380 | 380 |
381 } // namespace extensions | 381 } // namespace extensions |
OLD | NEW |