diff options
author | Ben Murdoch <benm@google.com> | 2014-10-29 14:53:36 +0000 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2014-10-29 14:53:36 +0000 |
commit | ab8f6f0bd665d3c1ff476eb06c58c42630e462d4 (patch) | |
tree | 15b4406dfa6b28391b19bcf760f1aeb04d13898a /chrome/browser | |
parent | 93b3e633be4a0f65c62fca1805fd44021e04beaa (diff) | |
download | chromium_org-ab8f6f0bd665d3c1ff476eb06c58c42630e462d4.tar.gz |
Merge from Chromium at DEPS revision 39.0.2171.44
This commit was generated by merge_to_master.py.
Change-Id: I12ecf158017b8be5f9a1d33f4152e5a3c812cb7f
Diffstat (limited to 'chrome/browser')
44 files changed, 467 insertions, 67 deletions
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index 6373f41c3b..6004fabb85 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc @@ -1838,6 +1838,14 @@ const Experiment kExperiments[] = { data_reduction_proxy::switches::kEnableDataReductionProxyDev, data_reduction_proxy::switches::kDisableDataReductionProxyDev) }, + { + "enable-data-reduction-proxy-alt", + IDS_FLAGS_ENABLE_DATA_REDUCTION_PROXY_ALTERNATIVE_NAME, + IDS_FLAGS_ENABLE_DATA_REDUCTION_PROXY_ALTERNATIVE_DESCRIPTION, + kOsAndroid, + SINGLE_VALUE_TYPE( + data_reduction_proxy::switches::kEnableDataReductionProxyAlt) + }, #endif { "enable-experimental-hotwording", @@ -1911,14 +1919,6 @@ const Experiment kExperiments[] = { SINGLE_VALUE_TYPE(chromeos::switches::kWakeOnPackets) }, #endif // OS_CHROMEOS - { - "enable-data-reduction-proxy-alt", - IDS_FLAGS_ENABLE_DATA_REDUCTION_PROXY_ALTERNATIVE_NAME, - IDS_FLAGS_ENABLE_DATA_REDUCTION_PROXY_ALTERNATIVE_DESCRIPTION, - kOsAndroid, - SINGLE_VALUE_TYPE(data_reduction_proxy::switches:: - kEnableDataReductionProxyAlt) - }, #if defined(USE_AURA) { "enable-tab-audio-muting", @@ -2057,6 +2057,11 @@ bool SkipConditionalExperiment(const Experiment& experiment, chrome::VersionInfo::GetChannel() != chrome::VersionInfo::CHANNEL_DEV) { return true; } + // enable-data-reduction-proxy-alt is only available for the Dev channel. + if (!strcmp("enable-data-reduction-proxy-alt", experiment.internal_name) && + chrome::VersionInfo::GetChannel() != chrome::VersionInfo::CHANNEL_DEV) { + return true; + } #endif return false; diff --git a/chrome/browser/android/chrome_jni_registrar.cc b/chrome/browser/android/chrome_jni_registrar.cc index da7f67b4d3..35f8fbb608 100644 --- a/chrome/browser/android/chrome_jni_registrar.cc +++ b/chrome/browser/android/chrome_jni_registrar.cc @@ -19,6 +19,7 @@ #include "chrome/browser/android/dom_distiller/feedback_reporter_android.h" #include "chrome/browser/android/enhanced_bookmarks/enhanced_bookmarks_bridge.h" #include "chrome/browser/android/favicon_helper.h" +#include "chrome/browser/android/feature_utilities.h" #include "chrome/browser/android/foreign_session_helper.h" #include "chrome/browser/android/intent_helper.h" #include "chrome/browser/android/logo_bridge.h" @@ -143,6 +144,7 @@ static base::android::RegistrationMethod kChromeRegisteredMethods[] = { prerender::ExternalPrerenderHandlerAndroid:: RegisterExternalPrerenderHandlerAndroid }, { "FaviconHelper", FaviconHelper::RegisterFaviconHelper }, + { "FeatureUtilities", RegisterFeatureUtilities }, { "FeedbackReporter", dom_distiller::android::RegisterFeedbackReporter }, { "FontSizePrefsAndroid", FontSizePrefsAndroid::Register }, { "ForeignSessionHelper", diff --git a/chrome/browser/android/feature_utilities.cc b/chrome/browser/android/feature_utilities.cc new file mode 100644 index 0000000000..39f55782ad --- /dev/null +++ b/chrome/browser/android/feature_utilities.cc @@ -0,0 +1,33 @@ +// Copyright 2014 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 "chrome/browser/android/feature_utilities.h" + +#include "jni/FeatureUtilities_jni.h" + +namespace { +bool document_mode_enabled = false; +} // namespace + +namespace chrome { +namespace android { + +RunningModeHistogram GetDocumentModeValue() { + return document_mode_enabled ? RUNNING_MODE_DOCUMENT_MODE : + RUNNING_MODE_TABBED_MODE; +} + +} // namespace android +} // namespace chrome + + +static void SetDocumentModeEnabled(JNIEnv* env, + jclass clazz, + jboolean enabled) { + document_mode_enabled = enabled; +} + +bool RegisterFeatureUtilities(JNIEnv* env) { + return RegisterNativesImpl(env); +} diff --git a/chrome/browser/android/feature_utilities.h b/chrome/browser/android/feature_utilities.h new file mode 100644 index 0000000000..bb3b7dc18b --- /dev/null +++ b/chrome/browser/android/feature_utilities.h @@ -0,0 +1,26 @@ +// Copyright 2014 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 CHROME_BROWSER_ANDROID_FEATURE_UTILITIES_H_ +#define CHROME_BROWSER_ANDROID_FEATURE_UTILITIES_H_ + +#include <jni.h> + +namespace chrome { +namespace android { + +enum RunningModeHistogram { + RUNNING_MODE_DOCUMENT_MODE, + RUNNING_MODE_TABBED_MODE, + RUNNING_MODE_MAX +}; + +RunningModeHistogram GetDocumentModeValue(); + +} // namespace android +} // namespace chrome + +bool RegisterFeatureUtilities(JNIEnv* env); + +#endif // CHROME_BROWSER_ANDROID_FEATURE_UTILITIES_H_ diff --git a/chrome/browser/bookmarks/enhanced_bookmarks_features.cc b/chrome/browser/bookmarks/enhanced_bookmarks_features.cc index a7bca68d3d..f441a62a39 100644 --- a/chrome/browser/bookmarks/enhanced_bookmarks_features.cc +++ b/chrome/browser/bookmarks/enhanced_bookmarks_features.cc @@ -154,7 +154,7 @@ void UpdateBookmarksExperimentState( void InitBookmarksExperimentState(Profile* profile) { SigninManagerBase* signin = SigninManagerFactory::GetForProfile(profile); - bool is_signed_in = signin && !signin->IsAuthenticated(); + bool is_signed_in = signin && signin->IsAuthenticated(); UpdateBookmarksExperimentState( profile->GetPrefs(), g_browser_process->local_state(), diff --git a/chrome/browser/browsing_data/browsing_data_remover_unittest.cc b/chrome/browser/browsing_data/browsing_data_remover_unittest.cc index 07992421bc..8153ce5ef9 100644 --- a/chrome/browser/browsing_data/browsing_data_remover_unittest.cc +++ b/chrome/browser/browsing_data/browsing_data_remover_unittest.cc @@ -600,9 +600,8 @@ class MockDomainReliabilityService : public DomainReliabilityService { virtual ~MockDomainReliabilityService() {} virtual scoped_ptr<DomainReliabilityMonitor> CreateMonitor( - scoped_refptr<base::SingleThreadTaskRunner> network_task_runner, - PrefService* local_state_pref_service, - const char* reporting_pref_name) OVERRIDE { + scoped_refptr<base::SingleThreadTaskRunner> network_task_runner) + OVERRIDE { NOTREACHED(); return scoped_ptr<DomainReliabilityMonitor>(); } diff --git a/chrome/browser/chromeos/login/easy_unlock/easy_unlock_metrics.cc b/chrome/browser/chromeos/login/easy_unlock/easy_unlock_metrics.cc new file mode 100644 index 0000000000..afb95e0c04 --- /dev/null +++ b/chrome/browser/chromeos/login/easy_unlock/easy_unlock_metrics.cc @@ -0,0 +1,20 @@ +// Copyright 2014 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 "chrome/browser/chromeos/login/easy_unlock/easy_unlock_metrics.h" + +#include "base/logging.h" +#include "base/metrics/histogram.h" + +namespace chromeos { + +void RecordEasyUnlockLoginEvent(EasyUnlockLoginEvent event) { + DCHECK_LT(event, EASY_SIGN_IN_LOGIN_EVENT_COUNT); + + UMA_HISTOGRAM_ENUMERATION("EasyUnlock.SignIn.LoginEvent", + event, + EASY_SIGN_IN_LOGIN_EVENT_COUNT); +} + +} // namespace chromeos diff --git a/chrome/browser/chromeos/login/easy_unlock/easy_unlock_metrics.h b/chrome/browser/chromeos/login/easy_unlock/easy_unlock_metrics.h new file mode 100644 index 0000000000..83f94db774 --- /dev/null +++ b/chrome/browser/chromeos/login/easy_unlock/easy_unlock_metrics.h @@ -0,0 +1,56 @@ +// Copyright 2014 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 CHROME_BROWSER_CHROMEOS_LOGIN_EASY_UNLOCK_EASY_UNLOCK_METRICS_H_ +#define CHROME_BROWSER_CHROMEOS_LOGIN_EASY_UNLOCK_EASY_UNLOCK_METRICS_H_ + +namespace chromeos { + +// Tracking login events for Easy unlock metrics. +// This enum is used to define the buckets for an enumerated UMA histogram. +// Hence, +// (a) existing enumerated constants should never be deleted or reordered, and +// (b) new constants should only be appended at the end of the enumeration. +enum EasyUnlockLoginEvent { + // User is successfully authenticated using Easy Sign-in. + EASY_SIGN_IN_SUCCESS = 0, + // Easy sign-in failed to authenticate the user. + EASY_SIGN_IN_FAILURE = 1, + + // Password is used for sign-in because there is no pairing data. + PASSWORD_SIGN_IN_NO_PAIRING = 2, + // Password is used for sign-in because pairing data is changed. + PASSWORD_SIGN_IN_PAIRING_CHANGED = 3, + // Password is used for sign-in because of user hardlock. + PASSWORD_SIGN_IN_USER_HARDLOCK = 4, + // Password is used for sign-in because Easy unlock service is not active. + PASSWORD_SIGN_IN_SERVICE_NOT_ACTIVE = 5, + // Password is used for sign-in because Bluetooth is not on. + PASSWORD_SIGN_IN_NO_BLUETOOTH = 6, + // Password is used for sign-in because Easy unlock is connecting. + PASSWORD_SIGN_IN_BLUETOOTH_CONNECTING = 7, + // Password is used for sign-in because no eligible phones found. + PASSWORD_SIGN_IN_NO_PHONE = 8, + // Password is used for sign-in because phone could not be authenticated. + PASSWORD_SIGN_IN_PHONE_NOT_AUTHENTICATED = 9, + // Password is used for sign-in because phone is locked. + PASSWORD_SIGN_IN_PHONE_LOCKED = 10, + // Password is used for sign-in because phone does not have lock screen. + PASSWORD_SIGN_IN_PHONE_NOT_LOCKABLE = 11, + // Password is used for sign-in because phone is not close enough. + PASSWORD_SIGN_IN_PHONE_NOT_NEARBY = 12, + // Password is used for sign-in because phone is not supported. + PASSWORD_SIGN_IN_PHONE_UNSUPPORTED = 13, + // Password is used for sign-in because user types in passowrd. This is + // unlikely to happen though. + PASSWORD_SIGN_IN_WITH_AUTHENTICATED_PHONE = 14, + + EASY_SIGN_IN_LOGIN_EVENT_COUNT // Must be the last. +}; + +void RecordEasyUnlockLoginEvent(EasyUnlockLoginEvent event); + +} // namespace chromeos + +#endif // CHROME_BROWSER_CHROMEOS_LOGIN_EASY_UNLOCK_EASY_UNLOCK_METRICS_H_ diff --git a/chrome/browser/chromeos/login/existing_user_controller.cc b/chrome/browser/chromeos/login/existing_user_controller.cc index 9b9342215f..8138913cbd 100644 --- a/chrome/browser/chromeos/login/existing_user_controller.cc +++ b/chrome/browser/chromeos/login/existing_user_controller.cc @@ -42,6 +42,7 @@ #include "chrome/browser/chromeos/profiles/profile_helper.h" #include "chrome/browser/chromeos/settings/cros_settings.h" #include "chrome/browser/prefs/session_startup_pref.h" +#include "chrome/browser/signin/easy_unlock_service.h" #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_version_info.h" @@ -52,7 +53,6 @@ #include "chromeos/dbus/dbus_thread_manager.h" #include "chromeos/dbus/power_manager_client.h" #include "chromeos/dbus/session_manager_client.h" -#include "chromeos/login/auth/user_context.h" #include "chromeos/login/user_names.h" #include "chromeos/settings/cros_settings_names.h" #include "components/google/core/browser/google_util.h" @@ -125,6 +125,26 @@ void TransferContextAuthenticationsOnIOThread( base::Bind(&RefreshPoliciesOnUIThread)); } +// Record UMA for Easy sign-in outcome. +void RecordEasySignInOutcome(const std::string& user_id, bool success) { + EasyUnlockService* easy_unlock_service = + EasyUnlockService::Get(ProfileHelper::GetSigninProfile()); + if (!easy_unlock_service) + return; + easy_unlock_service->RecordEasySignInOutcome(user_id, success); +} + +// Record UMA for password login of regular user when Easy sign-in is enabled. +void RecordPasswordLoginEvent(const UserContext& user_context) { + EasyUnlockService* easy_unlock_service = + EasyUnlockService::Get(ProfileHelper::GetSigninProfile()); + if (user_context.GetUserType() == user_manager::USER_TYPE_REGULAR && + user_context.GetAuthFlow() == UserContext::AUTH_FLOW_OFFLINE && + easy_unlock_service) { + easy_unlock_service->RecordPasswordLoginEvent(user_context.GetUserID()); + } +} + } // namespace // static @@ -135,6 +155,7 @@ ExistingUserController* ExistingUserController::current_controller_ = NULL; ExistingUserController::ExistingUserController(LoginDisplayHost* host) : auth_status_consumer_(NULL), + last_login_attempt_auth_flow_(UserContext::AUTH_FLOW_OFFLINE), host_(host), login_display_(host_->CreateLoginDisplay(this)), num_login_attempts_(0), @@ -454,6 +475,8 @@ void ExistingUserController::PerformLogin( // Disable UI while loading user profile. login_display_->SetUIEnabled(false); + last_login_attempt_auth_flow_ = user_context.GetAuthFlow(); + // Use the same LoginPerformer for subsequent login as it has state // such as Authenticator instance. if (!login_performer_.get() || num_login_attempts_ <= 1) { @@ -468,6 +491,7 @@ void ExistingUserController::PerformLogin( login_performer_->LoginAsSupervisedUser(user_context); } else { login_performer_->PerformLogin(user_context, auth_mode); + RecordPasswordLoginEvent(user_context); } SendAccessibilityAlert( l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_LOGIN_SIGNING_IN)); @@ -773,6 +797,10 @@ void ExistingUserController::OnAuthFailure(const AuthFailure& failure) { guest_mode_url_ = GURL::EmptyGURL(); std::string error = failure.GetErrorString(); + // TODO(xiyuan): Move into EasyUnlockUserLoginFlow. + if (last_login_attempt_auth_flow_ == UserContext::AUTH_FLOW_EASY_UNLOCK) + RecordEasySignInOutcome(last_login_attempt_username_, false); + if (ChromeUserManager::Get() ->GetUserFlow(last_login_attempt_username_) ->HandleLoginFailure(failure)) { @@ -846,6 +874,13 @@ void ExistingUserController::OnAuthSuccess(const UserContext& user_context) { ->GetUserFlow(user_context.GetUserID()) ->HandleLoginSuccess(user_context); + // TODO(xiyuan): Move into EasyUnlockUserLoginFlow. + if (last_login_attempt_auth_flow_ == UserContext::AUTH_FLOW_EASY_UNLOCK) { + DCHECK_EQ(last_login_attempt_username_, user_context.GetUserID()); + DCHECK_EQ(last_login_attempt_auth_flow_, user_context.GetAuthFlow()); + RecordEasySignInOutcome(last_login_attempt_username_, true); + } + StopPublicSessionAutoLoginTimer(); const bool has_auth_cookies = diff --git a/chrome/browser/chromeos/login/existing_user_controller.h b/chrome/browser/chromeos/login/existing_user_controller.h index 6fedb17f95..52b4626df0 100644 --- a/chrome/browser/chromeos/login/existing_user_controller.h +++ b/chrome/browser/chromeos/login/existing_user_controller.h @@ -22,6 +22,7 @@ #include "chrome/browser/chromeos/login/ui/login_display.h" #include "chrome/browser/chromeos/settings/cros_settings.h" #include "chrome/browser/chromeos/settings/device_settings_service.h" +#include "chromeos/login/auth/user_context.h" #include "components/user_manager/user.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" @@ -36,7 +37,6 @@ namespace chromeos { class CrosSettings; class LoginDisplayHost; -class UserContext; namespace login { class NetworkStateHelper; @@ -254,6 +254,9 @@ class ExistingUserController : public LoginDisplay::Delegate, // Username of the last login attempt. std::string last_login_attempt_username_; + // Auth flow of the last login attempt. + UserContext::AuthFlow last_login_attempt_auth_flow_; + // OOBE/login display host. LoginDisplayHost* host_; diff --git a/chrome/browser/metrics/android_metrics_provider.cc b/chrome/browser/metrics/android_metrics_provider.cc index ddb41589c7..a7c7d29899 100644 --- a/chrome/browser/metrics/android_metrics_provider.cc +++ b/chrome/browser/metrics/android_metrics_provider.cc @@ -9,6 +9,7 @@ #include "base/prefs/pref_service.h" #include "base/prefs/scoped_user_pref_update.h" #include "base/values.h" +#include "chrome/browser/android/feature_utilities.h" #include "chrome/common/pref_names.h" namespace { @@ -37,6 +38,13 @@ AndroidMetricsProvider::AndroidMetricsProvider(PrefService* local_state) AndroidMetricsProvider::~AndroidMetricsProvider() { } +void AndroidMetricsProvider::ProvideGeneralMetrics( + metrics::ChromeUserMetricsExtension* uma_proto) { + UMA_HISTOGRAM_ENUMERATION( + "DocumentActivity.Enabled", + chrome::android::GetDocumentModeValue(), + chrome::android::RUNNING_MODE_MAX); +} void AndroidMetricsProvider::ProvideStabilityMetrics( metrics::SystemProfileProto* system_profile_proto) { diff --git a/chrome/browser/metrics/android_metrics_provider.h b/chrome/browser/metrics/android_metrics_provider.h index 8b004dadf8..13acca7df3 100644 --- a/chrome/browser/metrics/android_metrics_provider.h +++ b/chrome/browser/metrics/android_metrics_provider.h @@ -12,6 +12,10 @@ class PrefService; class PrefRegistrySimple; +namespace metrics { +class ChromeUserMetricsExtension; +} + // AndroidMetricsProvider provides Android-specific stability metrics. class AndroidMetricsProvider : public metrics::MetricsProvider { public: @@ -19,11 +23,15 @@ class AndroidMetricsProvider : public metrics::MetricsProvider { explicit AndroidMetricsProvider(PrefService* local_state); virtual ~AndroidMetricsProvider(); + // metrics::MetricsProvider: + virtual void ProvideGeneralMetrics( + metrics::ChromeUserMetricsExtension* uma_proto) override; + // Called when the Activity that the user interacts with is swapped out. // TODO(asvitkine): Expose a way for Android code to actually invoke this. void OnForegroundActivityChanged(ActivityTypeIds::Type type); - // metrics::MetricsDataProvider: + // metrics::MetricsProvider: virtual void ProvideStabilityMetrics( metrics::SystemProfileProto* system_profile_proto) OVERRIDE; diff --git a/chrome/browser/metrics/chrome_metrics_service_client.cc b/chrome/browser/metrics/chrome_metrics_service_client.cc index ab22900493..c3f2acf23e 100644 --- a/chrome/browser/metrics/chrome_metrics_service_client.cc +++ b/chrome/browser/metrics/chrome_metrics_service_client.cc @@ -240,11 +240,6 @@ void ChromeMetricsServiceClient::CollectFinalMetrics( DCHECK(!waiting_for_collect_final_metrics_step_); waiting_for_collect_final_metrics_step_ = true; -#if !defined(OS_CHROMEOS) && !defined(OS_IOS) - // Record the signin status histogram value. - signin_status_metrics_provider_->RecordSigninStatusHistogram(); -#endif - base::Closure callback = base::Bind(&ChromeMetricsServiceClient::OnMemoryDetailCollectionDone, weak_ptr_factory_.GetWeakPtr()); @@ -340,10 +335,9 @@ void ChromeMetricsServiceClient::Initialize() { #endif // defined(OS_CHROMEOS) #if !defined(OS_CHROMEOS) && !defined(OS_IOS) - signin_status_metrics_provider_ = - SigninStatusMetricsProvider::CreateInstance(); metrics_service_->RegisterMetricsProvider( - scoped_ptr<metrics::MetricsProvider>(signin_status_metrics_provider_)); + scoped_ptr<metrics::MetricsProvider>( + SigninStatusMetricsProvider::CreateInstance())); #endif } diff --git a/chrome/browser/metrics/chrome_metrics_service_client.h b/chrome/browser/metrics/chrome_metrics_service_client.h index 1cb9f45364..e7f260c945 100644 --- a/chrome/browser/metrics/chrome_metrics_service_client.h +++ b/chrome/browser/metrics/chrome_metrics_service_client.h @@ -167,12 +167,6 @@ class ChromeMetricsServiceClient GoogleUpdateMetricsProviderWin* google_update_metrics_provider_; #endif -#if !defined(OS_CHROMEOS) && !defined(OS_IOS) - // The SigninStatusMetricsProvider instance that was registered with - // MetricsService. Has the same lifetime as |metrics_service_|. - SigninStatusMetricsProvider* signin_status_metrics_provider_; -#endif - // Callback that is called when initial metrics gathering is complete. base::Closure finished_gathering_initial_metrics_callback_; diff --git a/chrome/browser/metrics/signin_status_metrics_provider.cc b/chrome/browser/metrics/signin_status_metrics_provider.cc index a207615a27..a1fcd1867d 100644 --- a/chrome/browser/metrics/signin_status_metrics_provider.cc +++ b/chrome/browser/metrics/signin_status_metrics_provider.cc @@ -71,7 +71,8 @@ SigninStatusMetricsProvider::~SigninStatusMetricsProvider() { factory->RemoveObserver(this); } -void SigninStatusMetricsProvider::RecordSigninStatusHistogram() { +void SigninStatusMetricsProvider::ProvideGeneralMetrics( + metrics::ChromeUserMetricsExtension* uma_proto) { UMA_HISTOGRAM_ENUMERATION( "UMA.ProfileSignInStatus", signin_status_, SIGNIN_STATUS_MAX); // After a histogram value is recorded, a new UMA session will be started, so @@ -201,7 +202,7 @@ void SigninStatusMetricsProvider::UpdateStatusWhenBrowserAdded(bool signed_in) { (signin_status_ == ALL_PROFILES_SIGNED_IN && !signed_in)) { SetSigninStatus(MIXED_SIGNIN_STATUS); } else if (signin_status_ == UNKNOWN_SIGNIN_STATUS) { - // If when function RecordSigninStatusHistogram() is called, Chrome is + // If when function ProvideGeneralMetrics() is called, Chrome is // running in the background with no browser window opened, |signin_status_| // will be reset to |UNKNOWN_SIGNIN_STATUS|. Then this newly added browser // is the only opened browser/profile and its signin status represents diff --git a/chrome/browser/metrics/signin_status_metrics_provider.h b/chrome/browser/metrics/signin_status_metrics_provider.h index 28c82077d6..0c3ae1179b 100644 --- a/chrome/browser/metrics/signin_status_metrics_provider.h +++ b/chrome/browser/metrics/signin_status_metrics_provider.h @@ -16,11 +16,16 @@ #include "components/signin/core/browser/signin_manager_base.h" class Browser; +class ChromeUserMetricsExtension; namespace base { class FilePath; } +namespace metrics { +class ChromeUserMetricsExtension; +} + // Collect login status of all opened profiles during one UMA session and record // the value into a histogram before UMA log is uploaded. It's currently not // supported on platform chromeos, Android or iOS. @@ -31,10 +36,9 @@ class SigninStatusMetricsProvider : public metrics::MetricsProvider, public: virtual ~SigninStatusMetricsProvider(); - // Record the collected sign-in status into a histogram and re-check current - // sign-in status to get prepared for the next UMA session. Called by - // MetricsServiceClient when it is collecting final metrics. - void RecordSigninStatusHistogram(); + // metrics::MetricsProvider: + virtual void ProvideGeneralMetrics( + metrics::ChromeUserMetricsExtension* uma_proto) OVERRIDE; // Factory method, creates a new instance of this class. static SigninStatusMetricsProvider* CreateInstance(); diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc index f770e233e6..86ffa39d54 100644 --- a/chrome/browser/profiles/profile_impl.cc +++ b/chrome/browser/profiles/profile_impl.cc @@ -1434,7 +1434,5 @@ ProfileImpl::CreateDomainReliabilityMonitor(PrefService* local_state) { return scoped_ptr<domain_reliability::DomainReliabilityMonitor>(); return service->CreateMonitor( - BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), - local_state, - prefs::kMetricsReportingEnabled); + BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); } diff --git a/chrome/browser/profiles/profile_impl_io_data.cc b/chrome/browser/profiles/profile_impl_io_data.cc index dd61413403..e12166230d 100644 --- a/chrome/browser/profiles/profile_impl_io_data.cc +++ b/chrome/browser/profiles/profile_impl_io_data.cc @@ -114,9 +114,6 @@ ProfileImplIOData::Handle::~Handle() { if (io_data_->http_server_properties_manager_) io_data_->http_server_properties_manager_->ShutdownOnPrefThread(); - if (io_data_->domain_reliability_monitor_) - io_data_->domain_reliability_monitor_->DestroyReportingPref(); - io_data_->ShutdownOnUIThread(GetAllContextGetters().Pass()); } @@ -596,6 +593,7 @@ void ProfileImplIOData::InitializeInternal( domain_reliability_monitor_.get(); monitor->InitURLRequestContext(main_context); monitor->AddBakedInConfigs(); + monitor->SetDiscardUploads(!GetMetricsEnabledStateOnIOThread()); network_delegate()->set_domain_reliability_monitor(monitor); } diff --git a/chrome/browser/resources/easy_unlock/manifest.json b/chrome/browser/resources/easy_unlock/manifest.json index ca4cb4aa76..0892f19a63 100644 --- a/chrome/browser/resources/easy_unlock/manifest.json +++ b/chrome/browser/resources/easy_unlock/manifest.json @@ -40,7 +40,7 @@ "socket" : true, "low_energy" : true, "uuids": [ - "0000AB34-0000-1000-8000-00805F9B34FB", // Unlock UUID + "704EE561-3782-405A-A14B-2D47A2DDCDDF", // Unlock UUID "29422880-D56D-11E3-9C1A-0800200C9A66" // Setup UUID ] }, diff --git a/chrome/browser/resources/options/browser_options.css b/chrome/browser/resources/options/browser_options.css index f3ef248ede..3597778b7c 100644 --- a/chrome/browser/resources/options/browser_options.css +++ b/chrome/browser/resources/options/browser_options.css @@ -473,9 +473,8 @@ footer { display: flex; } -#version-button { - -webkit-margin-start: auto; - color: #999; +#about-button { + -webkit-margin-end: 30px; } /* An input that has no function except to take up the same amount of space as diff --git a/chrome/browser/resources/options/browser_options.html b/chrome/browser/resources/options/browser_options.html index f6f42ae5cc..ff5035848c 100644 --- a/chrome/browser/resources/options/browser_options.html +++ b/chrome/browser/resources/options/browser_options.html @@ -932,8 +932,5 @@ <button id="advanced-settings-expander" class="link-button" i18n-content="showAdvancedSettings"> </button> - <button id="version-button" class="link-button" hidden - i18n-content="browserVersion"> - </button> </footer> </div> diff --git a/chrome/browser/resources/options/browser_options.js b/chrome/browser/resources/options/browser_options.js index 9a48d5df10..1f7c59dcac 100644 --- a/chrome/browser/resources/options/browser_options.js +++ b/chrome/browser/resources/options/browser_options.js @@ -142,9 +142,9 @@ cr.define('options', function() { $('advanced-settings').addEventListener('webkitTransitionEnd', this.updateAdvancedSettingsExpander_.bind(this)); - if (loadTimeData.getBoolean('showVersion')) { - $('version-button').hidden = false; - $('version-button').addEventListener('click', function() { + if (loadTimeData.getBoolean('showAbout')) { + $('about-button').hidden = false; + $('about-button').addEventListener('click', function() { PageManager.showPageByName('help'); chrome.send('coreOptionsUserMetricsAction', ['Options_About']); diff --git a/chrome/browser/resources/options/options.js b/chrome/browser/resources/options/options.js index 9d62c10d60..9b6ef9f7de 100644 --- a/chrome/browser/resources/options/options.js +++ b/chrome/browser/resources/options/options.js @@ -178,7 +178,7 @@ function load() { PageManager.registerOverlay(SyncSetupOverlay.getInstance(), BrowserOptions.getInstance(), [$('customize-sync')]); - if (loadTimeData.getBoolean('showVersion')) { + if (loadTimeData.getBoolean('showAbout')) { PageManager.registerOverlay(help.HelpPage.getInstance(), BrowserOptions.getInstance()); if (help.ChannelChangePage) { diff --git a/chrome/browser/resources/options/search_box.html b/chrome/browser/resources/options/search_box.html index f27e1e7bc5..226134bcfa 100644 --- a/chrome/browser/resources/options/search_box.html +++ b/chrome/browser/resources/options/search_box.html @@ -2,6 +2,9 @@ <header > <span id="browser-options-search-field-container" class="search-field-container"> + <button id="about-button" class="link-button" hidden + i18n-content="aboutButton"> + </button> <input id="search-field" type="search" i18n-values="placeholder:searchPlaceholder; aria-label:searchPlaceholder" incremental> diff --git a/chrome/browser/resources/sync_setup_overlay.js b/chrome/browser/resources/sync_setup_overlay.js index 1ab271c780..86e44e851a 100644 --- a/chrome/browser/resources/sync_setup_overlay.js +++ b/chrome/browser/resources/sync_setup_overlay.js @@ -14,13 +14,13 @@ cr.exportPath('options'); * bookmarksRegistered: boolean, * bookmarksSynced: boolean, * encryptAllData: boolean, + * encryptAllDataAllowed: boolean, * enterGooglePassphraseBody: (string|undefined), * enterPassphraseBody: (string|undefined), * extensionsEnforced: boolean, * extensionsRegistered: boolean, * extensionsSynced: boolean, * fullEncryptionBody: string, - * isSupervised: boolean, * passphraseFailed: boolean, * passwordsEnforced: boolean, * passwordsRegistered: boolean, @@ -668,7 +668,7 @@ cr.define('options', function() { $('sync-custom-passphrase-container').hidden = false; $('sync-new-encryption-section-container').hidden = false; - $('customize-sync-encryption-new').hidden = args.isSupervised; + $('customize-sync-encryption-new').hidden = !args.encryptAllDataAllowed; $('sync-existing-passphrase-container').hidden = true; diff --git a/chrome/browser/signin/easy_unlock_screenlock_state_handler.cc b/chrome/browser/signin/easy_unlock_screenlock_state_handler.cc index ea41fac5d1..0ca105dcef 100644 --- a/chrome/browser/signin/easy_unlock_screenlock_state_handler.cc +++ b/chrome/browser/signin/easy_unlock_screenlock_state_handler.cc @@ -130,6 +130,12 @@ void EasyUnlockScreenlockStateHandler::ChangeState(State new_state) { UpdateTooltipOptions(trial_run, &icon_options); + // For states without tooltips, we still need to set an accessibility label. + if (state_ == EasyUnlockScreenlockStateHandler::STATE_BLUETOOTH_CONNECTING) { + icon_options.SetAriaLabel( + l10n_util::GetStringUTF16(IDS_SMART_LOCK_SPINNER_ACCESSIBILITY_LABEL)); + } + screenlock_bridge_->lock_handler()->ShowUserPodCustomIcon(user_email_, icon_options); } diff --git a/chrome/browser/signin/easy_unlock_screenlock_state_handler.h b/chrome/browser/signin/easy_unlock_screenlock_state_handler.h index 8122df1be1..a98600ce95 100644 --- a/chrome/browser/signin/easy_unlock_screenlock_state_handler.h +++ b/chrome/browser/signin/easy_unlock_screenlock_state_handler.h @@ -74,6 +74,8 @@ class EasyUnlockScreenlockStateHandler : public ScreenlockBridge::Observer { // Shows the hardlock UI if the hardlock_state_ is not NO_HARDLOCK. void MaybeShowHardlockUI(); + State state() const { return state_; } + private: // ScreenlockBridge::Observer: virtual void OnScreenDidLock() OVERRIDE; diff --git a/chrome/browser/signin/easy_unlock_service.h b/chrome/browser/signin/easy_unlock_service.h index cf3e263f4f..627a6c35f8 100644 --- a/chrome/browser/signin/easy_unlock_service.h +++ b/chrome/browser/signin/easy_unlock_service.h @@ -107,6 +107,13 @@ class EasyUnlockService : public KeyedService { // for the user, returns an empty string. virtual std::string GetWrappedSecret() const = 0; + // Records metrics for Easy sign-in outcome for the given user. + virtual void RecordEasySignInOutcome(const std::string& user_id, + bool success) const = 0; + + // Records metrics for password based flow for the given user. + virtual void RecordPasswordLoginEvent(const std::string& user_id) const = 0; + // Whether easy unlock is allowed to be used. If the controlling preference // is set (from policy), this returns the preference value. Otherwise, it is // permitted either the flag is enabled or its field trial is enabled. @@ -197,6 +204,10 @@ class EasyUnlockService : public KeyedService { void SetScreenlockHardlockedState( EasyUnlockScreenlockStateHandler::HardlockState state); + const EasyUnlockScreenlockStateHandler* screenlock_state_handler() const { + return screenlock_state_handler_.get(); + } + private: // A class to detect whether a bluetooth adapter is present. class BluetoothDetector; diff --git a/chrome/browser/signin/easy_unlock_service_regular.cc b/chrome/browser/signin/easy_unlock_service_regular.cc index 5ea569515d..870d663693 100644 --- a/chrome/browser/signin/easy_unlock_service_regular.cc +++ b/chrome/browser/signin/easy_unlock_service_regular.cc @@ -163,6 +163,17 @@ std::string EasyUnlockServiceRegular::GetWrappedSecret() const { return std::string(); } +void EasyUnlockServiceRegular::RecordEasySignInOutcome( + const std::string& user_id, + bool success) const { + NOTREACHED(); +} + +void EasyUnlockServiceRegular::RecordPasswordLoginEvent( + const std::string& user_id) const { + NOTREACHED(); +} + void EasyUnlockServiceRegular::InitializeInternal() { registrar_.Init(profile()->GetPrefs()); registrar_.Add( diff --git a/chrome/browser/signin/easy_unlock_service_regular.h b/chrome/browser/signin/easy_unlock_service_regular.h index 3cc3abe669..be73ece016 100644 --- a/chrome/browser/signin/easy_unlock_service_regular.h +++ b/chrome/browser/signin/easy_unlock_service_regular.h @@ -43,6 +43,10 @@ class EasyUnlockServiceRegular : public EasyUnlockService { virtual TurnOffFlowStatus GetTurnOffFlowStatus() const OVERRIDE; virtual std::string GetChallenge() const OVERRIDE; virtual std::string GetWrappedSecret() const OVERRIDE; + virtual void RecordEasySignInOutcome(const std::string& user_id, + bool success) const OVERRIDE; + virtual void RecordPasswordLoginEvent( + const std::string& user_id) const OVERRIDE; virtual void InitializeInternal() OVERRIDE; virtual void ShutdownInternal() OVERRIDE; virtual bool IsAllowedInternal() OVERRIDE; diff --git a/chrome/browser/signin/easy_unlock_service_signin_chromeos.cc b/chrome/browser/signin/easy_unlock_service_signin_chromeos.cc index 225bdf2d0a..8dd9ed26cc 100644 --- a/chrome/browser/signin/easy_unlock_service_signin_chromeos.cc +++ b/chrome/browser/signin/easy_unlock_service_signin_chromeos.cc @@ -12,6 +12,7 @@ #include "base/thread_task_runner_handle.h" #include "base/time/time.h" #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_key_manager.h" +#include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_metrics.h" #include "chrome/browser/chromeos/login/session/user_session_manager.h" #include "chromeos/login/auth/user_context.h" @@ -170,6 +171,73 @@ std::string EasyUnlockServiceSignin::GetWrappedSecret() const { return data->devices[device_index].wrapped_secret; } +void EasyUnlockServiceSignin::RecordEasySignInOutcome( + const std::string& user_id, + bool success) const { + DCHECK_EQ(GetUserEmail(), user_id); + + chromeos::RecordEasyUnlockLoginEvent(success + ? chromeos::EASY_SIGN_IN_SUCCESS + : chromeos::EASY_SIGN_IN_FAILURE); + VLOG(1) << "Easy sign-in " << (success ? "success" : "failure"); +} + +void EasyUnlockServiceSignin::RecordPasswordLoginEvent( + const std::string& user_id) const { + DCHECK_EQ(GetUserEmail(), user_id); + + chromeos::EasyUnlockLoginEvent event = + chromeos::EASY_SIGN_IN_LOGIN_EVENT_COUNT; + if (!GetRemoteDevices() || + GetHardlockState() == EasyUnlockScreenlockStateHandler::NO_PAIRING) { + event = chromeos::PASSWORD_SIGN_IN_NO_PAIRING; + } else if (GetHardlockState() == + EasyUnlockScreenlockStateHandler::PAIRING_CHANGED) { + event = chromeos::PASSWORD_SIGN_IN_PAIRING_CHANGED; + } else if (GetHardlockState() == + EasyUnlockScreenlockStateHandler::USER_HARDLOCK) { + event = chromeos::PASSWORD_SIGN_IN_USER_HARDLOCK; + } else if (!screenlock_state_handler()) { + event = chromeos::PASSWORD_SIGN_IN_SERVICE_NOT_ACTIVE; + } else { + switch (screenlock_state_handler()->state()) { + case EasyUnlockScreenlockStateHandler::STATE_INACTIVE: + event = chromeos::PASSWORD_SIGN_IN_SERVICE_NOT_ACTIVE; + break; + case EasyUnlockScreenlockStateHandler::STATE_NO_BLUETOOTH: + event = chromeos::PASSWORD_SIGN_IN_NO_BLUETOOTH; + break; + case EasyUnlockScreenlockStateHandler::STATE_BLUETOOTH_CONNECTING: + event = chromeos::PASSWORD_SIGN_IN_BLUETOOTH_CONNECTING; + break; + case EasyUnlockScreenlockStateHandler::STATE_NO_PHONE: + event = chromeos::PASSWORD_SIGN_IN_NO_PHONE; + break; + case EasyUnlockScreenlockStateHandler::STATE_PHONE_NOT_AUTHENTICATED: + event = chromeos::PASSWORD_SIGN_IN_PHONE_NOT_AUTHENTICATED; + break; + case EasyUnlockScreenlockStateHandler::STATE_PHONE_LOCKED: + event = chromeos::PASSWORD_SIGN_IN_PHONE_LOCKED; + break; + case EasyUnlockScreenlockStateHandler::STATE_PHONE_UNLOCKABLE: + event = chromeos::PASSWORD_SIGN_IN_PHONE_NOT_LOCKABLE; + break; + case EasyUnlockScreenlockStateHandler::STATE_PHONE_NOT_NEARBY: + event = chromeos::PASSWORD_SIGN_IN_PHONE_NOT_NEARBY; + break; + case EasyUnlockScreenlockStateHandler::STATE_PHONE_UNSUPPORTED: + event = chromeos::PASSWORD_SIGN_IN_PHONE_UNSUPPORTED; + break; + case EasyUnlockScreenlockStateHandler::STATE_AUTHENTICATED: + event = chromeos::PASSWORD_SIGN_IN_WITH_AUTHENTICATED_PHONE; + break; + } + } + + chromeos::RecordEasyUnlockLoginEvent(event); + VLOG(1) << "EasySignIn password login event, event=" << event; +} + void EasyUnlockServiceSignin::InitializeInternal() { if (chromeos::LoginState::Get()->IsUserLoggedIn()) return; diff --git a/chrome/browser/signin/easy_unlock_service_signin_chromeos.h b/chrome/browser/signin/easy_unlock_service_signin_chromeos.h index 77e662f470..7e89b8469b 100644 --- a/chrome/browser/signin/easy_unlock_service_signin_chromeos.h +++ b/chrome/browser/signin/easy_unlock_service_signin_chromeos.h @@ -70,6 +70,10 @@ class EasyUnlockServiceSignin : public EasyUnlockService, virtual TurnOffFlowStatus GetTurnOffFlowStatus() const OVERRIDE; virtual std::string GetChallenge() const OVERRIDE; virtual std::string GetWrappedSecret() const OVERRIDE; + virtual void RecordEasySignInOutcome(const std::string& user_id, + bool success) const OVERRIDE; + virtual void RecordPasswordLoginEvent( + const std::string& user_id) const OVERRIDE; virtual void InitializeInternal() OVERRIDE; virtual void ShutdownInternal() OVERRIDE; virtual bool IsAllowedInternal() OVERRIDE; diff --git a/chrome/browser/signin/screenlock_bridge.cc b/chrome/browser/signin/screenlock_bridge.cc index a78d2613a2..5fb5192ab1 100644 --- a/chrome/browser/signin/screenlock_bridge.cc +++ b/chrome/browser/signin/screenlock_bridge.cc @@ -74,6 +74,9 @@ ScreenlockBridge::UserPodCustomIconOptions::ToDictionaryValue() const { result->Set("tooltip", tooltip_options); } + if (!aria_label_.empty()) + result->SetString("ariaLabel", aria_label_); + if (hardlock_on_click_) result->SetBoolean("hardlockOnClick", true); @@ -92,6 +95,11 @@ void ScreenlockBridge::UserPodCustomIconOptions::SetTooltip( autoshow_tooltip_ = autoshow; } +void ScreenlockBridge::UserPodCustomIconOptions::SetAriaLabel( + const base::string16& aria_label) { + aria_label_ = aria_label; +} + void ScreenlockBridge::UserPodCustomIconOptions::SetHardlockOnClick() { hardlock_on_click_ = true; } diff --git a/chrome/browser/signin/screenlock_bridge.h b/chrome/browser/signin/screenlock_bridge.h index 7add894433..c9b702db85 100644 --- a/chrome/browser/signin/screenlock_bridge.h +++ b/chrome/browser/signin/screenlock_bridge.h @@ -64,6 +64,10 @@ class ScreenlockBridge { // shown with the icon. void SetTooltip(const base::string16& tooltip, bool autoshow); + // Sets the accessiblity label of the icon. If this attribute is not + // provided, then the tooltip will be used. + void SetAriaLabel(const base::string16& aria_label); + // If hardlock on click is set, clicking the icon in the screenlock will // go to state where password is required for unlock. void SetHardlockOnClick(); @@ -74,6 +78,8 @@ class ScreenlockBridge { base::string16 tooltip_; bool autoshow_tooltip_; + base::string16 aria_label_; + bool hardlock_on_click_; DISALLOW_COPY_AND_ASSIGN(UserPodCustomIconOptions); diff --git a/chrome/browser/supervised_user/supervised_user_service.cc b/chrome/browser/supervised_user/supervised_user_service.cc index 6cd213090f..dc0daf44fa 100644 --- a/chrome/browser/supervised_user/supervised_user_service.cc +++ b/chrome/browser/supervised_user/supervised_user_service.cc @@ -726,6 +726,10 @@ void SupervisedUserService::SetActive(bool active) { } #endif + ProfileSyncService* sync_service = + ProfileSyncServiceFactory::GetForProfile(profile_); + sync_service->SetEncryptEverythingAllowed(!active_); + SupervisedUserSettingsService* settings_service = GetSettingsService(); settings_service->SetActive(active_); diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc index 3135388b8d..1f8f9eb259 100644 --- a/chrome/browser/sync/profile_sync_service.cc +++ b/chrome/browser/sync/profile_sync_service.cc @@ -217,6 +217,7 @@ ProfileSyncService::ProfileSyncService( unrecoverable_error_reason_(ERROR_REASON_UNSET), expect_sync_configuration_aborted_(false), encrypted_types_(syncer::SyncEncryptionHandler::SensitiveTypes()), + encrypt_everything_allowed_(true), encrypt_everything_(false), encryption_pending_(false), configure_status_(DataTypeManager::UNKNOWN), @@ -1368,6 +1369,7 @@ void ProfileSyncService::OnEncryptedTypesChanged( bool encrypt_everything) { encrypted_types_ = encrypted_types; encrypt_everything_ = encrypt_everything; + DCHECK(encrypt_everything_allowed_ || !encrypt_everything_); DVLOG(1) << "Encrypted types changed to " << syncer::ModelTypeSetToString(encrypted_types_) << " (encrypt everything is set to " @@ -2193,7 +2195,18 @@ bool ProfileSyncService::SetDecryptionPassphrase( } } +bool ProfileSyncService::EncryptEverythingAllowed() const { + return encrypt_everything_allowed_; +} + +void ProfileSyncService::SetEncryptEverythingAllowed(bool allowed) { + DCHECK(allowed || !backend_initialized_ || !EncryptEverythingEnabled()); + encrypt_everything_allowed_ = allowed; +} + void ProfileSyncService::EnableEncryptEverything() { + DCHECK(EncryptEverythingAllowed()); + // Tests override sync_initialized() to always return true, so we // must check that instead of |backend_initialized_|. // TODO(akalin): Fix the above. :/ diff --git a/chrome/browser/sync/profile_sync_service.h b/chrome/browser/sync/profile_sync_service.h index ac43cf81ce..ee25275114 100644 --- a/chrome/browser/sync/profile_sync_service.h +++ b/chrome/browser/sync/profile_sync_service.h @@ -678,6 +678,13 @@ class ProfileSyncService : public ProfileSyncServiceBase, virtual bool SetDecryptionPassphrase(const std::string& passphrase) WARN_UNUSED_RESULT; + // Returns true if encrypting all the sync data is allowed. If this method + // returns false, EnableEncryptEverything() should not be called. + virtual bool EncryptEverythingAllowed() const; + + // Sets whether encrypting all the sync data is allowed or not. + virtual void SetEncryptEverythingAllowed(bool allowed); + // Turns on encryption for all data. Callers must call OnUserChoseDatatypes() // after calling this to force the encryption to occur. virtual void EnableEncryptEverything(); @@ -1054,6 +1061,9 @@ class ProfileSyncService : public ProfileSyncServiceBase, // syncer::Cryptographer::SensitiveTypes(). syncer::ModelTypeSet encrypted_types_; + // Whether encrypting everything is allowed. + bool encrypt_everything_allowed_; + // Whether we want to encrypt everything. bool encrypt_everything_; diff --git a/chrome/browser/sync/profile_sync_service_android.cc b/chrome/browser/sync/profile_sync_service_android.cc index 7960efe6e2..6d564fd0d2 100644 --- a/chrome/browser/sync/profile_sync_service_android.cc +++ b/chrome/browser/sync/profile_sync_service_android.cc @@ -220,6 +220,12 @@ jboolean ProfileSyncServiceAndroid::IsFirstSetupInProgress( return sync_service_->FirstSetupInProgress(); } +jboolean ProfileSyncServiceAndroid::IsEncryptEverythingAllowed( + JNIEnv* env, jobject obj) { + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); + return sync_service_->EncryptEverythingAllowed(); +} + jboolean ProfileSyncServiceAndroid::IsPassphraseRequired(JNIEnv* env, jobject) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); return sync_service_->IsPassphraseRequired(); diff --git a/chrome/browser/sync/profile_sync_service_android.h b/chrome/browser/sync/profile_sync_service_android.h index 9ee0cc437a..12de215a6b 100644 --- a/chrome/browser/sync/profile_sync_service_android.h +++ b/chrome/browser/sync/profile_sync_service_android.h @@ -76,6 +76,9 @@ class ProfileSyncServiceAndroid : public ProfileSyncServiceObserver { // Returns true if the sync is currently being setup for the first time. jboolean IsFirstSetupInProgress(JNIEnv* env, jobject obj); + // Returns true if encrypting everything is allowed. + jboolean IsEncryptEverythingAllowed(JNIEnv* env, jobject obj); + // Returns true if the user is currently encrypting everything. jboolean IsEncryptEverythingEnabled(JNIEnv* env, jobject obj); diff --git a/chrome/browser/sync/profile_sync_service_mock.h b/chrome/browser/sync/profile_sync_service_mock.h index 53253a2f7a..373969117a 100644 --- a/chrome/browser/sync/profile_sync_service_mock.h +++ b/chrome/browser/sync/profile_sync_service_mock.h @@ -70,6 +70,7 @@ class ProfileSyncServiceMock : public ProfileSyncService { MOCK_METHOD0(GetJsController, base::WeakPtr<syncer::JsController>()); MOCK_CONST_METHOD0(HasSyncSetupCompleted, bool()); + MOCK_CONST_METHOD0(EncryptEverythingAllowed, bool()); MOCK_CONST_METHOD0(EncryptEverythingEnabled, bool()); MOCK_METHOD0(EnableEncryptEverything, void()); @@ -90,8 +91,7 @@ class ProfileSyncServiceMock : public ProfileSyncService { MOCK_CONST_METHOD0(sync_initialized, bool()); MOCK_CONST_METHOD0(IsStartSuppressed, bool()); MOCK_CONST_METHOD0(waiting_for_auth, bool()); - MOCK_METHOD1(OnActionableError, void( - const syncer::SyncProtocolError&)); + MOCK_METHOD1(OnActionableError, void(const syncer::SyncProtocolError&)); MOCK_METHOD1(SetSetupInProgress, void(bool)); MOCK_CONST_METHOD1(IsDataTypeControllerRunning, bool(syncer::ModelType)); diff --git a/chrome/browser/ui/webui/options/core_options_handler.cc b/chrome/browser/ui/webui/options/core_options_handler.cc index f6683fbfdf..3db9ae5088 100644 --- a/chrome/browser/ui/webui/options/core_options_handler.cc +++ b/chrome/browser/ui/webui/options/core_options_handler.cc @@ -17,7 +17,6 @@ #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/extension_util.h" #include "chrome/browser/profiles/profile.h" -#include "chrome/browser/ui/webui/help/help_handler.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" @@ -62,6 +61,19 @@ bool CanSetExtensionControlledPrefValue( #endif } +// Hack to re-use IDS_ABOUT, which is a menu item for the About page. +// Since it's a menu item, it may include a "&" to indicate a hotkey. +base::string16 GetAboutString() { + if (!switches::AboutInSettingsEnabled()) + return base::string16(); + + base::string16 str = l10n_util::GetStringUTF16(IDS_ABOUT); + size_t start_pos = str.find(base::ASCIIToUTF16("&")); + if (start_pos != base::string16::npos) + str.erase(start_pos, 1); + return str; +} + } // namespace CoreOptionsHandler::CoreOptionsHandler() @@ -147,6 +159,11 @@ void CoreOptionsHandler::GetStaticLocalizedValues( localized_strings->SetString("searchPageHelpURL", chrome::kSettingsSearchHelpURL); + // About + localized_strings->SetBoolean("showAbout", + switches::AboutInSettingsEnabled()); + localized_strings->SetString("aboutButton", GetAboutString()); + // Common localized_strings->SetString("ok", l10n_util::GetStringUTF16(IDS_OK)); @@ -160,12 +177,6 @@ void CoreOptionsHandler::GetStaticLocalizedValues( l10n_util::GetStringUTF16(IDS_DONE)); localized_strings->SetString("deletableItemDeleteButtonTitle", l10n_util::GetStringUTF16(IDS_OPTIONS_DELETABLE_ITEM_DELETE_BUTTON)); - localized_strings->SetString( - "browserVersion", - l10n_util::GetStringFUTF16(IDS_ABOUT_PRODUCT_VERSION, - HelpHandler::BuildBrowserVersionString())); - localized_strings->SetBoolean("showVersion", - switches::AboutInSettingsEnabled()); } void CoreOptionsHandler::Uninitialize() { diff --git a/chrome/browser/ui/webui/sync_setup_handler.cc b/chrome/browser/ui/webui/sync_setup_handler.cc index 0218d615af..f10c6d059d 100644 --- a/chrome/browser/ui/webui/sync_setup_handler.cc +++ b/chrome/browser/ui/webui/sync_setup_handler.cc @@ -375,7 +375,7 @@ void SyncSetupHandler::DisplayConfigureSync(bool show_advanced, args.SetBoolean("syncAllDataTypes", sync_prefs.HasKeepEverythingSynced()); args.SetBoolean("syncNothing", false); // Always false during initial setup. args.SetBoolean("encryptAllData", service->EncryptEverythingEnabled()); - args.SetBoolean("isSupervised", GetProfile()->IsSupervised()); + args.SetBoolean("encryptAllDataAllowed", service->EncryptEverythingAllowed()); // We call IsPassphraseRequired() here, instead of calling // IsPassphraseRequiredForDecryption(), because we want to show the passphrase @@ -682,9 +682,10 @@ void SyncSetupHandler::HandleConfigure(const base::ListValue* args) { return; } - // Don't allow supervised users to enable "encrypt all". The UI is hidden, - // but the user may have enabled it e.g. by fiddling with the web inspector. - if (GetProfile()->IsSupervised()) + // Don't allow "encrypt all" if the ProfileSyncService doesn't allow it. + // The UI is hidden, but the user may have enabled it e.g. by fiddling with + // the web inspector. + if (!service->EncryptEverythingAllowed()) configuration.encrypt_all = false; // Note: Data encryption will not occur until configuration is complete diff --git a/chrome/browser/ui/webui/sync_setup_handler.h b/chrome/browser/ui/webui/sync_setup_handler.h index 38f478801f..a824b12bbd 100644 --- a/chrome/browser/ui/webui/sync_setup_handler.h +++ b/chrome/browser/ui/webui/sync_setup_handler.h @@ -71,6 +71,7 @@ class SyncSetupHandler : public options::OptionsPageUIHandler, FRIEND_TEST_ALL_PREFIXES(SyncSetupHandlerTest, TestPassphraseStillRequired); FRIEND_TEST_ALL_PREFIXES(SyncSetupHandlerTest, TestSyncIndividualTypes); FRIEND_TEST_ALL_PREFIXES(SyncSetupHandlerTest, TurnOnEncryptAll); + FRIEND_TEST_ALL_PREFIXES(SyncSetupHandlerTest, TurnOnEncryptAllDisallowed); FRIEND_TEST_ALL_PREFIXES(SyncSetupHandlerTest, UnsuccessfullySetPassphrase); FRIEND_TEST_ALL_PREFIXES(SyncSetupHandlerNonCrosTest, UnrecoverableErrorInitializingSync); diff --git a/chrome/browser/ui/webui/sync_setup_handler_unittest.cc b/chrome/browser/ui/webui/sync_setup_handler_unittest.cc index 1389a0f230..6b4cd332c0 100644 --- a/chrome/browser/ui/webui/sync_setup_handler_unittest.cc +++ b/chrome/browser/ui/webui/sync_setup_handler_unittest.cc @@ -320,6 +320,8 @@ class SyncSetupHandlerTest : public testing::Test { WillRepeatedly(Return(GetAllTypes())); EXPECT_CALL(*mock_pss_, GetActiveDataTypes()). WillRepeatedly(Return(GetAllTypes())); + EXPECT_CALL(*mock_pss_, EncryptEverythingAllowed()). + WillRepeatedly(Return(true)); EXPECT_CALL(*mock_pss_, EncryptEverythingEnabled()). WillRepeatedly(Return(false)); } @@ -526,6 +528,7 @@ TEST_F(SyncSetupHandlerTest, CheckBool(dictionary, "passphraseFailed", false); CheckBool(dictionary, "showSyncEverythingPage", false); CheckBool(dictionary, "syncAllDataTypes", true); + CheckBool(dictionary, "encryptAllDataAllowed", true); CheckBool(dictionary, "encryptAllData", false); CheckBool(dictionary, "usePassphrase", false); } @@ -684,6 +687,8 @@ TEST_F(SyncSetupHandlerTest, TurnOnEncryptAll) { .WillRepeatedly(Return(false)); EXPECT_CALL(*mock_pss_, IsPassphraseRequired()) .WillRepeatedly(Return(false)); + EXPECT_CALL(*mock_pss_, EncryptEverythingAllowed()) + .WillRepeatedly(Return(true)); SetupInitializedProfileSyncService(); EXPECT_CALL(*mock_pss_, EnableEncryptEverything()); EXPECT_CALL(*mock_pss_, OnUserChoseDatatypes(true, _)); @@ -1058,3 +1063,46 @@ TEST_F(SyncSetupHandlerTest, ShowSetupEncryptAll) { ASSERT_TRUE(data.arg2->GetAsDictionary(&dictionary)); CheckBool(dictionary, "encryptAllData", true); } + +TEST_F(SyncSetupHandlerTest, ShowSetupEncryptAllDisallowed) { + EXPECT_CALL(*mock_pss_, IsPassphraseRequired()) + .WillRepeatedly(Return(false)); + EXPECT_CALL(*mock_pss_, IsUsingSecondaryPassphrase()) + .WillRepeatedly(Return(false)); + SetupInitializedProfileSyncService(); + SetDefaultExpectationsForConfigPage(); + EXPECT_CALL(*mock_pss_, EncryptEverythingAllowed()). + WillRepeatedly(Return(false)); + + // This should display the sync setup dialog (not login). + handler_->OpenSyncSetup(); + + ExpectConfig(); + const TestWebUI::CallData& data = web_ui_.call_data()[0]; + base::DictionaryValue* dictionary; + ASSERT_TRUE(data.arg2->GetAsDictionary(&dictionary)); + CheckBool(dictionary, "encryptAllData", false); + CheckBool(dictionary, "encryptAllDataAllowed", false); +} + +TEST_F(SyncSetupHandlerTest, TurnOnEncryptAllDisallowed) { + std::string args = GetConfiguration( + NULL, SYNC_ALL_DATA, GetAllTypes(), std::string(), ENCRYPT_ALL_DATA); + base::ListValue list_args; + list_args.Append(new base::StringValue(args)); + EXPECT_CALL(*mock_pss_, IsPassphraseRequiredForDecryption()) + .WillRepeatedly(Return(false)); + EXPECT_CALL(*mock_pss_, IsPassphraseRequired()) + .WillRepeatedly(Return(false)); + SetupInitializedProfileSyncService(); + EXPECT_CALL(*mock_pss_, EncryptEverythingAllowed()). + WillRepeatedly(Return(false)); + EXPECT_CALL(*mock_pss_, EnableEncryptEverything()).Times(0); + EXPECT_CALL(*mock_pss_, OnUserChoseDatatypes(true, _)); + handler_->HandleConfigure(&list_args); + + // Ensure that we navigated to the "done" state since we don't need a + // passphrase. + ExpectDone(); +} + |