#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/signin/easy_unlock_service.h"
#include "chrome/common/extensions/api/screenlock_private.h"
+#include "chrome/common/extensions/extension_constants.h"
+#include "extensions/browser/app_window/app_window_registry.h"
#include "extensions/browser/event_router.h"
namespace screenlock = extensions::api::screenlock_private;
scoped_ptr<screenlock::SetLocked::Params> params(
screenlock::SetLocked::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
- if (params->locked)
+ if (params->locked) {
+ if (extension()->id() == extension_misc::kEasyUnlockAppId &&
+ AppWindowRegistry::Get(browser_context())
+ ->GetAppWindowForAppAndKey(extension()->id(),
+ "easy_unlock_pairing")) {
+ // Mark the Easy Unlock behaviour on the lock screen as the one initiated
+ // by the Easy Unlock setup app as a trial one.
+ // TODO(tbarzic): Move this logic to a new easyUnlockPrivate function.
+ EasyUnlockService* service = EasyUnlockService::Get(GetProfile());
+ if (service)
+ service->SetTrialRun();
+ }
ScreenlockBridge::Get()->Lock(GetProfile());
- else
+ } else {
ScreenlockBridge::Get()->Unlock(GetProfile());
+ }
SendResponse(error_.empty());
return true;
}
EXTENSION_FUNCTION_VALIDATE(params.get());
Profile* profile = Profile::FromBrowserContext(browser_context());
- EasyUnlockService::Get(profile)->FinalizeUnlock(params->accept);
+ EasyUnlockService* service = EasyUnlockService::Get(profile);
+ if (service)
+ service->FinalizeUnlock(params->accept);
return true;
}