diff options
Diffstat (limited to 'chrome/browser')
7 files changed, 28 insertions, 124 deletions
diff --git a/chrome/browser/chromeos/arc/arc_auth_service.cc b/chrome/browser/chromeos/arc/arc_auth_service.cc index 60802a3..7dba38b 100644 --- a/chrome/browser/chromeos/arc/arc_auth_service.cc +++ b/chrome/browser/chromeos/arc/arc_auth_service.cc @@ -202,17 +202,24 @@ void ArcAuthService::OnPrimaryUserProfilePrepared(Profile* profile) { profile_, GURL(site_url)); CHECK(storage_partition_); - pref_change_registrar_.Init(profile_->GetPrefs()); - pref_change_registrar_.Add( - prefs::kArcEnabled, base::Bind(&ArcAuthService::OnOptInPreferenceChanged, - base::Unretained(this))); - if (profile_->GetPrefs()->GetBoolean(prefs::kArcEnabled)) { - OnOptInPreferenceChanged(); - } else { - if (!disable_ui_for_testing && profile_->IsNewProfile()) { - PrefServiceSyncableFromProfile(profile_)->AddObserver(this); - OnIsSyncingChanged(); + // In case UI is disabled we assume that ARC is opted-in. + if (!IsOptInVerificationDisabled()) { + pref_change_registrar_.Init(profile_->GetPrefs()); + pref_change_registrar_.Add( + prefs::kArcEnabled, + base::Bind(&ArcAuthService::OnOptInPreferenceChanged, + base::Unretained(this))); + if (profile_->GetPrefs()->GetBoolean(prefs::kArcEnabled)) { + OnOptInPreferenceChanged(); + } else { + if (!disable_ui_for_testing && profile_->IsNewProfile()) { + PrefServiceSyncableFromProfile(profile_)->AddObserver(this); + OnIsSyncingChanged(); + } } + } else { + auth_code_.clear(); + StartArc(); } } @@ -291,20 +298,16 @@ void ArcAuthService::OnOptInPreferenceChanged() { if (profile_->GetPrefs()->GetBoolean(prefs::kArcEnabled)) { if (state_ != State::ACTIVE) { + CloseUI(); auth_code_.clear(); - if (!IsOptInVerificationDisabled()) { - CloseUI(); - if (!profile_->GetPrefs()->GetBoolean(prefs::kArcSignedIn)) { - // Need pre-fetch auth code and show OptIn UI if needed. - initial_opt_in_ = true; - SetState(State::FETCHING_CODE); - FetchAuthCode(); - } else { - // Ready to start Arc. - StartArc(); - } + if (!profile_->GetPrefs()->GetBoolean(prefs::kArcSignedIn)) { + // Need pre-fetch auth code and show OptIn UI if needed. + initial_opt_in_ = true; + SetState(State::FETCHING_CODE); + FetchAuthCode(); } else { + // Ready to start Arc. StartArc(); } } diff --git a/chrome/browser/policy/DEPS b/chrome/browser/policy/DEPS index 382e9d0..468cb59 100644 --- a/chrome/browser/policy/DEPS +++ b/chrome/browser/policy/DEPS @@ -1,7 +1,6 @@ include_rules = [ "+chrome", "+chromeos", - "+components/arc/test", "+components/drive/drive_pref_names.h", "+components/user_manager", "+content/public/browser", diff --git a/chrome/browser/policy/configuration_policy_handler_list_factory.cc b/chrome/browser/policy/configuration_policy_handler_list_factory.cc index ba007c9..5ee927f 100644 --- a/chrome/browser/policy/configuration_policy_handler_list_factory.cc +++ b/chrome/browser/policy/configuration_policy_handler_list_factory.cc @@ -502,9 +502,6 @@ const PolicyToPreferenceMapEntry kSimplePolicyMap[] = { { key::kUnifiedDesktopEnabledByDefault, prefs::kUnifiedDesktopEnabledByDefault, base::Value::TYPE_BOOLEAN }, - { key::kArcEnabled, - prefs::kArcEnabled, - base::Value::TYPE_BOOLEAN }, #endif // defined(OS_CHROMEOS) // Metrics reporting is controlled by a platform specific policy for ChromeOS diff --git a/chrome/browser/policy/policy_browsertest.cc b/chrome/browser/policy/policy_browsertest.cc index be00c54..eb72c63 100644 --- a/chrome/browser/policy/policy_browsertest.cc +++ b/chrome/browser/policy/policy_browsertest.cc @@ -191,20 +191,9 @@ #include "ash/shell.h" #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" #include "chrome/browser/chromeos/accessibility/magnification_manager.h" -#include "chrome/browser/chromeos/arc/arc_auth_service.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/ui/ash/chrome_screenshot_grabber.h" -#include "chrome/browser/ui/ash/multi_user/multi_user_util.h" #include "chromeos/audio/cras_audio_handler.h" -#include "chromeos/chromeos_switches.h" -#include "chromeos/dbus/dbus_thread_manager.h" -#include "chromeos/dbus/fake_session_manager_client.h" -#include "chromeos/dbus/session_manager_client.h" -#include "components/arc/arc_bridge_service.h" -#include "components/arc/arc_bridge_service_impl.h" -#include "components/arc/arc_service_manager.h" -#include "components/arc/test/fake_arc_bridge_bootstrap.h" -#include "components/arc/test/fake_arc_bridge_instance.h" #include "ui/chromeos/accessibility_types.h" #include "ui/keyboard/keyboard_util.h" #include "ui/snapshot/screenshot_grabber.h" @@ -4002,87 +3991,6 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, UnifiedDesktopEnabledByDefault) { UpdateProviderPolicy(policies); EXPECT_FALSE(display_manager->unified_desktop_enabled()); } - -class ArcPolicyTest : public PolicyTest { - public: - ArcPolicyTest() {} - ~ArcPolicyTest() override {} - - protected: - void SetUpTest() { - base::CommandLine::ForCurrentProcess()->AppendSwitch( - chromeos::switches::kDisableArcOptInVerification); - arc::ArcAuthService::DisableUIForTesting(); - - arc::ArcServiceManager::Get()->OnPrimaryUserProfilePrepared( - multi_user_util::GetAccountIdFromProfile(browser()->profile())); - arc::ArcAuthService::Get()->OnPrimaryUserProfilePrepared( - browser()->profile()); - } - - void TearDownTest() { - arc::ArcAuthService::Get()->Shutdown(); - } - - void SetUpInProcessBrowserTestFixture() override { - PolicyTest::SetUpInProcessBrowserTestFixture(); - fake_session_manager_client_ = new chromeos::FakeSessionManagerClient; - fake_session_manager_client_->set_arc_available(true); - chromeos::DBusThreadManager::GetSetterForTesting()->SetSessionManagerClient( - scoped_ptr<chromeos::SessionManagerClient>( - fake_session_manager_client_)); - - fake_arc_bridge_instance_.reset(new arc::FakeArcBridgeInstance); - arc::ArcServiceManager::SetArcBridgeServiceForTesting(make_scoped_ptr( - new arc::ArcBridgeServiceImpl(make_scoped_ptr( - new arc::FakeArcBridgeBootstrap( - fake_arc_bridge_instance_.get()))))); - } - - private: - chromeos::FakeSessionManagerClient *fake_session_manager_client_; - scoped_ptr<arc::FakeArcBridgeInstance> fake_arc_bridge_instance_; - - DISALLOW_COPY_AND_ASSIGN(ArcPolicyTest); -}; - -// Test ArcEnabled policy. -IN_PROC_BROWSER_TEST_F(ArcPolicyTest, ArcEnabled) { - SetUpTest(); - - const PrefService* const pref = browser()->profile()->GetPrefs(); - const arc::ArcBridgeService* const arc_bridge_service - = arc::ArcBridgeService::Get(); - - // ARC is switched off by default. - EXPECT_EQ(arc::ArcBridgeService::State::STOPPED, arc_bridge_service->state()); - EXPECT_FALSE(pref->GetBoolean(prefs::kArcEnabled)); - - // Enable ARC. - PolicyMap policies; - policies.Set(key::kArcEnabled, - POLICY_LEVEL_MANDATORY, - POLICY_SCOPE_USER, - POLICY_SOURCE_CLOUD, - new base::FundamentalValue(true), - nullptr); - UpdateProviderPolicy(policies); - EXPECT_TRUE(pref->GetBoolean(prefs::kArcEnabled)); - EXPECT_EQ(arc::ArcBridgeService::State::READY, arc_bridge_service->state()); - - // Disable ARC. - policies.Set(key::kArcEnabled, - POLICY_LEVEL_MANDATORY, - POLICY_SCOPE_USER, - POLICY_SOURCE_CLOUD, - new base::FundamentalValue(false), - nullptr); - UpdateProviderPolicy(policies); - EXPECT_FALSE(pref->GetBoolean(prefs::kArcEnabled)); - EXPECT_EQ(arc::ArcBridgeService::State::STOPPED, arc_bridge_service->state()); - - TearDownTest(); -} #endif // defined(OS_CHROMEOS) } // namespace policy diff --git a/chrome/browser/resources/options/browser_options.html b/chrome/browser/resources/options/browser_options.html index 478ec4d..77ee6a1 100644 --- a/chrome/browser/resources/options/browser_options.html +++ b/chrome/browser/resources/options/browser_options.html @@ -222,7 +222,7 @@ </div> </section> <if expr="chromeos"> - <section id="android-apps-section" guest-visibility="hidden"> + <section id="andorid-apps-section" guest-visibility="hidden"> <h3 i18n-content="androidAppsTitle"></h3> <div class="checkbox controlled-setting-with-label"> <label> @@ -230,8 +230,6 @@ metric="Options_AndroidApps" type="checkbox"> <span> <span i18n-content="androidAppsEnabled"></span> - <span class="controlled-setting-indicator" - pref="arc.enabled"></span> </span> </label> </div> diff --git a/chrome/browser/resources/options/browser_options.js b/chrome/browser/resources/options/browser_options.js index 60c23a2..2b63e80 100644 --- a/chrome/browser/resources/options/browser_options.js +++ b/chrome/browser/resources/options/browser_options.js @@ -2327,11 +2327,10 @@ cr.define('options', function() { }; /** - * Hides Android Apps settings when they are not available. - * (Chrome OS only). + * Hides Android Apps settings when they are not available (ChromeOS only). */ BrowserOptions.hideAndroidAppsSection = function() { - var section = $('android-apps-section'); + var section = $('andorid-apps-section'); if (section) section.hidden = true; }; diff --git a/chrome/browser/ui/webui/options/chromeos/guest_mode_options_browsertest.js b/chrome/browser/ui/webui/options/chromeos/guest_mode_options_browsertest.js index f4a0d0e..b7a52858 100644 --- a/chrome/browser/ui/webui/options/chromeos/guest_mode_options_browsertest.js +++ b/chrome/browser/ui/webui/options/chromeos/guest_mode_options_browsertest.js @@ -44,7 +44,7 @@ GuestModeOptionsUIBrowserTest.prototype = { TEST_F('GuestModeOptionsUIBrowserTest', 'testSections', function() { this.expectHidden($('startup-section')); this.expectHidden($('appearance-section')); - this.expectHidden($('android-apps-section')); + this.expectHidden($('andorid-apps-section')); this.expectHidden($('sync-users-section')); this.expectHidden($('easy-unlock-section')); this.expectHidden($('reset-profile-settings-section')); |
