| 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/external_install_ui.h" | 5 #include "chrome/browser/extensions/external_install_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 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 Release(); | 333 Release(); |
| 334 } | 334 } |
| 335 | 335 |
| 336 // ExternalInstallMenuAlert ------------------------------------------------- | 336 // ExternalInstallMenuAlert ------------------------------------------------- |
| 337 | 337 |
| 338 ExternalInstallMenuAlert::ExternalInstallMenuAlert( | 338 ExternalInstallMenuAlert::ExternalInstallMenuAlert( |
| 339 ExtensionService* service, | 339 ExtensionService* service, |
| 340 const Extension* extension) | 340 const Extension* extension) |
| 341 : service_(service), | 341 : service_(service), |
| 342 extension_(extension) { | 342 extension_(extension) { |
| 343 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, | 343 registrar_.Add(this, |
| 344 chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, |
| 344 content::Source<Profile>(service->profile())); | 345 content::Source<Profile>(service->profile())); |
| 345 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_REMOVED, | 346 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_REMOVED, |
| 346 content::Source<Profile>(service->profile())); | 347 content::Source<Profile>(service->profile())); |
| 347 } | 348 } |
| 348 | 349 |
| 349 ExternalInstallMenuAlert::~ExternalInstallMenuAlert() { | 350 ExternalInstallMenuAlert::~ExternalInstallMenuAlert() { |
| 350 } | 351 } |
| 351 | 352 |
| 352 GlobalError::Severity ExternalInstallMenuAlert::GetSeverity() { | 353 GlobalError::Severity ExternalInstallMenuAlert::GetSeverity() { |
| 353 return SEVERITY_LOW; | 354 return SEVERITY_LOW; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 void ExternalInstallMenuAlert::BubbleViewCancelButtonPressed( | 408 void ExternalInstallMenuAlert::BubbleViewCancelButtonPressed( |
| 408 Browser* browser) { | 409 Browser* browser) { |
| 409 NOTREACHED(); | 410 NOTREACHED(); |
| 410 } | 411 } |
| 411 | 412 |
| 412 void ExternalInstallMenuAlert::Observe( | 413 void ExternalInstallMenuAlert::Observe( |
| 413 int type, | 414 int type, |
| 414 const content::NotificationSource& source, | 415 const content::NotificationSource& source, |
| 415 const content::NotificationDetails& details) { | 416 const content::NotificationDetails& details) { |
| 416 // The error is invalidated if the extension has been loaded or removed. | 417 // The error is invalidated if the extension has been loaded or removed. |
| 417 DCHECK(type == chrome::NOTIFICATION_EXTENSION_LOADED || | 418 DCHECK(type == chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED || |
| 418 type == chrome::NOTIFICATION_EXTENSION_REMOVED); | 419 type == chrome::NOTIFICATION_EXTENSION_REMOVED); |
| 419 const Extension* extension = content::Details<const Extension>(details).ptr(); | 420 const Extension* extension = content::Details<const Extension>(details).ptr(); |
| 420 if (extension != extension_) | 421 if (extension != extension_) |
| 421 return; | 422 return; |
| 422 GlobalErrorService* error_service = | 423 GlobalErrorService* error_service = |
| 423 GlobalErrorServiceFactory::GetForProfile(service_->profile()); | 424 GlobalErrorServiceFactory::GetForProfile(service_->profile()); |
| 424 error_service->RemoveGlobalError(this); | 425 error_service->RemoveGlobalError(this); |
| 425 service_->AcknowledgeExternalExtension(extension_->id()); | 426 service_->AcknowledgeExternalExtension(extension_->id()); |
| 426 delete this; | 427 delete this; |
| 427 } | 428 } |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 | 553 |
| 553 bool HasExternalInstallBubble(ExtensionService* service) { | 554 bool HasExternalInstallBubble(ExtensionService* service) { |
| 554 GlobalErrorService* error_service = | 555 GlobalErrorService* error_service = |
| 555 GlobalErrorServiceFactory::GetForProfile(service->profile()); | 556 GlobalErrorServiceFactory::GetForProfile(service->profile()); |
| 556 GlobalError* error = error_service->GetGlobalErrorByMenuItemCommandID( | 557 GlobalError* error = error_service->GetGlobalErrorByMenuItemCommandID( |
| 557 kMenuCommandId); | 558 kMenuCommandId); |
| 558 return error && error->HasBubbleView(); | 559 return error && error->HasBubbleView(); |
| 559 } | 560 } |
| 560 | 561 |
| 561 } // namespace extensions | 562 } // namespace extensions |
| OLD | NEW |