Commit 3b1bfedd authored by Wenzhao Zang's avatar Wenzhao Zang Committed by Commit Bot

cros: Hide some apps in app launcher during demo mode

1) The screensaver app should be hidden because it doesn't make sense
   to let a user launch the screensaver.

2) The Web store and the Get Help app should be hidden per UI review.

Bug: 883034, 885364
Change-Id: Ic4c481cb0cea0b535efde16997f0c4ad74c11b33
Reviewed-on: https://chromium-review.googlesource.com/1222347Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Wenzhao (Colin) Zang <wzang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#592569}
parent 6eafcb24
...@@ -252,6 +252,15 @@ std::string DemoSession::GetScreensaverAppId() { ...@@ -252,6 +252,15 @@ std::string DemoSession::GetScreensaverAppId() {
return extension_misc::kScreensaverAppId; return extension_misc::kScreensaverAppId;
} }
// static
bool DemoSession::ShouldDisplayInAppLauncher(const std::string& app_id) {
if (!IsDeviceInDemoMode())
return true;
return app_id != GetScreensaverAppId() &&
app_id != extensions::kWebStoreAppId &&
app_id != extension_misc::kGeniusAppId;
}
void DemoSession::EnsureOfflineResourcesLoaded( void DemoSession::EnsureOfflineResourcesLoaded(
base::OnceClosure load_callback) { base::OnceClosure load_callback) {
if (offline_resources_loaded_) { if (offline_resources_loaded_) {
......
...@@ -92,6 +92,10 @@ class DemoSession : public session_manager::SessionManagerObserver, ...@@ -92,6 +92,10 @@ class DemoSession : public session_manager::SessionManagerObserver,
// Returns the id of the screensaver app based on the board name. // Returns the id of the screensaver app based on the board name.
static std::string GetScreensaverAppId(); static std::string GetScreensaverAppId();
// Returns whether the app with |app_id| should be displayed in app launcher
// in demo mode. Returns true for all apps in non-demo mode.
static bool ShouldDisplayInAppLauncher(const std::string& app_id);
// Ensures that the load of offline demo session resources is requested. // Ensures that the load of offline demo session resources is requested.
// |load_callback| will be run once the offline resource load finishes. // |load_callback| will be run once the offline resource load finishes.
void EnsureOfflineResourcesLoaded(base::OnceClosure load_callback); void EnsureOfflineResourcesLoaded(base::OnceClosure load_callback);
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "chrome/browser/ui/app_list/extension_app_utils.h" #include "chrome/browser/ui/app_list/extension_app_utils.h"
#include "chrome/browser/chromeos/login/demo_mode/demo_session.h"
#include "chrome/browser/extensions/extension_ui_util.h" #include "chrome/browser/extensions/extension_ui_util.h"
#include "extensions/common/extension.h" #include "extensions/common/extension.h"
...@@ -17,6 +18,7 @@ constexpr char const* kAppIdsHiddenInLauncher[] = {kChromeCameraAppId}; ...@@ -17,6 +18,7 @@ constexpr char const* kAppIdsHiddenInLauncher[] = {kChromeCameraAppId};
bool ShouldShowInLauncher(const extensions::Extension* extension, bool ShouldShowInLauncher(const extensions::Extension* extension,
content::BrowserContext* context) { content::BrowserContext* context) {
return !HideInLauncherById(extension->id()) && return !HideInLauncherById(extension->id()) &&
chromeos::DemoSession::ShouldDisplayInAppLauncher(extension->id()) &&
extensions::ui_util::ShouldDisplayInAppLauncher(extension, context); extensions::ui_util::ShouldDisplayInAppLauncher(extension, context);
} }
......
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