diff options
author | kelvinp <kelvinp@chromium.org> | 2015-09-30 18:22:13 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-10-01 01:22:51 +0000 |
commit | 1b80b8f3228141bcea73fbd5c4d2fb62114e5110 (patch) | |
tree | b531bfcb950377e4e70ce3cb0ca7534394a25a66 /extensions | |
parent | 3c339c407958603390d6a1b4f0b86bd0044bdbb3 (diff) | |
download | chromium_src-1b80b8f3228141bcea73fbd5c4d2fb62114e5110.zip chromium_src-1b80b8f3228141bcea73fbd5c4d2fb62114e5110.tar.gz chromium_src-1b80b8f3228141bcea73fbd5c4d2fb62114e5110.tar.bz2 |
Add public session launch flag
This CL adds a flag to the launchData in chrome.runtime.app.onLaunched
to indicate whether the app is being launched in a public session.
BUG=508608
Review URL: https://codereview.chromium.org/1375353002
Cr-Commit-Position: refs/heads/master@{#351696}
Diffstat (limited to 'extensions')
8 files changed, 24 insertions, 0 deletions
diff --git a/extensions/browser/api/app_runtime/app_runtime_api.cc b/extensions/browser/api/app_runtime/app_runtime_api.cc index 39356c3..60c2c0d 100644 --- a/extensions/browser/api/app_runtime/app_runtime_api.cc +++ b/extensions/browser/api/app_runtime/app_runtime_api.cc @@ -52,6 +52,11 @@ void DispatchOnLaunchedEventImpl(const std::string& extension_id, launch_data->SetBoolean( "isKioskSession", ExtensionsBrowserClient::Get()->IsRunningInForcedAppMode()); + + launch_data->SetBoolean( + "isPublicSession", + ExtensionsBrowserClient::Get()->IsLoggedInAsPublicAccount()); + scoped_ptr<base::ListValue> args(new base::ListValue()); args->Append(launch_data.release()); scoped_ptr<Event> event(new Event(events::APP_RUNTIME_ON_LAUNCHED, diff --git a/extensions/browser/extensions_browser_client.h b/extensions/browser/extensions_browser_client.h index 8b66051..89763d9 100644 --- a/extensions/browser/extensions_browser_client.h +++ b/extensions/browser/extensions_browser_client.h @@ -164,6 +164,9 @@ class ExtensionsBrowserClient { // Return true if the system is run in forced app mode. virtual bool IsRunningInForcedAppMode() = 0; + // Return true if the user is logged in as a public session. + virtual bool IsLoggedInAsPublicAccount() = 0; + // Returns the embedder's ApiActivityMonitor for |context|. Returns NULL if // the embedder does not monitor extension API activity. virtual ApiActivityMonitor* GetApiActivityMonitor( diff --git a/extensions/browser/test_extensions_browser_client.cc b/extensions/browser/test_extensions_browser_client.cc index be9e4b5..d98f7af 100644 --- a/extensions/browser/test_extensions_browser_client.cc +++ b/extensions/browser/test_extensions_browser_client.cc @@ -142,6 +142,10 @@ void TestExtensionsBrowserClient::PermitExternalProtocolHandler() { bool TestExtensionsBrowserClient::IsRunningInForcedAppMode() { return false; } +bool TestExtensionsBrowserClient::IsLoggedInAsPublicAccount() { + return false; +} + ApiActivityMonitor* TestExtensionsBrowserClient::GetApiActivityMonitor( BrowserContext* context) { return NULL; diff --git a/extensions/browser/test_extensions_browser_client.h b/extensions/browser/test_extensions_browser_client.h index 86f0576..274a8a9 100644 --- a/extensions/browser/test_extensions_browser_client.h +++ b/extensions/browser/test_extensions_browser_client.h @@ -76,6 +76,7 @@ class TestExtensionsBrowserClient : public ExtensionsBrowserClient { bool DidVersionUpdate(content::BrowserContext* context) override; void PermitExternalProtocolHandler() override; bool IsRunningInForcedAppMode() override; + bool IsLoggedInAsPublicAccount() override; ApiActivityMonitor* GetApiActivityMonitor( content::BrowserContext* context) override; ExtensionSystemProvider* GetExtensionSystemFactory() override; diff --git a/extensions/common/api/app_runtime.idl b/extensions/common/api/app_runtime.idl index 0f8cb9c..e3339bd 100644 --- a/extensions/common/api/app_runtime.idl +++ b/extensions/common/api/app_runtime.idl @@ -63,6 +63,11 @@ namespace app.runtime { // kiosk session</a>. boolean? isKioskSession; + // Whether the app is being launched in a <a + // href="https://support.google.com/chrome/a/answer/3017014">Chrome OS + // public session</a>. + boolean? isPublicSession; + // Where the app is launched from. LaunchSource? source; }; diff --git a/extensions/renderer/resources/app_runtime_custom_bindings.js b/extensions/renderer/resources/app_runtime_custom_bindings.js index 309d4af..2b492c5 100644 --- a/extensions/renderer/resources/app_runtime_custom_bindings.js +++ b/extensions/renderer/resources/app_runtime_custom_bindings.js @@ -45,6 +45,7 @@ eventBindings.registerArgumentMassager('app.runtime.onLaunched', if (--numItems === 0) { var data = { isKioskSession: launchData.isKioskSession, + isPublicSession: launchData.isPublicSession, source: launchData.source }; if (items.length !== 0) { diff --git a/extensions/shell/browser/shell_extensions_browser_client.cc b/extensions/shell/browser/shell_extensions_browser_client.cc index 62b2a5f..a3ec44a 100644 --- a/extensions/shell/browser/shell_extensions_browser_client.cc +++ b/extensions/shell/browser/shell_extensions_browser_client.cc @@ -159,6 +159,10 @@ bool ShellExtensionsBrowserClient::IsRunningInForcedAppMode() { return false; } +bool ShellExtensionsBrowserClient::IsLoggedInAsPublicAccount() { + return false; +} + ApiActivityMonitor* ShellExtensionsBrowserClient::GetApiActivityMonitor( BrowserContext* context) { // app_shell doesn't monitor API function calls or events. diff --git a/extensions/shell/browser/shell_extensions_browser_client.h b/extensions/shell/browser/shell_extensions_browser_client.h index 8b65ccf..8c449ee 100644 --- a/extensions/shell/browser/shell_extensions_browser_client.h +++ b/extensions/shell/browser/shell_extensions_browser_client.h @@ -67,6 +67,7 @@ class ShellExtensionsBrowserClient : public ExtensionsBrowserClient { bool DidVersionUpdate(content::BrowserContext* context) override; void PermitExternalProtocolHandler() override; bool IsRunningInForcedAppMode() override; + bool IsLoggedInAsPublicAccount() override; ApiActivityMonitor* GetApiActivityMonitor( content::BrowserContext* context) override; ExtensionSystemProvider* GetExtensionSystemFactory() override; |