Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(467)

Unified Diff: chrome/browser/signin/easy_unlock_service.cc

Issue 564663003: easy_unlock: When loading the easy-unlock app, make sure it's enabled (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/signin/easy_unlock_service.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/signin/easy_unlock_service.cc
diff --git a/chrome/browser/signin/easy_unlock_service.cc b/chrome/browser/signin/easy_unlock_service.cc
index b86a311f0cd9d35ad9c4f2e0abbf89c377a19479..5377dd0ec226fc3397a65add7332c7dd3ebd7614 100644
--- a/chrome/browser/signin/easy_unlock_service.cc
+++ b/chrome/browser/signin/easy_unlock_service.cc
@@ -4,6 +4,8 @@
#include "chrome/browser/signin/easy_unlock_service.h"
+#include <string>
Tim Song 2014/09/15 23:53:53 Why do you need this?
tbarzic 2014/09/16 00:05:02 just fixing error reported by git cl lint (we use
+
#include "base/bind.h"
#include "base/command_line.h"
#include "base/logging.h"
@@ -126,7 +128,7 @@ class EasyUnlockService::PowerMonitor :
private:
// chromeos::PowerManagerClient::Observer:
virtual void SuspendImminent() OVERRIDE {
- service_->DisableApp();
+ service_->DisableAppIfLoaded();
service_->screenlock_state_handler_.reset();
}
@@ -355,35 +357,23 @@ void EasyUnlockService::LoadApp() {
extensions::ComponentLoader* loader = GetComponentLoader(profile_);
if (!loader->Exists(extension_misc::kEasyUnlockAppId)) {
loader->Add(IDR_EASY_UNLOCK_MANIFEST, easy_unlock_path);
- } else {
- extensions::ExtensionRegistry* registry =
- extensions::ExtensionRegistry::Get(profile_);
-
- // If the app is installed but disabled, then enable it.
- if (registry->GetExtensionById(extension_misc::kEasyUnlockAppId,
- extensions::ExtensionRegistry::DISABLED)) {
- ExtensionService* extension_service =
- extensions::ExtensionSystem::Get(profile_)->extension_service();
- extension_service->EnableExtension(extension_misc::kEasyUnlockAppId);
- }
}
+ ExtensionService* extension_service =
+ extensions::ExtensionSystem::Get(profile_)->extension_service();
+ extension_service->EnableExtension(extension_misc::kEasyUnlockAppId);
}
#endif // defined(GOOGLE_CHROME_BUILD)
}
-void EasyUnlockService::DisableApp() {
+void EasyUnlockService::DisableAppIfLoaded() {
extensions::ComponentLoader* loader = GetComponentLoader(profile_);
- extensions::ExtensionRegistry* registry =
- extensions::ExtensionRegistry::Get(profile_);
+ if (!loader->Exists(extension_misc::kEasyUnlockAppId))
+ return;
- if (loader->Exists(extension_misc::kEasyUnlockAppId) &&
- registry->GetExtensionById(extension_misc::kEasyUnlockAppId,
- extensions::ExtensionRegistry::ENABLED)) {
- ExtensionService* extension_service =
- extensions::ExtensionSystem::Get(profile_)->extension_service();
- extension_service->DisableExtension(extension_misc::kEasyUnlockAppId,
- extensions::Extension::DISABLE_RELOAD);
- }
+ ExtensionService* extension_service =
+ extensions::ExtensionSystem::Get(profile_)->extension_service();
+ extension_service->DisableExtension(extension_misc::kEasyUnlockAppId,
+ extensions::Extension::DISABLE_RELOAD);
}
void EasyUnlockService::UpdateAppState() {
@@ -395,7 +385,7 @@ void EasyUnlockService::UpdateAppState() {
power_monitor_.reset(new PowerMonitor(this));
#endif
} else {
- DisableApp();
+ DisableAppIfLoaded();
// Reset the screenlock state handler to make sure Screenlock state set
// by Easy Unlock app is reset.
screenlock_state_handler_.reset();
« no previous file with comments | « chrome/browser/signin/easy_unlock_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698