Commit d6f22089 authored by Long Cheng's avatar Long Cheng Committed by Commit Bot

Show contact admin dialog

1. Show default ARC system app in launcher on tablet form factor devices
when ARC is disabled by admin.
2. Show Chrome dialog when user tries to launch default ARC app. Dialog
text lists in the bug.

Bug: 1019519
Change-Id: I2fd2d98656880355d50daabd55ee300de772ee22
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1900249Reviewed-by: default avatarYusuke Sato <yusukes@chromium.org>
Reviewed-by: default avatarYury Khmel <khmel@chromium.org>
Commit-Queue: Long Cheng <lgcheng@google.com>
Cr-Commit-Position: refs/heads/master@{#715378}
parent 13051c93
...@@ -40,7 +40,10 @@ ...@@ -40,7 +40,10 @@
#include "chrome/browser/profiles/profiles_state.h" #include "chrome/browser/profiles/profiles_state.h"
#include "chrome/browser/tab_contents/tab_util.h" #include "chrome/browser/tab_contents/tab_util.h"
#include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
#include "chrome/browser/ui/simple_message_box.h"
#include "chrome/grit/generated_resources.h"
#include "chromeos/constants/chromeos_features.h" #include "chromeos/constants/chromeos_features.h"
#include "chromeos/constants/chromeos_switches.h"
#include "components/arc/arc_features.h" #include "components/arc/arc_features.h"
#include "components/arc/arc_prefs.h" #include "components/arc/arc_prefs.h"
#include "components/arc/arc_util.h" #include "components/arc/arc_util.h"
...@@ -54,6 +57,7 @@ ...@@ -54,6 +57,7 @@
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "content/public/common/user_agent.h" #include "content/public/common/user_agent.h"
#include "ui/aura/window.h" #include "ui/aura/window.h"
#include "ui/base/l10n/l10n_util.h"
#include "url/gurl.h" #include "url/gurl.h"
namespace arc { namespace arc {
...@@ -234,6 +238,12 @@ bool IsArcAllowedForProfileInternal(const Profile* profile, ...@@ -234,6 +238,12 @@ bool IsArcAllowedForProfileInternal(const Profile* profile,
return true; return true;
} }
void ShowContactAdminDialog() {
chrome::ShowWarningMessageBox(
nullptr, l10n_util::GetStringUTF16(IDS_ARC_OPT_IN_CONTACT_ADMIN_TITLE),
l10n_util::GetStringUTF16(IDS_ARC_OPT_IN_CONTACT_ADMIN_CONTEXT));
}
} // namespace } // namespace
bool IsRealUserProfile(const Profile* profile) { bool IsRealUserProfile(const Profile* profile) {
...@@ -367,6 +377,12 @@ bool SetArcPlayStoreEnabledForProfile(Profile* profile, bool enabled) { ...@@ -367,6 +377,12 @@ bool SetArcPlayStoreEnabledForProfile(Profile* profile, bool enabled) {
if (IsArcPlayStoreEnabledPreferenceManagedForProfile(profile)) { if (IsArcPlayStoreEnabledPreferenceManagedForProfile(profile)) {
if (enabled && !IsArcPlayStoreEnabledForProfile(profile)) { if (enabled && !IsArcPlayStoreEnabledForProfile(profile)) {
LOG(WARNING) << "Attempt to enable disabled by policy ARC."; LOG(WARNING) << "Attempt to enable disabled by policy ARC.";
if (chromeos::switches::IsTabletFormFactor()) {
VLOG(1) << "Showing contact admin dialog managed user of tablet form "
"factor devices.";
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::BindOnce(&ShowContactAdminDialog));
}
return false; return false;
} }
VLOG(1) << "Google-Play-Store-enabled pref is managed. Request to " VLOG(1) << "Google-Play-Store-enabled pref is managed. Request to "
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
#include "chrome/grit/generated_resources.h" #include "chrome/grit/generated_resources.h"
#include "chromeos/constants/chromeos_features.h" #include "chromeos/constants/chromeos_features.h"
#include "chromeos/constants/chromeos_switches.h"
#include "components/arc/arc_prefs.h" #include "components/arc/arc_prefs.h"
#include "components/arc/arc_service_manager.h" #include "components/arc/arc_service_manager.h"
#include "components/arc/arc_util.h" #include "components/arc/arc_util.h"
...@@ -922,8 +923,9 @@ void ArcAppListPrefs::SetDefaultAppsFilterLevel() { ...@@ -922,8 +923,9 @@ void ArcAppListPrefs::SetDefaultAppsFilterLevel() {
// Match this requirement and don't show pre-installed apps for managed users // Match this requirement and don't show pre-installed apps for managed users
// in app list. // in app list.
if (arc::policy_util::IsAccountManaged(profile_)) { if (arc::policy_util::IsAccountManaged(profile_)) {
if (profile_->IsChild()) { if (profile_->IsChild() || chromeos::switches::IsTabletFormFactor()) {
// For child accounts, filter only optional apps. // For child accounts, filter only optional apps.
// For tablet form factor devices, filter only optional apps.
default_apps_->set_filter_level( default_apps_->set_filter_level(
ArcDefaultAppList::FilterLevel::OPTIONAL_APPS); ArcDefaultAppList::FilterLevel::OPTIONAL_APPS);
} else { } else {
......
...@@ -324,7 +324,8 @@ bool LaunchAppWithIntent(content::BrowserContext* context, ...@@ -324,7 +324,8 @@ bool LaunchAppWithIntent(content::BrowserContext* context,
// The setting can fail if the preference is managed. However, the // The setting can fail if the preference is managed. However, the
// caller is responsible to not call this function in such case. DCHECK // caller is responsible to not call this function in such case. DCHECK
// is here to prevent possible mistake. // is here to prevent possible mistake.
SetArcPlayStoreEnabledForProfile(profile, true); if (!SetArcPlayStoreEnabledForProfile(profile, true))
return false;
DCHECK(IsArcPlayStoreEnabledForProfile(profile)); DCHECK(IsArcPlayStoreEnabledForProfile(profile));
// PlayStore item has special handling for shelf controllers. In order // PlayStore item has special handling for shelf controllers. In order
......
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