Commit 94208c2b authored by tbarzic's avatar tbarzic Committed by Commit bot

[Easy signin] Add method to get user info to easyUnlockPrivate

The method will return the user email and whether the user's logged in,
i.e. whether the app is running on signin screen.

Adds an event that's triggered when the user focused on login
screen changes.

While here, add logic to unload the app and reset signin profile
EasyUnlockService when user logs in.

Create the signin service only if enable-easy-signin switch is set.

BUG=401634

Review URL: https://codereview.chromium.org/576343002

Cr-Commit-Position: refs/heads/master@{#296120}
parent 3bcc3dfc
......@@ -4,8 +4,11 @@
#include "chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_api.h"
#include <vector>
#include "base/bind.h"
#include "base/lazy_instance.h"
#include "base/memory/linked_ptr.h"
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_crypto_delegate.h"
......@@ -566,5 +569,28 @@ bool EasyUnlockPrivateTrySignInSecretFunction::RunAsync() {
return true;
}
EasyUnlockPrivateGetUserInfoFunction::EasyUnlockPrivateGetUserInfoFunction() {
}
EasyUnlockPrivateGetUserInfoFunction::~EasyUnlockPrivateGetUserInfoFunction() {
}
bool EasyUnlockPrivateGetUserInfoFunction::RunSync() {
EasyUnlockService* service =
EasyUnlockService::Get(Profile::FromBrowserContext(browser_context()));
std::vector<linked_ptr<easy_unlock_private::UserInfo> > users;
std::string user_id = service->GetUserEmail();
if (!user_id.empty()) {
users.push_back(
linked_ptr<easy_unlock_private::UserInfo>(
new easy_unlock_private::UserInfo()));
users[0]->user_id = user_id;
users[0]->logged_in = service->GetType() == EasyUnlockService::TYPE_REGULAR;
users[0]->data_ready = service->GetRemoteDevices() != NULL;
}
results_ = easy_unlock_private::GetUserInfo::Results::Create(users);
return true;
}
} // namespace api
} // namespace extensions
......@@ -33,6 +33,8 @@ class EasyUnlockPrivateAPI : public BrowserContextKeyedAPI {
static BrowserContextKeyedAPIFactory<EasyUnlockPrivateAPI>*
GetFactoryInstance();
static const bool kServiceRedirectedInIncognito = true;
explicit EasyUnlockPrivateAPI(content::BrowserContext* context);
virtual ~EasyUnlockPrivateAPI();
......@@ -51,6 +53,8 @@ class EasyUnlockPrivateAPI : public BrowserContextKeyedAPI {
DISALLOW_COPY_AND_ASSIGN(EasyUnlockPrivateAPI);
};
// TODO(tbarzic): Replace SyncExtensionFunction/AsyncExtensionFunction overrides
// with UIThreadExtensionFunction throughout the file.
class EasyUnlockPrivateGetStringsFunction : public SyncExtensionFunction {
public:
EasyUnlockPrivateGetStringsFunction();
......@@ -310,6 +314,21 @@ class EasyUnlockPrivateTrySignInSecretFunction :
DISALLOW_COPY_AND_ASSIGN(EasyUnlockPrivateTrySignInSecretFunction);
};
class EasyUnlockPrivateGetUserInfoFunction : public SyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("easyUnlockPrivate.getUserInfo",
EASYUNLOCKPRIVATE_GETUSERINFO)
EasyUnlockPrivateGetUserInfoFunction();
private:
virtual ~EasyUnlockPrivateGetUserInfoFunction();
// SyncExtensionFunction:
virtual bool RunSync() OVERRIDE;
DISALLOW_COPY_AND_ASSIGN(EasyUnlockPrivateGetUserInfoFunction);
};
} // namespace api
} // namespace extensions
......
......@@ -114,6 +114,10 @@ void ScreenlockPrivateEventRouter::OnScreenDidUnlock() {
new base::FundamentalValue(false));
}
void ScreenlockPrivateEventRouter::OnFocusedUserChanged(
const std::string& user_id) {
}
void ScreenlockPrivateEventRouter::DispatchEvent(
const std::string& event_name,
base::Value* arg) {
......
......@@ -68,6 +68,7 @@ class ScreenlockPrivateEventRouter : public extensions::BrowserContextKeyedAPI,
// ScreenlockBridge::Observer
virtual void OnScreenDidLock() OVERRIDE;
virtual void OnScreenDidUnlock() OVERRIDE;
virtual void OnFocusedUserChanged(const std::string& user_id) OVERRIDE;
private:
friend class extensions::BrowserContextKeyedAPIFactory<
......
......@@ -152,6 +152,10 @@ void EasyUnlockScreenlockStateHandler::OnScreenDidLock() {
void EasyUnlockScreenlockStateHandler::OnScreenDidUnlock() {
}
void EasyUnlockScreenlockStateHandler::OnFocusedUserChanged(
const std::string& user_id) {
}
void EasyUnlockScreenlockStateHandler::UpdateTooltipOptions(
bool trial_run,
ScreenlockBridge::UserPodCustomIconOptions* icon_options) {
......
......@@ -63,6 +63,7 @@ class EasyUnlockScreenlockStateHandler : public ScreenlockBridge::Observer {
// ScreenlockBridge::Observer:
virtual void OnScreenDidLock() OVERRIDE;
virtual void OnScreenDidUnlock() OVERRIDE;
virtual void OnFocusedUserChanged(const std::string& user_id) OVERRIDE;
// Updates icon's tooltip options.
// |trial_run|: Whether the trial Easy Unlock run is in progress.
......
......@@ -18,11 +18,13 @@
#include "chrome/browser/signin/easy_unlock_service_observer.h"
#include "chrome/browser/signin/screenlock_bridge.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/api/easy_unlock_private.h"
#include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/pref_names.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "device/bluetooth/bluetooth_adapter.h"
#include "device/bluetooth/bluetooth_adapter_factory.h"
#include "extensions/browser/event_router.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h"
#include "extensions/common/one_shot_event.h"
......@@ -128,6 +130,7 @@ class EasyUnlockService::PowerMonitor :
EasyUnlockService::EasyUnlockService(Profile* profile)
: profile_(profile),
bluetooth_detector_(new BluetoothDetector(this)),
shut_down_(false),
weak_ptr_factory_(this) {
extensions::ExtensionSystem::Get(profile_)->ready().Post(
FROM_HERE,
......@@ -160,6 +163,9 @@ void EasyUnlockService::RegisterProfilePrefs(
}
bool EasyUnlockService::IsAllowed() {
if (shut_down_)
return false;
if (!IsAllowedInternal())
return false;
......@@ -205,6 +211,22 @@ void EasyUnlockService::RemoveObserver(EasyUnlockServiceObserver* observer) {
observers_.RemoveObserver(observer);
}
void EasyUnlockService::Shutdown() {
if (shut_down_)
return;
shut_down_ = true;
ShutdownInternal();
weak_ptr_factory_.InvalidateWeakPtrs();
ResetScreenlockStateHandler();
bluetooth_detector_.reset();
#if defined(OS_CHROMEOS)
power_monitor_.reset();
#endif
}
void EasyUnlockService::LoadApp() {
DCHECK(IsAllowed());
......@@ -231,13 +253,15 @@ void EasyUnlockService::LoadApp() {
ExtensionService* extension_service =
extensions::ExtensionSystem::Get(profile_)->extension_service();
extension_service->EnableExtension(extension_misc::kEasyUnlockAppId);
NotifyUserUpdated();
}
#endif // defined(GOOGLE_CHROME_BUILD)
}
void EasyUnlockService::DisableAppIfLoaded() {
// Make sure lock screen state set by the extension gets reset.
screenlock_state_handler_.reset();
ResetScreenlockStateHandler();
extensions::ComponentLoader* loader = GetComponentLoader(profile_);
if (!loader->Exists(extension_misc::kEasyUnlockAppId))
......@@ -249,16 +273,21 @@ void EasyUnlockService::DisableAppIfLoaded() {
extensions::Extension::DISABLE_RELOAD);
}
void EasyUnlockService::UnloadApp() {
GetComponentLoader(profile_)->Remove(extension_misc::kEasyUnlockAppId);
}
void EasyUnlockService::ReloadApp() {
// Make sure lock screen state set by the extension gets reset.
screenlock_state_handler_.reset();
ResetScreenlockStateHandler();
if (GetComponentLoader(profile_)->Exists(extension_misc::kEasyUnlockAppId)) {
extensions::ExtensionSystem* extension_system =
extensions::ExtensionSystem::Get(profile_);
extension_system->extension_service()->ReloadExtension(
extension_misc::kEasyUnlockAppId);
}
if (!GetComponentLoader(profile_)->Exists(extension_misc::kEasyUnlockAppId))
return;
extensions::ExtensionSystem* extension_system =
extensions::ExtensionSystem::Get(profile_);
extension_system->extension_service()->ReloadExtension(
extension_misc::kEasyUnlockAppId);
NotifyUserUpdated();
}
void EasyUnlockService::UpdateAppState() {
......@@ -277,11 +306,37 @@ void EasyUnlockService::UpdateAppState() {
}
}
void EasyUnlockService::NotifyUserUpdated() {
std::string user_id = GetUserEmail();
if (user_id.empty())
return;
// Notify the easy unlock app that the user info changed.
extensions::api::easy_unlock_private::UserInfo info;
info.user_id = user_id;
info.logged_in = GetType() == TYPE_REGULAR;
info.data_ready = GetRemoteDevices() != NULL;
scoped_ptr<base::ListValue> args(new base::ListValue());
args->Append(info.ToValue().release());
scoped_ptr<extensions::Event> event(new extensions::Event(
extensions::api::easy_unlock_private::OnUserInfoUpdated::kEventName,
args.Pass()));
extensions::EventRouter::Get(profile_)->DispatchEventToExtension(
extension_misc::kEasyUnlockAppId, event.Pass());
}
void EasyUnlockService::NotifyTurnOffOperationStatusChanged() {
FOR_EACH_OBSERVER(
EasyUnlockServiceObserver, observers_, OnTurnOffOperationStatusChanged());
}
void EasyUnlockService::ResetScreenlockStateHandler() {
screenlock_state_handler_.reset();
}
void EasyUnlockService::Initialize() {
InitializeInternal();
......
......@@ -94,33 +94,48 @@ class EasyUnlockService : public KeyedService {
explicit EasyUnlockService(Profile* profile);
virtual ~EasyUnlockService();
// Does service type specific initialization.
// Does a service type specific initialization.
virtual void InitializeInternal() = 0;
// Does a service type specific shutdown. Called from |Shutdown|.
virtual void ShutdownInternal() = 0;
// Service type specific tests for whether the service is allowed. Returns
// false if service is not allowed. If true is returned, the service may still
// not be allowed if common tests fail (e.g. if Bluetooth is not available).
virtual bool IsAllowedInternal() = 0;
// KeyedService override:
virtual void Shutdown() OVERRIDE;
// Exposes the profile to which the service is attached to subclasses.
Profile* profile() const { return profile_; }
// Installs the Easy unlock component app if it isn't installed or enables
// the app if it is installed but disabled.
// Installs the Easy unlock component app if it isn't installed and enables
// the app if it is disabled.
void LoadApp();
// Disables the Easy unlock component app if it's loaded.
void DisableAppIfLoaded();
// Unloads the Easy unlock component app if it's loaded.
void UnloadApp();
// Reloads the Easy unlock component app if it's loaded.
void ReloadApp();
// Checks whether Easy unlock should be running and updates app state.
void UpdateAppState();
// Notifies the easy unlock app that the user state has been updated.
void NotifyUserUpdated();
// Notifies observers that the turn off flow status changed.
void NotifyTurnOffOperationStatusChanged();
// Resets |screenlock_state_handler_|.
void ResetScreenlockStateHandler();
private:
// A class to detect whether a bluetooth adapter is present.
class BluetoothDetector;
......@@ -144,6 +159,9 @@ class EasyUnlockService : public KeyedService {
scoped_ptr<PowerMonitor> power_monitor_;
#endif
// Whether the service has been shut down.
bool shut_down_;
ObserverList<EasyUnlockServiceObserver> observers_;
base::WeakPtrFactory<EasyUnlockService> weak_ptr_factory_;
......
......@@ -4,6 +4,7 @@
#include "chrome/browser/signin/easy_unlock_service_factory.h"
#include "base/command_line.h"
#include "base/memory/singleton.h"
#include "chrome/browser/profiles/incognito_helpers.h"
#include "chrome/browser/profiles/profile.h"
......@@ -16,6 +17,7 @@
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/profiles/profile_helper.h"
#include "chrome/browser/signin/easy_unlock_service_signin_chromeos.h"
#include "chromeos/chromeos_switches.h"
#endif
// static
......@@ -46,7 +48,12 @@ KeyedService* EasyUnlockServiceFactory::BuildServiceInstanceFor(
#if defined(OS_CHROMEOS)
if (chromeos::ProfileHelper::IsSigninProfile(
Profile::FromBrowserContext(context))) {
return new EasyUnlockServiceSignin(Profile::FromBrowserContext(context));
if (CommandLine::ForCurrentProcess()->HasSwitch(
chromeos::switches::kEnableEasySignin)) {
return new EasyUnlockServiceSignin(Profile::FromBrowserContext(context));
} else {
return NULL;
}
}
#endif
return new EasyUnlockServiceRegular(Profile::FromBrowserContext(context));
......
......@@ -165,6 +165,12 @@ void EasyUnlockServiceRegular::InitializeInternal() {
OnPrefsChanged();
}
void EasyUnlockServiceRegular::ShutdownInternal() {
turn_off_flow_.reset();
turn_off_flow_status_ = EasyUnlockService::IDLE;
registrar_.RemoveAll();
}
bool EasyUnlockServiceRegular::IsAllowedInternal() {
#if defined(OS_CHROMEOS)
if (!user_manager::UserManager::Get()->IsLoggedInAsRegularUser())
......
......@@ -43,6 +43,7 @@ class EasyUnlockServiceRegular : public EasyUnlockService {
virtual TurnOffFlowStatus GetTurnOffFlowStatus() const OVERRIDE;
virtual std::string GetChallenge() const OVERRIDE;
virtual void InitializeInternal() OVERRIDE;
virtual void ShutdownInternal() OVERRIDE;
virtual bool IsAllowedInternal() OVERRIDE;
// Callback when the controlling pref changes.
......
......@@ -6,7 +6,6 @@
#include "base/basictypes.h"
#include "base/bind.h"
#include "base/command_line.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/stl_util.h"
......@@ -14,7 +13,6 @@
#include "base/time/time.h"
#include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_key_manager.h"
#include "chrome/browser/chromeos/login/session/user_session_manager.h"
#include "chromeos/chromeos_switches.h"
#include "chromeos/login/auth/user_context.h"
namespace {
......@@ -93,11 +91,11 @@ EasyUnlockServiceSignin::UserData::~UserData() {}
EasyUnlockServiceSignin::EasyUnlockServiceSignin(Profile* profile)
: EasyUnlockService(profile),
allow_cryptohome_backoff_(true),
service_active_(false),
weak_ptr_factory_(this) {
}
EasyUnlockServiceSignin::~EasyUnlockServiceSignin() {
STLDeleteContainerPairSecondPointers(user_data_.begin(), user_data_.end());
}
EasyUnlockService::Type EasyUnlockServiceSignin::GetType() const {
......@@ -164,19 +162,72 @@ std::string EasyUnlockServiceSignin::GetChallenge() const {
}
void EasyUnlockServiceSignin::InitializeInternal() {
if (chromeos::LoginState::Get()->IsUserLoggedIn())
return;
service_active_ = true;
chromeos::LoginState::Get()->AddObserver(this);
ScreenlockBridge* screenlock_bridge = ScreenlockBridge::Get();
screenlock_bridge->AddObserver(this);
if (!screenlock_bridge->focused_user_id().empty())
OnFocusedUserChanged(screenlock_bridge->focused_user_id());
}
void EasyUnlockServiceSignin::ShutdownInternal() {
if (!service_active_)
return;
service_active_ = false;
weak_ptr_factory_.InvalidateWeakPtrs();
ScreenlockBridge::Get()->RemoveObserver(this);
chromeos::LoginState::Get()->RemoveObserver(this);
STLDeleteContainerPairSecondPointers(user_data_.begin(), user_data_.end());
user_data_.clear();
}
bool EasyUnlockServiceSignin::IsAllowedInternal() {
return !user_id_.empty() &&
FindLoadedDataForCurrentUser() &&
CommandLine::ForCurrentProcess()->HasSwitch(
chromeos::switches::kEnableEasySignin);
return service_active_ &&
!user_id_.empty() &&
!chromeos::LoginState::Get()->IsUserLoggedIn();
}
void EasyUnlockServiceSignin::OnScreenDidLock() {
}
void EasyUnlockServiceSignin::OnScreenDidUnlock() {
}
void EasyUnlockServiceSignin::OnFocusedUserChanged(const std::string& user_id) {
if (user_id_ == user_id)
return;
// Setting or clearing the user_id may changed |IsAllowed| value, so in these
// cases update the app state. Otherwise, it's enough to notify the app the
// user data has been updated.
bool should_update_app_state = user_id_.empty() != user_id.empty();
user_id_ = user_id;
ResetScreenlockStateHandler();
if (should_update_app_state) {
UpdateAppState();
} else {
NotifyUserUpdated();
}
LoadCurrentUserDataIfNeeded();
}
void EasyUnlockServiceSignin::LoggedInStateChanged() {
if (!chromeos::LoginState::Get()->IsUserLoggedIn())
return;
UnloadApp();
Shutdown();
}
void EasyUnlockServiceSignin::LoadCurrentUserDataIfNeeded() {
if (user_id_.empty() ||
!CommandLine::ForCurrentProcess()->HasSwitch(
chromeos::switches::kEnableEasySignin))
if (user_id_.empty() || !service_active_)
return;
std::map<std::string, UserData*>::iterator it = user_data_.find(user_id_);
......@@ -210,12 +261,18 @@ void EasyUnlockServiceSignin::OnUserDataLoaded(
chromeos::EasyUnlockKeyManager::DeviceDataListToRemoteDeviceList(
user_id, devices, &data->remote_devices_value);
}
// If the fetched data belongs to the currently focused user, notify the app
// that it has to refresh it's user data.
if (user_id == user_id_)
NotifyUserUpdated();
}
const EasyUnlockServiceSignin::UserData*
EasyUnlockServiceSignin::FindLoadedDataForCurrentUser() const {
if (user_id_.empty())
return NULL;
std::map<std::string, UserData*>::const_iterator it =
user_data_.find(user_id_);
if (it == user_data_.end())
......
......@@ -14,9 +14,13 @@
#include "base/values.h"
#include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_types.h"
#include "chrome/browser/signin/easy_unlock_service.h"
#include "chrome/browser/signin/screenlock_bridge.h"
#include "chromeos/login/login_state.h"
// EasyUnlockService instance that should be used for signin profile.
class EasyUnlockServiceSignin : public EasyUnlockService {
class EasyUnlockServiceSignin : public EasyUnlockService,
public ScreenlockBridge::Observer,
public chromeos::LoginState::Observer {
public:
explicit EasyUnlockServiceSignin(Profile* profile);
virtual ~EasyUnlockServiceSignin();
......@@ -65,8 +69,17 @@ class EasyUnlockServiceSignin : public EasyUnlockService {
virtual void ResetTurnOffFlow() OVERRIDE;
virtual TurnOffFlowStatus GetTurnOffFlowStatus() const OVERRIDE;
virtual std::string GetChallenge() const OVERRIDE;
virtual bool IsAllowedInternal() OVERRIDE;
virtual void InitializeInternal() OVERRIDE;
virtual void ShutdownInternal() OVERRIDE;
virtual bool IsAllowedInternal() OVERRIDE;
// ScreenlockBridge::Observer implementation:
virtual void OnScreenDidLock() OVERRIDE;
virtual void OnScreenDidUnlock() OVERRIDE;
virtual void OnFocusedUserChanged(const std::string& user_id) OVERRIDE;
// chromeos::LoginState::Observer implementation:
virtual void LoggedInStateChanged() OVERRIDE;
// Loads the device data associated with the user's Easy unlock keys from
// crypthome.
......@@ -78,7 +91,7 @@ class EasyUnlockServiceSignin : public EasyUnlockService {
bool success,
const chromeos::EasyUnlockDeviceKeyDataList& data);
// If the device data has been loaded for the current user, returns is.
// If the device data has been loaded for the current user, returns it.
// Otherwise, returns NULL.
const UserData* FindLoadedDataForCurrentUser() const;
......@@ -94,6 +107,10 @@ class EasyUnlockServiceSignin : public EasyUnlockService {
// first data load finishes (even if it fails).
bool allow_cryptohome_backoff_;
// Whether the service has been successfully initialized, and has not been
// shut down.
bool service_active_;
base::WeakPtrFactory<EasyUnlockServiceSignin> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(EasyUnlockServiceSignin);
......
......@@ -137,6 +137,13 @@ void ScreenlockBridge::SetLockHandler(LockHandler* lock_handler) {
FOR_EACH_OBSERVER(Observer, observers_, OnScreenDidUnlock());
}
void ScreenlockBridge::SetFocusedUser(const std::string& user_id) {
if (user_id == focused_user_id_)
return;
focused_user_id_ = user_id;
FOR_EACH_OBSERVER(Observer, observers_, OnFocusedUserChanged(user_id));
}
bool ScreenlockBridge::IsLocked() const {
return lock_handler_ != NULL;
}
......
......@@ -29,6 +29,8 @@ class ScreenlockBridge {
virtual void OnScreenDidLock() = 0;
// Invoked after the screen lock is dismissed.
virtual void OnScreenDidUnlock() = 0;
// Invoked when the user focused on the lock screen changes.
virtual void OnFocusedUserChanged(const std::string& user_id) = 0;
protected:
virtual ~Observer() {}
};
......@@ -139,6 +141,7 @@ class ScreenlockBridge {
static std::string GetAuthenticatedUserEmail(Profile* profile);
void SetLockHandler(LockHandler* lock_handler);
void SetFocusedUser(const std::string& user_id);
bool IsLocked() const;
void Lock(Profile* profile);
......@@ -149,6 +152,8 @@ class ScreenlockBridge {
LockHandler* lock_handler() { return lock_handler_; }
std::string focused_user_id() const { return focused_user_id_; }
private:
friend struct base::DefaultLazyInstanceTraits<ScreenlockBridge>;
friend struct base::DefaultDeleter<ScreenlockBridge>;
......@@ -157,6 +162,8 @@ class ScreenlockBridge {
~ScreenlockBridge();
LockHandler* lock_handler_; // Not owned
// The last focused user's id.
std::string focused_user_id_;
ObserverList<Observer, true> observers_;
DISALLOW_COPY_AND_ASSIGN(ScreenlockBridge);
......
......@@ -327,6 +327,7 @@ SigninScreenHandler::~SigninScreenHandler() {
max_mode_delegate_.reset(NULL);
}
ScreenlockBridge::Get()->SetLockHandler(NULL);
ScreenlockBridge::Get()->SetFocusedUser("");
}
void SigninScreenHandler::DeclareLocalizedValues(
......@@ -1326,6 +1327,7 @@ void SigninScreenHandler::HandleUpdateOfflineLogin(bool offline_login_active) {
void SigninScreenHandler::HandleFocusPod(const std::string& user_id) {
SetUserInputMethod(user_id);
WallpaperManager::Get()->SetUserWallpaperDelayed(user_id);
ScreenlockBridge::Get()->SetFocusedUser(user_id);
}
void SigninScreenHandler::HandleHardlockPod(const std::string& user_id) {
......
......@@ -129,6 +129,20 @@
DOMString? psk;
};
// The information about a user associated with Easy unlock service.
dictionary UserInfo {
// The user id.
DOMString userId;
// Whether the user is logged in. If not logged in, the app is running on
// the signin screen.
boolean loggedIn;
// Whether all data needed to use Easy unlock service has been loaded for
// the user.
boolean dataReady;
};
// Callback for crypto methods that return a single array buffer.
callback DataCallback = void(optional ArrayBuffer data);
......@@ -148,6 +162,12 @@
// Callback for the getRemoteDevices() method.
callback GetRemoteDevicesCallback = void(Device[] devices);
// Callback for the |getUserInfo()| method. Note that the callback argument is
// a list for future use (on signin screen there may be more than one user
// associated with the easy unlock service). Currently the method returns at
// most one user.
callback GetUserInfoCallback = void(UserInfo[] users);
interface Functions {
// Gets localized strings required to render the API.
//
......@@ -268,5 +288,16 @@
// success, the user session will be started.
static void trySignInSecret(ArrayBuffer signInSecret,
EmptyCallback callback);
// Retrieves information about the user associated with the Easy unlock
// service.
static void getUserInfo(GetUserInfoCallback callback);
};
interface Events {
// Event fired when the data for the user currently associated with
// Easy unlock service is updated.
// |userInfo| The updated user information.
static void onUserInfoUpdated(UserInfo userInfo);
};
};
......@@ -954,6 +954,7 @@ enum HistogramValue {
ACCESSIBILITY_PRIVATE_SETFOCUSRING,
USB_GETCONFIGURATION,
WEBVIEWINTERNAL_SETALLOWTRANSPARENCY,
EASYUNLOCKPRIVATE_GETUSERINFO,
// Last entry: Add new entries above and ensure to update
// tools/metrics/histograms/histograms.xml.
ENUM_BOUNDARY
......
......@@ -41971,6 +41971,7 @@ Therefore, the affected-histogram name has to have at least one dot in it.
<int value="893" label="ACCESSIBILITY_PRIVATE_SETFOCUSRING"/>
<int value="894" label="USB_GETCONFIGURATION"/>
<int value="895" label="WEBVIEWINTERNAL_SETALLOWTRANSPARENCY"/>
<int value="896" label="EASYUNLOCKPRIVATE_GETUSERINFO"/>
</enum>
<enum name="ExtensionInstallCause" type="int">
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment