diff options
Diffstat (limited to 'chromium/chrome/browser/ui/webui')
9 files changed, 65 insertions, 16 deletions
diff --git a/chromium/chrome/browser/ui/webui/chromeos/login/oobe_display_chooser.cc b/chromium/chrome/browser/ui/webui/chromeos/login/oobe_display_chooser.cc index 6d88ecc4029..6f4a3e8186a 100644 --- a/chromium/chrome/browser/ui/webui/chromeos/login/oobe_display_chooser.cc +++ b/chromium/chrome/browser/ui/webui/chromeos/login/oobe_display_chooser.cc @@ -30,7 +30,7 @@ bool TouchSupportAvailable(const display::Display& display) { } // TODO(felixe): More context at crbug.com/738885 -const uint16_t kDeviceIds[] = {0x0457, 0x266e}; +const uint16_t kDeviceIds[] = {0x0457, 0x266e, 0x222a}; // Returns true if |vendor_id| is a valid vendor id that may be made the primary // display. diff --git a/chromium/chrome/browser/ui/webui/net_internals/net_internals_ui.cc b/chromium/chrome/browser/ui/webui/net_internals/net_internals_ui.cc index ff1c8c4bc25..e658f7fc05f 100644 --- a/chromium/chrome/browser/ui/webui/net_internals/net_internals_ui.cc +++ b/chromium/chrome/browser/ui/webui/net_internals/net_internals_ui.cc @@ -433,7 +433,8 @@ void NetInternalsMessageHandler::OnStoreDebugLogs(const base::ListValue* list) { base::FilePath policies_path = path.Append("policies.json"); std::string json_policies = policy::GetAllPolicyValuesAsJSON( web_ui()->GetWebContents()->GetBrowserContext(), - true /* with_user_policies */, false /* with device identity */); + true /* with_user_policies */, false /* with device identity */, + true /* is_pretty_print */); base::PostTaskWithTraitsAndReply( FROM_HERE, {base::MayBlock(), base::TaskPriority::BEST_EFFORT, diff --git a/chromium/chrome/browser/ui/webui/policy_ui_handler.cc b/chromium/chrome/browser/ui/webui/policy_ui_handler.cc index 030562d894c..4b9774e0025 100644 --- a/chromium/chrome/browser/ui/webui/policy_ui_handler.cc +++ b/chromium/chrome/browser/ui/webui/policy_ui_handler.cc @@ -844,7 +844,8 @@ void PolicyUIHandler::SendPolicyNames() const { void PolicyUIHandler::SendPolicyValues() const { base::Value all_policies = policy::GetAllPolicyValuesAsDictionary( web_ui()->GetWebContents()->GetBrowserContext(), - true /* with_user_policies */, true /* convert_values */); + true /* with_user_policies */, true /* convert_values */, + true /* is_pretty_print */); web_ui()->CallJavascriptFunctionUnsafe("policy.Page.setPolicyValues", all_policies); } @@ -921,7 +922,8 @@ void PolicyUIHandler::WritePoliciesToJSONFile( const base::FilePath& path) const { std::string json_policies = policy::GetAllPolicyValuesAsJSON( web_ui()->GetWebContents()->GetBrowserContext(), - true /* with_user_policies */, false /* with device identity */); + true /* with_user_policies */, false /* with device identity */, + true /* is_pretty_print */); base::PostTaskWithTraits( FROM_HERE, diff --git a/chromium/chrome/browser/ui/webui/print_preview/local_printer_handler_chromeos.cc b/chromium/chrome/browser/ui/webui/print_preview/local_printer_handler_chromeos.cc index 81bd450d999..17cac053ea8 100644 --- a/chromium/chrome/browser/ui/webui/print_preview/local_printer_handler_chromeos.cc +++ b/chromium/chrome/browser/ui/webui/print_preview/local_printer_handler_chromeos.cc @@ -219,7 +219,9 @@ void LocalPrinterHandlerChromeos::HandlePrinterSetup( case chromeos::PrinterSetupResult::kFatalError: case chromeos::PrinterSetupResult::kNativePrintersNotAllowed: case chromeos::PrinterSetupResult::kInvalidPrinterUpdate: - LOG(ERROR) << "Unexpected error in printer setup." << result; + case chromeos::PrinterSetupResult::kDbusNoReply: + case chromeos::PrinterSetupResult::kDbusTimeout: + LOG(ERROR) << "Unexpected error in printer setup. " << result; break; case chromeos::PrinterSetupResult::kMaxValue: NOTREACHED() << "This value is not expected"; diff --git a/chromium/chrome/browser/ui/webui/settings/chromeos/cups_printers_handler.cc b/chromium/chrome/browser/ui/webui/settings/chromeos/cups_printers_handler.cc index 7932d706c9e..440b61401c3 100644 --- a/chromium/chrome/browser/ui/webui/settings/chromeos/cups_printers_handler.cc +++ b/chromium/chrome/browser/ui/webui/settings/chromeos/cups_printers_handler.cc @@ -700,6 +700,12 @@ void CupsPrintersHandler::OnAddedPrinterCommon(const Printer& printer, PRINTER_LOG(ERROR) << "Requested printer changes would make printer unusable"; break; + case PrinterSetupResult::kDbusNoReply: + PRINTER_LOG(ERROR) << "Couldn't talk to debugd over D-Bus."; + break; + case PrinterSetupResult::kDbusTimeout: + PRINTER_LOG(ERROR) << "Timed out trying to reach debugd over D-Bus."; + break; case PrinterSetupResult::kMaxValue: NOTREACHED() << "This is not an expected value"; break; diff --git a/chromium/chrome/browser/ui/webui/settings/people_handler.cc b/chromium/chrome/browser/ui/webui/settings/people_handler.cc index e92cea80ce7..7c368a6df80 100644 --- a/chromium/chrome/browser/ui/webui/settings/people_handler.cc +++ b/chromium/chrome/browser/ui/webui/settings/people_handler.cc @@ -12,6 +12,8 @@ #include "base/i18n/time_formatting.h" #include "base/json/json_reader.h" #include "base/metrics/histogram_macros.h" +#include "base/metrics/user_metrics.h" +#include "base/strings/utf_string_conversions.h" #include "base/values.h" #include "build/build_config.h" #include "chrome/browser/lifetime/application_lifetime.h" @@ -215,8 +217,11 @@ PeopleHandler::~PeopleHandler() { if (!web_ui()) return; - // Note that if the user left the sync page by closing the tab, refresh, - // or via the back navigation, it would first go through OnDidClosePage(). + // If unified consent is enabled and the user left the sync page by closing + // the tab, refresh, or via the back navigation, the sync setup needs to be + // closed. If this was the first time setup, sync will be cancelled. + // Note, if unified consent is disabled, it will first go through + // |OnDidClosePage()|. CloseSyncSetup(); } @@ -546,8 +551,10 @@ void PeopleHandler::HandleSetEncryption(const base::ListValue* args) { // Don't allow "encrypt all" if the SyncService 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->GetUserSettings()->IsEncryptEverythingAllowed()) + if (!service->GetUserSettings()->IsEncryptEverythingAllowed()) { configuration.encrypt_all = false; + configuration.set_new_passphrase = false; + } // Note: Data encryption will not occur until configuration is complete // (when the PSS receives its CONFIGURE_DONE notification from the sync @@ -616,6 +623,9 @@ void PeopleHandler::HandleShowSetupUI(const base::ListValue* args) { GetLoginUIService()->SetLoginUI(this); + // Observe the web contents for a before unload event. + Observe(web_ui()->GetWebContents()); + PushSyncPrefs(); // Always let the page open when unified consent is enabled. return; @@ -832,6 +842,9 @@ void PeopleHandler::CloseSyncSetup() { sync_blocker_.reset(); configuring_sync_ = false; + + // Stop observing the web contents. + Observe(nullptr); } void PeopleHandler::InitializeSyncBlocker() { @@ -876,6 +889,16 @@ void PeopleHandler::OnStateChanged(syncer::SyncService* sync) { PushSyncPrefs(); } +void PeopleHandler::BeforeUnloadDialogCancelled() { + // The before unload dialog is only shown during the first sync setup. + DCHECK(IdentityManagerFactory::GetForProfile(profile_)->HasPrimaryAccount()); + syncer::SyncService* service = GetSyncService(); + DCHECK(service && service->IsFirstSetupInProgress()); + + base::RecordAction( + base::UserMetricsAction("Signin_Signin_CancelAbortAdvancedSyncSettings")); +} + std::unique_ptr<base::DictionaryValue> PeopleHandler::GetSyncStatusDictionary() { std::unique_ptr<base::DictionaryValue> sync_status(new base::DictionaryValue); diff --git a/chromium/chrome/browser/ui/webui/settings/people_handler.h b/chromium/chrome/browser/ui/webui/settings/people_handler.h index 37e540233c2..e4748f7864f 100644 --- a/chromium/chrome/browser/ui/webui/settings/people_handler.h +++ b/chromium/chrome/browser/ui/webui/settings/people_handler.h @@ -22,6 +22,7 @@ #include "components/prefs/pref_change_registrar.h" #include "components/signin/core/browser/signin_buildflags.h" #include "components/sync/driver/sync_service_observer.h" +#include "content/public/browser/web_contents_observer.h" #include "services/identity/public/cpp/identity_manager.h" class LoginUIService; @@ -45,7 +46,8 @@ class PeopleHandler : public SettingsPageUIHandler, public identity::IdentityManager::Observer, public SyncStartupTracker::Observer, public LoginUIService::LoginUI, - public syncer::SyncServiceObserver { + public syncer::SyncServiceObserver, + public content::WebContentsObserver { public: // TODO(tommycli): Remove these strings and instead use WebUIListener events. // These string constants are used from JavaScript (sync_browser_proxy.js). @@ -137,6 +139,8 @@ class PeopleHandler : public SettingsPageUIHandler, // syncer::SyncServiceObserver implementation. void OnStateChanged(syncer::SyncService* sync) override; + // content::WebContentsObserver implementation + void BeforeUnloadDialogCancelled() override; // Returns a newly created dictionary with a number of properties that // correspond to the status of sync. diff --git a/chromium/chrome/browser/ui/webui/settings/people_handler_unittest.cc b/chromium/chrome/browser/ui/webui/settings/people_handler_unittest.cc index 7ef14432f17..a4fe434142c 100644 --- a/chromium/chrome/browser/ui/webui/settings/people_handler_unittest.cc +++ b/chromium/chrome/browser/ui/webui/settings/people_handler_unittest.cc @@ -731,6 +731,8 @@ TEST_F(PeopleHandlerTest, SetNewCustomPassphrase) { base::ListValue list_args; list_args.AppendString(kTestCallbackId); list_args.AppendString(args); + ON_CALL(*mock_pss_->GetUserSettingsMock(), IsEncryptEverythingAllowed()) + .WillByDefault(Return(true)); ON_CALL(*mock_pss_->GetUserSettingsMock(), IsPassphraseRequiredForDecryption()) .WillByDefault(Return(false)); @@ -1067,11 +1069,6 @@ TEST_F(PeopleHandlerTest, ShowSetupEncryptAllDisallowed) { } TEST_F(PeopleHandlerTest, TurnOnEncryptAllDisallowed) { - std::string args = GetConfiguration( - NULL, SYNC_ALL_DATA, GetAllTypes(), std::string(), ENCRYPT_ALL_DATA); - base::ListValue list_args; - list_args.AppendString(kTestCallbackId); - list_args.AppendString(args); ON_CALL(*mock_pss_->GetUserSettingsMock(), IsPassphraseRequiredForDecryption()) .WillByDefault(Return(false)); @@ -1080,8 +1077,20 @@ TEST_F(PeopleHandlerTest, TurnOnEncryptAllDisallowed) { SetupInitializedProfileSyncService(); ON_CALL(*mock_pss_->GetUserSettingsMock(), IsEncryptEverythingAllowed()) .WillByDefault(Return(false)); + + base::DictionaryValue dict; + dict.SetBoolean("setNewPassphrase", true); + std::string args = GetConfiguration(&dict, SYNC_ALL_DATA, GetAllTypes(), + "password", ENCRYPT_ALL_DATA); + base::ListValue list_args; + list_args.AppendString(kTestCallbackId); + list_args.AppendString(args); + EXPECT_CALL(*mock_pss_->GetUserSettingsMock(), EnableEncryptEverything()) .Times(0); + EXPECT_CALL(*mock_pss_->GetUserSettingsMock(), SetEncryptionPassphrase(_)) + .Times(0); + handler_->HandleSetEncryption(&list_args); ExpectPageStatusResponse(PeopleHandler::kConfigurePageStatus); diff --git a/chromium/chrome/browser/ui/webui/welcome/nux_helper.cc b/chromium/chrome/browser/ui/webui/welcome/nux_helper.cc index e1cb081e069..05132e5ae81 100644 --- a/chromium/chrome/browser/ui/webui/welcome/nux_helper.cc +++ b/chromium/chrome/browser/ui/webui/welcome/nux_helper.cc @@ -77,8 +77,10 @@ bool IsNuxOnboardingEnabled(Profile* profile) { return false; } - // TODO(hcarmona): Re-enable synthetic trial reporting when we know more - // about https://crbug.com/919705 + // User will be tied to their original onboarding group, even after + // experiment ends. + ChromeMetricsServiceAccessor::RegisterSyntheticFieldTrial( + "NaviOnboardingSynthetic", onboard_group); if (base::FeatureList::IsEnabled(nux::kNuxOnboardingFeature)) { return true; |