Commit d953e0f3 authored by Albert Chaulk's avatar Albert Chaulk Committed by Commit Bot

Fix DCHECK by adding loginState API

Bug: b/146151793
Test: None
Change-Id: I5df1739ce29d9fec4480988ef3a405a93de9d1e4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2072473Reviewed-by: default avatarDaniel Nicoara <dnicoara@chromium.org>
Commit-Queue: Albert Chaulk <achaulk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#760542}
parent 7861fd0f
......@@ -334,6 +334,8 @@ cast_source_set("browser") {
"extensions/api/i18n/i18n_api.h",
"extensions/api/identity/identity_api.cc",
"extensions/api/identity/identity_api.h",
"extensions/api/login_state/login_state.cc",
"extensions/api/login_state/login_state.h",
"extensions/api/notifications/notifications_api.cc",
"extensions/api/notifications/notifications_api.h",
"extensions/api/settings_private/settings_private_api.cc",
......
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chromecast/browser/extensions/api/login_state/login_state.h"
namespace {
const char kErrorNotImplemented[] = "API not implemented";
} // namespace
namespace extensions {
ExtensionFunction::ResponseAction LoginStateGetProfileTypeFunction::Run() {
return RespondNow(Error(kErrorNotImplemented));
}
ExtensionFunction::ResponseAction LoginStateGetSessionStateFunction::Run() {
return RespondNow(Error(kErrorNotImplemented));
}
} // namespace extensions
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROMECAST_BROWSER_EXTENSIONS_API_LOGIN_STATE_LOGIN_STATE_H_
#define CHROMECAST_BROWSER_EXTENSIONS_API_LOGIN_STATE_LOGIN_STATE_H_
#include "extensions/browser/extension_function.h"
namespace extensions {
class LoginStateGetProfileTypeFunction : public ExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("loginState.getProfileType",
LOGINSTATE_GETPROFILETYPE)
protected:
~LoginStateGetProfileTypeFunction() override {}
ResponseAction Run() override;
};
class LoginStateGetSessionStateFunction : public ExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("loginState.getSessionState",
LOGINSTATE_GETSESSIONSTATE)
protected:
~LoginStateGetSessionStateFunction() override {}
ResponseAction Run() override;
};
} // namespace extensions
#endif // CHROMECAST_BROWSER_EXTENSIONS_API_LOGIN_STATE_LOGIN_STATE_H_
......@@ -21,6 +21,7 @@ schema_sources = [
"history.json",
"i18n.json",
"identity.idl",
"login_state.idl",
"notifications.idl",
"settings_private.idl",
"tabs.json",
......
......@@ -88,6 +88,10 @@
"chrome://bookmarks/*"
]
}],
"loginState": {
"dependencies": ["permission:loginState"],
"contexts": ["blessed_extension"]
},
"settingsPrivate": [{
"dependencies": ["permission:settingsPrivate"],
"contexts": ["blessed_extension"]
......
......@@ -26,6 +26,10 @@
"channel": "stable",
"extension_types": ["extension", "legacy_packaged_app"]
},
"loginState": {
"channel": "stable",
"extension_types": ["login_screen_extension", "extension"]
},
"settingsPrivate": {
"channel": "stable",
"extension_types": ["extension", "legacy_packaged_app", "platform_app"]
......
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Use the <code>chrome.loginState</code> API to read and monitor the login
// state.
[implemented_in="chromecast/browser/extensions/api/login_state/login_state.h"]
namespace loginState {
enum ProfileType {
// The extension is in the signin profile.
SIGNIN_PROFILE,
// The extension is in the user profile.
USER_PROFILE
};
enum SessionState {
// The session state is unknown.
UNKNOWN,
// The user is in the out-of-box-experience screen.
IN_OOBE_SCREEN,
// The user is in the login screen.
IN_LOGIN_SCREEN,
// The user is in the session.
IN_SESSION,
// The user is in the lock screen.
IN_LOCK_SCREEN
};
callback ProfileTypeCallback = void (ProfileType result);
callback SessionStateCallback = void (SessionState result);
interface Functions {
// Gets the type of the profile the extension is in.
static void getProfileType(ProfileTypeCallback callback);
// Gets the current session state.
static void getSessionState(SessionStateCallback callback);
};
interface Events {
// Dispatched when the session state changes. <code>sessionState</code>
// is the new session state.
static void onSessionStateChanged(SessionState sessionState);
};
};
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