[cleanup] clang-format chrome/browser/ui.
Produced with:
find chrome/browser/ui -name "*.cc" -o -name "*.h" -o -name "*.mm" | xargs clang-format -i
[email protected]
NO_IFTTT=Reformat only
Bug: none
Change-Id: I9b1851a0666f0386f34e47f4592f4460a9486d0b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6117306
Reviewed-by: Peter Boström <[email protected]>
Commit-Queue: Peter Boström <[email protected]>
Owners-Override: Peter Boström <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1399675}
diff --git a/chrome/browser/ui/webui/about/about_ui.cc b/chrome/browser/ui/webui/about/about_ui.cc
index ca7c302..4a28298 100644
--- a/chrome/browser/ui/webui/about/about_ui.cc
+++ b/chrome/browser/ui/webui/about/about_ui.cc
@@ -155,8 +155,9 @@
const ash::StartupCustomizationDocument* customization =
ash::StartupCustomizationDocument::GetInstance();
- if (!customization->IsReady())
+ if (!customization->IsReady()) {
return;
+ }
base::FilePath oem_eula_file_path;
if (net::FileURLToFilePath(GURL(customization->GetEULAPage(locale_)),
@@ -403,19 +404,19 @@
}
}
-void AppendBody(std::string *output) {
+void AppendBody(std::string* output) {
output->append("</head>\n<body>\n");
}
-void AppendFooter(std::string *output) {
+void AppendFooter(std::string* output) {
output->append("</body>\n</html>\n");
}
} // namespace about_ui
-using about_ui::AppendHeader;
using about_ui::AppendBody;
using about_ui::AppendFooter;
+using about_ui::AppendHeader;
namespace {
@@ -473,7 +474,6 @@
? base::StrCat({"<li><a href='", url, "/'>", url, "</a></li>\n"})
: base::StrCat({"<li>", url, "</li>\n"});
}
-
}
#if BUILDFLAG(ENABLE_SESSION_SERVICE)
@@ -484,7 +484,8 @@
chrome::kChromeUISessionServiceInternalsPath, "</a></li>\n"});
#endif // BUILDFLAG(ENABLE_SESSION_SERVICE)
- html += "</ul>\n<h2>For Debug</h2>\n"
+ html +=
+ "</ul>\n<h2>For Debug</h2>\n"
"<p>The following pages are for debugging purposes only. Because they "
"crash or hang the renderer, they're not linked directly; you can type "
"them into the address bar if you need them.</p>\n<ul>";
@@ -561,8 +562,7 @@
AboutUIHTMLSource::AboutUIHTMLSource(const std::string& source_name,
Profile* profile)
- : source_name_(source_name),
- profile_(profile) {}
+ : source_name_(source_name), profile_(profile) {}
AboutUIHTMLSource::~AboutUIHTMLSource() = default;
@@ -583,10 +583,11 @@
response = ChromeURLs(profile_);
} else if (source_name_ == chrome::kChromeUICreditsHost) {
int idr = IDR_ABOUT_UI_CREDITS_HTML;
- if (path == kCreditsJsPath)
+ if (path == kCreditsJsPath) {
idr = IDR_ABOUT_UI_CREDITS_JS;
- else if (path == kCreditsCssPath)
+ } else if (path == kCreditsCssPath) {
idr = IDR_ABOUT_UI_CREDITS_CSS;
+ }
if (idr == IDR_ABOUT_UI_CREDITS_HTML) {
response = about_ui::GetCredits(true /*include_scripts*/);
} else {
diff --git a/chrome/browser/ui/webui/about/about_ui.h b/chrome/browser/ui/webui/about/about_ui.h
index 1b8d354f..3f08e018 100644
--- a/chrome/browser/ui/webui/about/about_ui.h
+++ b/chrome/browser/ui/webui/about/about_ui.h
@@ -139,8 +139,8 @@
// Helper functions
void AppendHeader(std::string* output, const std::string& unescaped_title);
-void AppendBody(std::string *output);
-void AppendFooter(std::string *output);
+void AppendBody(std::string* output);
+void AppendFooter(std::string* output);
} // namespace about_ui
diff --git a/chrome/browser/ui/webui/about/about_ui_unittest.cc b/chrome/browser/ui/webui/about/about_ui_unittest.cc
index 3c94d7c6..2f81df0b 100644
--- a/chrome/browser/ui/webui/about/about_ui_unittest.cc
+++ b/chrome/browser/ui/webui/about/about_ui_unittest.cc
@@ -104,8 +104,9 @@
// the |locale| string to the created file.
bool CreateTermsForLocale(const std::string& locale) {
base::FilePath dir = arc_tos_dir_.Append(base::ToLowerASCII(locale));
- if (!base::CreateDirectory(dir))
+ if (!base::CreateDirectory(dir)) {
return false;
+ }
return base::WriteFile(dir.AppendASCII("terms.html"), locale);
}
@@ -114,8 +115,9 @@
// Writes the |locale| string to the created file.
bool CreatePrivacyPolicyForLocale(const std::string& locale) {
base::FilePath dir = arc_tos_dir_.Append(base::ToLowerASCII(locale));
- if (!base::CreateDirectory(dir))
+ if (!base::CreateDirectory(dir)) {
return false;
+ }
return base::WriteFile(dir.AppendASCII("privacy_policy.pdf"), locale);
}
diff --git a/chrome/browser/ui/webui/access_code_cast/access_code_cast_dialog.cc b/chrome/browser/ui/webui/access_code_cast/access_code_cast_dialog.cc
index 277a7a12..1784496 100644
--- a/chrome/browser/ui/webui/access_code_cast/access_code_cast_dialog.cc
+++ b/chrome/browser/ui/webui/access_code_cast/access_code_cast_dialog.cc
@@ -32,11 +32,13 @@
// Keeps track of the dialog that is currently being displayed.
static base::NoDestructor<base::WeakPtr<AccessCodeCastDialog>>
current_instance;
- if (*current_instance)
+ if (*current_instance) {
// Closing the dialog will cause the dialog to delete itself.
(*current_instance)->CloseDialogWidget();
- if (dialog)
+ }
+ if (dialog) {
*current_instance = std::move(dialog);
+ }
}
void UpdateDialogPosition(views::Widget* widget,
@@ -80,8 +82,9 @@
dialog_host->GetHostView());
const gfx::Rect work_area = display.work_area();
- if (!work_area.Contains(display_rect))
+ if (!work_area.Contains(display_rect)) {
display_rect.AdjustToFit(work_area);
+ }
position = display_rect.origin();
}
@@ -135,8 +138,9 @@
// ensures that a |MediaRouteStarter| is passed in, if |media_route_starter_|
// is nullptr, it means that |ShowWebDialog| was already called.
DCHECK(media_route_starter_) << "Cannot show dialog more than once!";
- if (!media_route_starter_)
+ if (!media_route_starter_) {
return;
+ }
auto extra_params = CreateParams(dialog_mode);
@@ -213,8 +217,9 @@
// views::WidgetObserver:
void AccessCodeCastDialog::OnWidgetActivationChanged(views::Widget* widget,
bool active) {
- if (block_widget_activation_changed_for_test_)
+ if (block_widget_activation_changed_for_test_) {
return;
+ }
DCHECK(dialog_widget_)
<< "dialog_widget_ must be set exactly once during dialog setup";
// Close the dialog only if it is no longer active and it isn't already
@@ -264,8 +269,9 @@
views::Widget* widget = views::Widget::GetWidgetForNativeWindow(
web_contents_->GetTopLevelNativeWindow());
DCHECK(widget) << "Could not find a parent widget!";
- if (widget)
+ if (widget) {
parent = widget->GetNativeView();
+ }
}
return parent;
diff --git a/chrome/browser/ui/webui/access_code_cast/access_code_cast_dialog_browsertest.cc b/chrome/browser/ui/webui/access_code_cast/access_code_cast_dialog_browsertest.cc
index 02899c4..f1abf6a 100644
--- a/chrome/browser/ui/webui/access_code_cast/access_code_cast_dialog_browsertest.cc
+++ b/chrome/browser/ui/webui/access_code_cast/access_code_cast_dialog_browsertest.cc
@@ -2,11 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "chrome/browser/ui/webui/access_code_cast/access_code_cast_dialog.h"
+
#include "chrome/browser/media/router/discovery/access_code/access_code_cast_feature.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/test/test_browser_dialog.h"
-#include "chrome/browser/ui/webui/access_code_cast/access_code_cast_dialog.h"
#include "chrome/test/base/chrome_test_utils.h"
#include "components/prefs/pref_service.h"
#include "content/public/browser/web_contents_observer.h"
diff --git a/chrome/browser/ui/webui/access_code_cast/access_code_cast_handler.cc b/chrome/browser/ui/webui/access_code_cast/access_code_cast_handler.cc
index 9b37ce3..0ce0e1b1 100644
--- a/chrome/browser/ui/webui/access_code_cast/access_code_cast_handler.cc
+++ b/chrome/browser/ui/webui/access_code_cast/access_code_cast_handler.cc
@@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include <numeric>
-
#include "chrome/browser/ui/webui/access_code_cast/access_code_cast_handler.h"
+#include <numeric>
+
#include "base/containers/contains.h"
#include "base/metrics/histogram_functions.h"
#include "base/rand_util.h"
@@ -160,8 +160,9 @@
AccessCodeCastHandler::~AccessCodeCastHandler() {
AccessCodeCastMetrics::RecordAccessCodeNotFoundCount(
access_code_not_found_count_);
- if (media_route_starter_)
+ if (media_route_starter_) {
media_route_starter_->RemoveMediaSinkWithCastModesObserver(this);
+ }
}
void AccessCodeCastHandler::Init() {
@@ -213,8 +214,9 @@
// attempt to create route parameters before the sink is in QRM will fail.
void AccessCodeCastHandler::CheckForDiscoveryCompletion() {
// Dialog has already notified (with most likely an error).
- if (!add_sink_callback_)
+ if (!add_sink_callback_) {
return;
+ }
DCHECK(sink_id_) << "Must have a sink id to complete!";
DCHECK(media_route_starter_) << "Must have a MediaRouteStarter to complete!";
@@ -234,8 +236,9 @@
std::optional<MediaSink::Id> sink_id) {
DCHECK(sink_id || add_sink_result != AddSinkResultCode::OK);
- if (add_sink_result == AddSinkResultCode::ACCESS_CODE_NOT_FOUND)
+ if (add_sink_result == AddSinkResultCode::ACCESS_CODE_NOT_FOUND) {
access_code_not_found_count_++;
+ }
// Wait for OnResultsUpdated before triggering the |add_sink_callback_| since
// we are not entirely sure the sink is ready to be casted to yet.
@@ -400,8 +403,9 @@
}
bool AccessCodeCastHandler::IsAccountSyncEnabled() {
- if (!identity_manager_ || !sync_service_)
+ if (!identity_manager_ || !sync_service_) {
return false;
+ }
return identity_manager_->HasPrimaryAccount(signin::ConsentLevel::kSync) &&
sync_service_->IsSyncFeatureActive();
}
diff --git a/chrome/browser/ui/webui/app_settings/web_app_settings_navigation_throttle.cc b/chrome/browser/ui/webui/app_settings/web_app_settings_navigation_throttle.cc
index 6fb8108..9a5bcb8 100644
--- a/chrome/browser/ui/webui/app_settings/web_app_settings_navigation_throttle.cc
+++ b/chrome/browser/ui/webui/app_settings/web_app_settings_navigation_throttle.cc
@@ -25,11 +25,13 @@
WebAppSettingsNavigationThrottle::MaybeCreateThrottleFor(
content::NavigationHandle* handle) {
// Check the current url scheme is chrome://
- if (!handle->GetURL().SchemeIs(content::kChromeUIScheme))
+ if (!handle->GetURL().SchemeIs(content::kChromeUIScheme)) {
return nullptr;
+ }
// Check the current url is chrome://app-settings
- if (handle->GetURL().host_piece() != chrome::kChromeUIWebAppSettingsHost)
+ if (handle->GetURL().host_piece() != chrome::kChromeUIWebAppSettingsHost) {
return nullptr;
+ }
return std::make_unique<WebAppSettingsNavigationThrottle>(handle);
}
diff --git a/chrome/browser/ui/webui/app_settings/web_app_settings_ui.cc b/chrome/browser/ui/webui/app_settings/web_app_settings_ui.cc
index dbbac90..3fc49c3 100644
--- a/chrome/browser/ui/webui/app_settings/web_app_settings_ui.cc
+++ b/chrome/browser/ui/webui/app_settings/web_app_settings_ui.cc
@@ -161,8 +161,9 @@
const webapps::AppId current_app_id =
web_app::GetAppIdFromAppSettingsUrl(web_contents->GetURL());
- if (app_id == current_app_id)
+ if (app_id == current_app_id) {
web_contents->ClosePage();
+ }
}
void WebAppSettingsUI::OnWebAppInstallManagerDestroyed() {
diff --git a/chrome/browser/ui/webui/ash/add_supervision/add_supervision_handler.cc b/chrome/browser/ui/webui/ash/add_supervision/add_supervision_handler.cc
index bab1144..9ff83e0f 100644
--- a/chrome/browser/ui/webui/ash/add_supervision/add_supervision_handler.cc
+++ b/chrome/browser/ui/webui/ash/add_supervision/add_supervision_handler.cc
@@ -79,15 +79,16 @@
std::vector<std::string> installed_arc_apps;
apps::AppServiceProxyFactory::GetForProfile(profile)
->AppRegistryCache()
- .ForEachApp([&installed_arc_apps,
- profile](const apps::AppUpdate& update) {
- if (ShouldIncludeAppUpdate(update)) {
- std::string package_name =
- arc::AppIdToArcPackageName(update.AppId(), profile);
- if (!package_name.empty())
- installed_arc_apps.push_back(package_name);
- }
- });
+ .ForEachApp(
+ [&installed_arc_apps, profile](const apps::AppUpdate& update) {
+ if (ShouldIncludeAppUpdate(update)) {
+ std::string package_name =
+ arc::AppIdToArcPackageName(update.AppId(), profile);
+ if (!package_name.empty()) {
+ installed_arc_apps.push_back(package_name);
+ }
+ }
+ });
std::move(callback).Run(installed_arc_apps);
}
diff --git a/chrome/browser/ui/webui/ash/add_supervision/add_supervision_handler_utils_unittest.cc b/chrome/browser/ui/webui/ash/add_supervision/add_supervision_handler_utils_unittest.cc
index 1fc6e79..5c3db3c 100644
--- a/chrome/browser/ui/webui/ash/add_supervision/add_supervision_handler_utils_unittest.cc
+++ b/chrome/browser/ui/webui/ash/add_supervision/add_supervision_handler_utils_unittest.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "chrome/browser/ui/webui/ash/add_supervision/add_supervision_handler_utils.h"
+
#include "components/services/app_service/public/cpp/app_types.h"
#include "components/services/app_service/public/cpp/app_update.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/chrome/browser/ui/webui/ash/add_supervision/add_supervision_metrics_recorder_browsertest.cc b/chrome/browser/ui/webui/ash/add_supervision/add_supervision_metrics_recorder_browsertest.cc
index 38c70f7a..3296265 100644
--- a/chrome/browser/ui/webui/ash/add_supervision/add_supervision_metrics_recorder_browsertest.cc
+++ b/chrome/browser/ui/webui/ash/add_supervision/add_supervision_metrics_recorder_browsertest.cc
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "chrome/browser/ui/webui/ash/add_supervision/add_supervision_metrics_recorder.h"
+
#include "base/test/metrics/histogram_tester.h"
#include "base/test/metrics/user_action_tester.h"
#include "base/test/test_mock_time_task_runner.h"
@@ -9,7 +11,6 @@
#include "chrome/browser/ui/webui/ash/add_supervision/add_supervision.mojom.h"
#include "chrome/browser/ui/webui/ash/add_supervision/add_supervision_handler.h"
#include "chrome/browser/ui/webui/ash/add_supervision/add_supervision_handler_utils.h"
-#include "chrome/browser/ui/webui/ash/add_supervision/add_supervision_metrics_recorder.h"
#include "chrome/browser/ui/webui/ash/add_supervision/add_supervision_ui.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "components/signin/public/identity_manager/identity_test_environment.h"
diff --git a/chrome/browser/ui/webui/ash/add_supervision/add_supervision_ui_browsertest.cc b/chrome/browser/ui/webui/ash/add_supervision/add_supervision_ui_browsertest.cc
index 3465df7..45d074c 100644
--- a/chrome/browser/ui/webui/ash/add_supervision/add_supervision_ui_browsertest.cc
+++ b/chrome/browser/ui/webui/ash/add_supervision/add_supervision_ui_browsertest.cc
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "chrome/browser/ui/webui/ash/add_supervision/add_supervision_ui.h"
+
#include <string>
#include "base/strings/strcat.h"
@@ -9,7 +11,6 @@
#include "base/test/metrics/user_action_tester.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/webui/ash/add_supervision/add_supervision_metrics_recorder.h"
-#include "chrome/browser/ui/webui/ash/add_supervision/add_supervision_ui.h"
#include "chrome/browser/ui/webui/ash/add_supervision/confirm_signout_dialog.h"
#include "chrome/common/webui_url_constants.h"
#include "chrome/test/base/in_process_browser_test.h"
diff --git a/chrome/browser/ui/webui/ash/arc_power_control/arc_power_control_handler.cc b/chrome/browser/ui/webui/ash/arc_power_control/arc_power_control_handler.cc
index 92d8d34..9a670cf 100644
--- a/chrome/browser/ui/webui/ash/arc_power_control/arc_power_control_handler.cc
+++ b/chrome/browser/ui/webui/ash/arc_power_control/arc_power_control_handler.cc
@@ -165,8 +165,9 @@
std::string mode = kThrottlingAuto;
auto* observer = instance_throttle_->GetObserverByName(
arc::ArcInstanceThrottle::kChromeArcPowerControlPageObserver);
- if (observer && observer->enforced())
+ if (observer && observer->enforced()) {
mode = observer->active() ? kThrottlingDisable : kThrottlingForce;
+ }
CallJavascriptFunction(GetJavascriptDomain() + "setThrottlingMode",
base::Value(mode));
@@ -181,8 +182,9 @@
arc::mojom::PowerInstance* power_instance = ARC_GET_INSTANCE_FOR_METHOD(
arc::ArcServiceManager::Get()->arc_bridge_service()->power(),
GetWakefulnessMode);
- if (!power_instance)
+ if (!power_instance) {
return;
+ }
power_instance->GetWakefulnessMode(
base::BindOnce(&ArcPowerControlHandler::OnWakefulnessChanged,
@@ -220,19 +222,22 @@
if (wakefulness_mode_ == arc::mojom::WakefulnessMode::ASLEEP) {
arc::mojom::PowerInstance* const power_instance =
ARC_GET_INSTANCE_FOR_METHOD(power, Resume);
- if (power_instance)
+ if (power_instance) {
power_instance->Resume();
+ }
} else {
arc::mojom::PowerInstance* const power_instance =
ARC_GET_INSTANCE_FOR_METHOD(power, SetIdleState);
- if (power_instance)
+ if (power_instance) {
power_instance->SetIdleState(arc::mojom::IdleState::ACTIVE);
+ }
}
} else if (mode == kWakenessfullDoze) {
arc::mojom::PowerInstance* const power_instance =
ARC_GET_INSTANCE_FOR_METHOD(power, SetIdleState);
- if (power_instance)
+ if (power_instance) {
power_instance->SetIdleState(arc::mojom::IdleState::INACTIVE);
+ }
} else if (mode == kWakenessfullForceDoze) {
arc::mojom::PowerInstance* const power_instance =
ARC_GET_INSTANCE_FOR_METHOD(power, SetIdleState);
@@ -242,8 +247,9 @@
} else if (mode == kWakenessfullSleep) {
arc::mojom::PowerInstance* const power_instance =
ARC_GET_INSTANCE_FOR_METHOD(power, Suspend);
- if (power_instance)
+ if (power_instance) {
power_instance->Suspend(base::BindOnce(&OnAndroidSuspendReady));
+ }
} else {
LOG(ERROR) << "Invalid mode: " << mode;
}
@@ -317,8 +323,9 @@
}
void ArcPowerControlHandler::StopTracing() {
- if (!system_stat_collector_)
+ if (!system_stat_collector_) {
return;
+ }
const base::TimeTicks tracing_time_max = TRACE_TIME_TICKS_NOW();
stop_tracing_timer_.Stop();
@@ -371,10 +378,11 @@
}
status += " (";
- if (instance_throttle_->should_throttle())
+ if (instance_throttle_->should_throttle()) {
status += "throttling";
- else
+ } else {
status += "critical foreground";
+ }
status += ")";
CallJavascriptFunction(GetJavascriptDomain() + "setPowerControlStatus",
diff --git a/chrome/browser/ui/webui/ash/assistant_optin/assistant_optin_ui.cc b/chrome/browser/ui/webui/ash/assistant_optin/assistant_optin_ui.cc
index 5e7944a..038ca4d 100644
--- a/chrome/browser/ui/webui/ash/assistant_optin/assistant_optin_ui.cc
+++ b/chrome/browser/ui/webui/ash/assistant_optin/assistant_optin_ui.cc
@@ -145,8 +145,9 @@
// static
bool AssistantOptInDialog::BounceIfActive() {
- if (!g_dialog)
+ if (!g_dialog) {
return false;
+ }
g_dialog->Focus();
wm::AnimateWindow(g_dialog->dialog_window(),
@@ -190,8 +191,9 @@
}
void AssistantOptInDialog::OnDialogClosed(const std::string& json_retval) {
- if (assistant_ui_)
+ if (assistant_ui_) {
assistant_ui_->OnDialogClosed();
+ }
PrefService* prefs = ProfileManager::GetActiveUserProfile()->GetPrefs();
const bool completed =
diff --git a/chrome/browser/ui/webui/ash/audio/audio_handler.cc b/chrome/browser/ui/webui/ash/audio/audio_handler.cc
index aa7cf94..22cc7d6 100644
--- a/chrome/browser/ui/webui/ash/audio/audio_handler.cc
+++ b/chrome/browser/ui/webui/ash/audio/audio_handler.cc
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "chrome/browser/ui/webui/ash/audio/audio_handler.h"
+
#include <string>
#include <tuple>
#include <utility>
@@ -9,7 +11,6 @@
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/chrome_pages.h"
-#include "chrome/browser/ui/webui/ash/audio/audio_handler.h"
namespace ash {
diff --git a/chrome/browser/ui/webui/ash/bluetooth/bluetooth_pairing_dialog.cc b/chrome/browser/ui/webui/ash/bluetooth/bluetooth_pairing_dialog.cc
index e44ba8f..0c582692 100644
--- a/chrome/browser/ui/webui/ash/bluetooth/bluetooth_pairing_dialog.cc
+++ b/chrome/browser/ui/webui/ash/bluetooth/bluetooth_pairing_dialog.cc
@@ -48,8 +48,9 @@
{"cancel", IDS_CANCEL},
{"close", IDS_CLOSE},
};
- for (const auto& entry : localized_strings)
+ for (const auto& entry : localized_strings) {
html_source->AddLocalizedString(entry.name, entry.id);
+ }
bluetooth::AddLoadTimeData(html_source);
}
diff --git a/chrome/browser/ui/webui/ash/cellular_setup/cellular_setup_localized_strings_provider.cc b/chrome/browser/ui/webui/ash/cellular_setup/cellular_setup_localized_strings_provider.cc
index 50b17bff..799a97d 100644
--- a/chrome/browser/ui/webui/ash/cellular_setup/cellular_setup_localized_strings_provider.cc
+++ b/chrome/browser/ui/webui/ash/cellular_setup/cellular_setup_localized_strings_provider.cc
@@ -133,18 +133,21 @@
}
void AddLocalizedValuesToBuilder(::login::LocalizedValuesBuilder* builder) {
- for (const auto& entry : kLocalizedStringsWithoutPlaceholders)
+ for (const auto& entry : kLocalizedStringsWithoutPlaceholders) {
builder->Add(entry.name, entry.id);
+ }
}
void AddNonStringLoadTimeData(content::WebUIDataSource* html_source) {
- for (const auto& entry : GetBooleanValues())
+ for (const auto& entry : GetBooleanValues()) {
html_source->AddBoolean(entry.name, entry.value);
+ }
}
void AddNonStringLoadTimeDataToDict(base::Value::Dict* dict) {
- for (const auto& entry : GetBooleanValues())
+ for (const auto& entry : GetBooleanValues()) {
dict->SetByDottedPath(entry.name, entry.value);
+ }
}
} // namespace ash::cellular_setup
diff --git a/chrome/browser/ui/webui/ash/cellular_setup/mobile_setup_ui.cc b/chrome/browser/ui/webui/ash/cellular_setup/mobile_setup_ui.cc
index ea1a7164b..45dca351 100644
--- a/chrome/browser/ui/webui/ash/cellular_setup/mobile_setup_ui.cc
+++ b/chrome/browser/ui/webui/ash/cellular_setup/mobile_setup_ui.cc
@@ -140,8 +140,9 @@
base::Value GetCellularNetworkInfoValue(const NetworkState* network,
const DeviceState* device) {
base::Value::Dict info;
- if (!device || !network)
+ if (!device || !network) {
return base::Value(std::move(info));
+ }
DCHECK_EQ(network->device_path(), device->path());
@@ -349,8 +350,9 @@
MobileActivator::PlanActivationState state,
MobileActivator::ActivationError error) {
DCHECK_EQ(TYPE_ACTIVATION, type_);
- if (!web_ui())
+ if (!web_ui()) {
return;
+ }
NetworkStateHandler* network_state_handler =
NetworkHandler::Get()->network_state_handler();
@@ -376,8 +378,9 @@
}
void MobileSetupHandler::Reset() {
- if (!active_)
+ if (!active_) {
return;
+ }
active_ = false;
if (type_ == TYPE_ACTIVATION) {
@@ -397,12 +400,14 @@
void MobileSetupHandler::HandleGetDeviceInfo(const base::Value::List& args) {
DCHECK_NE(TYPE_ACTIVATION, type_);
- if (!web_ui())
+ if (!web_ui()) {
return;
+ }
std::string path = web_ui()->GetWebContents()->GetURL().path();
- if (path.empty())
+ if (path.empty()) {
return;
+ }
active_ = true;
AllowJavascript();
@@ -445,12 +450,14 @@
void MobileSetupHandler::DefaultNetworkChanged(
const NetworkState* default_network) {
- if (!web_ui())
+ if (!web_ui()) {
return;
+ }
std::string path = web_ui()->GetWebContents()->GetURL().path().substr(1);
- if (path.empty())
+ if (path.empty()) {
return;
+ }
const NetworkState* network =
NetworkHandler::Get()->network_state_handler()->GetNetworkState(path);
@@ -465,12 +472,14 @@
void MobileSetupHandler::NetworkConnectionStateChanged(
const NetworkState* network) {
- if (!web_ui())
+ if (!web_ui()) {
return;
+ }
std::string path = web_ui()->GetWebContents()->GetURL().path().substr(1);
- if (path.empty() || path != network->path())
+ if (path.empty() || path != network->path()) {
return;
+ }
UpdatePortalReachability(network, false /* do not force notification */);
}
diff --git a/chrome/browser/ui/webui/ash/cloud_upload/cloud_upload_dialog.cc b/chrome/browser/ui/webui/ash/cloud_upload/cloud_upload_dialog.cc
index 9aa08e0..b6ffdf3 100644
--- a/chrome/browser/ui/webui/ash/cloud_upload/cloud_upload_dialog.cc
+++ b/chrome/browser/ui/webui/ash/cloud_upload/cloud_upload_dialog.cc
@@ -588,21 +588,21 @@
return true;
}
- // The files need to be moved.
- auto operation =
- GetUploadType(profile_, file_urls_.front()) == UploadType::kCopy
- ? OfficeFilesTransferRequired::kCopy
- : OfficeFilesTransferRequired::kMove;
- // Set as WARNING as INFO is not allowed.
- LOG(WARNING) << (operation == OfficeFilesTransferRequired::kCopy ? "Copy"
- : "Mov")
- << "ing a " << ext << " file to "
- << (cloud_provider_ == CloudProvider::kGoogleDrive
- ? "Google Drive"
- : "OneDrive");
- transfer_required_ = operation;
- cloud_open_metrics_->LogTransferRequired(operation);
- return ConfirmMoveOrStartUpload();
+ // The files need to be moved.
+ auto operation =
+ GetUploadType(profile_, file_urls_.front()) == UploadType::kCopy
+ ? OfficeFilesTransferRequired::kCopy
+ : OfficeFilesTransferRequired::kMove;
+ // Set as WARNING as INFO is not allowed.
+ LOG(WARNING) << (operation == OfficeFilesTransferRequired::kCopy ? "Copy"
+ : "Mov")
+ << "ing a " << ext << " file to "
+ << (cloud_provider_ == CloudProvider::kGoogleDrive
+ ? "Google Drive"
+ : "OneDrive");
+ transfer_required_ = operation;
+ cloud_open_metrics_->LogTransferRequired(operation);
+ return ConfirmMoveOrStartUpload();
}
void CloudOpenTask::OpenAlreadyHostedDriveUrls() {
diff --git a/chrome/browser/ui/webui/ash/cloud_upload/one_drive_upload_handler.cc b/chrome/browser/ui/webui/ash/cloud_upload/one_drive_upload_handler.cc
index 6d55231..c299c569 100644
--- a/chrome/browser/ui/webui/ash/cloud_upload/one_drive_upload_handler.cc
+++ b/chrome/browser/ui/webui/ash/cloud_upload/one_drive_upload_handler.cc
@@ -208,8 +208,7 @@
LOG(ERROR) << "Upload to OneDrive: " << error_message;
notification_manager_->ShowUploadError(error_message);
}
- std::move(callback_).Run(OfficeTaskResult::kFailedToUpload, std::nullopt,
- 0);
+ std::move(callback_).Run(OfficeTaskResult::kFailedToUpload, std::nullopt, 0);
}
void OneDriveUploadHandler::OnIOTaskStatus(
diff --git a/chrome/browser/ui/webui/ash/edu_coexistence/edu_coexistence_login_handler.cc b/chrome/browser/ui/webui/ash/edu_coexistence/edu_coexistence_login_handler.cc
index 31786741..76ef660 100644
--- a/chrome/browser/ui/webui/ash/edu_coexistence/edu_coexistence_login_handler.cc
+++ b/chrome/browser/ui/webui/ash/edu_coexistence/edu_coexistence_login_handler.cc
@@ -73,15 +73,17 @@
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
// This should only be set during local development tests.
- if (command_line->HasSwitch(kEduCoexistenceLoginURLSwitch))
+ if (command_line->HasSwitch(kEduCoexistenceLoginURLSwitch)) {
return command_line->GetSwitchValueASCII(kEduCoexistenceLoginURLSwitch);
+ }
return kEduCoexistenceLoginDefaultURL;
}
std::string GetSourceUI() {
- if (session_manager::SessionManager::Get()->IsUserSessionBlocked())
+ if (session_manager::SessionManager::Get()->IsUserSessionBlocked()) {
return kOobe;
+ }
return kInSession;
}
@@ -113,17 +115,20 @@
Profile* profile = ProfileManager::GetActiveUserProfile();
const policy::UserCloudPolicyManagerAsh* policy_manager =
profile->GetUserCloudPolicyManagerAsh();
- if (!policy_manager)
+ if (!policy_manager) {
return std::string();
+ }
const policy::CloudPolicyCore* core = policy_manager->core();
const policy::CloudPolicyStore* store = core->store();
- if (!store)
+ if (!store) {
return std::string();
+ }
const enterprise_management::PolicyData* policy = store->policy();
- if (!policy)
+ if (!policy) {
return std::string();
+ }
return policy->device_id();
}
@@ -209,8 +214,9 @@
void EduCoexistenceLoginHandler::OnRefreshTokenUpdatedForAccount(
const CoreAccountInfo& account_info) {
- if (edu_account_email_.empty() || account_info.email != edu_account_email_)
+ if (edu_account_email_.empty() || account_info.email != edu_account_email_) {
return;
+ }
AllowJavascript();
@@ -329,8 +335,9 @@
}
void EduCoexistenceLoginHandler::ConsentLogged(const base::Value::List& args) {
- if (args.size() == 0)
+ if (args.size() == 0) {
return;
+ }
DCHECK(!in_error_state_);
@@ -348,8 +355,9 @@
void EduCoexistenceLoginHandler::OnError(const base::Value::List& args) {
AllowJavascript();
- if (args.size() == 0)
+ if (args.size() == 0) {
return;
+ }
in_error_state_ = true;
for (const base::Value& message : args) {
DCHECK(message.is_string());
diff --git a/chrome/browser/ui/webui/ash/edu_coexistence/edu_coexistence_state_tracker.cc b/chrome/browser/ui/webui/ash/edu_coexistence/edu_coexistence_state_tracker.cc
index d6b4364..4a18827 100644
--- a/chrome/browser/ui/webui/ash/edu_coexistence/edu_coexistence_state_tracker.cc
+++ b/chrome/browser/ui/webui/ash/edu_coexistence/edu_coexistence_state_tracker.cc
@@ -53,8 +53,9 @@
}
void EduCoexistenceStateTracker::OnDialogClosed(const content::WebUI* web_ui) {
- if (!base::Contains(state_tracker_, web_ui))
+ if (!base::Contains(state_tracker_, web_ui)) {
return;
+ }
FlowState& state = state_tracker_[web_ui];
@@ -62,8 +63,9 @@
// then EduCoexistenceLoginHandler has not received a parental consent logged
// signal. Notify |EduCoexistenceChildSigninHelper| that we weren't able to
// successfully log the parental consent so that it can clean up after itself.
- if (state.consent_logged_callback)
+ if (state.consent_logged_callback) {
std::move(state.consent_logged_callback).Run(/* success */ false);
+ }
const std::string& histogram_name =
state.is_onboarding ? kEduCoexistenceV2OnboardingFlowResult
@@ -114,8 +116,9 @@
const EduCoexistenceStateTracker::FlowState*
EduCoexistenceStateTracker::GetInfoForWebUIForTest(
const content::WebUI* web_ui) const {
- if (!base::Contains(state_tracker_, web_ui))
+ if (!base::Contains(state_tracker_, web_ui)) {
return nullptr;
+ }
return &state_tracker_.at(web_ui);
}
diff --git a/chrome/browser/ui/webui/ash/emoji/emoji_page_handler.cc b/chrome/browser/ui/webui/ash/emoji/emoji_page_handler.cc
index e54619df..8d328b3 100644
--- a/chrome/browser/ui/webui/ash/emoji/emoji_page_handler.cc
+++ b/chrome/browser/ui/webui/ash/emoji/emoji_page_handler.cc
@@ -60,9 +60,9 @@
}
void LogInsertGif(bool is_inserted) {
- EmojiVariantType insert_value = is_inserted
- ? EmojiVariantType::kEmojiPickerGifInserted
- : EmojiVariantType::kEmojiPickerGifCopied;
+ EmojiVariantType insert_value =
+ is_inserted ? EmojiVariantType::kEmojiPickerGifInserted
+ : EmojiVariantType::kEmojiPickerGifCopied;
base::UmaHistogramEnumeration("InputMethod.SystemEmojiPicker.TriggerType",
insert_value);
}
diff --git a/chrome/browser/ui/webui/ash/emoji/seal_utils.cc b/chrome/browser/ui/webui/ash/emoji/seal_utils.cc
index 9b9e368..38a23a3d 100644
--- a/chrome/browser/ui/webui/ash/emoji/seal_utils.cc
+++ b/chrome/browser/ui/webui/ash/emoji/seal_utils.cc
@@ -11,9 +11,9 @@
namespace {
- constexpr char kSealKeyHash[] =
- "\x58\x68\x46\x8c\x87\x23\x66\x2b\xef\x20\x58\xc5\x27\x2b\xcf\x0e"
- "\x13\x27\xea\xc1";
+constexpr char kSealKeyHash[] =
+ "\x58\x68\x46\x8c\x87\x23\x66\x2b\xef\x20\x58\xc5\x27\x2b\xcf\x0e"
+ "\x13\x27\xea\xc1";
}
diff --git a/chrome/browser/ui/webui/ash/emulator/device_emulator_message_handler.cc b/chrome/browser/ui/webui/ash/emulator/device_emulator_message_handler.cc
index 02b4617e..973e0fb5 100644
--- a/chrome/browser/ui/webui/ash/emulator/device_emulator_message_handler.cc
+++ b/chrome/browser/ui/webui/ash/emulator/device_emulator_message_handler.cc
@@ -248,8 +248,9 @@
// Get each device's properties.
base::Value::List devices;
- for (const dbus::ObjectPath& path : paths)
+ for (const dbus::ObjectPath& path : paths) {
devices.Append(GetDeviceInfo(path));
+ }
base::Value predefined_devices =
fake_bluetooth_device_client_->GetBluetoothDevicesAsDictionaries();
@@ -424,8 +425,9 @@
CHECK(device_type);
bool dual_role = *device_type == "DualRoleUSB";
source->set_active_by_default(!dual_role);
- if (dual_role)
+ if (dual_role) {
props.set_supports_dual_role_devices(true);
+ }
std::optional<int> port = val.GetDict().FindInt("port");
CHECK(port.has_value());
source->set_port(
@@ -435,14 +437,16 @@
CHECK(power_level);
source->set_max_power(*power_level == "high" ? kPowerLevelHigh
: kPowerLevelLow);
- if (*id == selected_id)
+ if (*id == selected_id) {
selected_source = source;
+ }
}
// Emulate the device's source selection process.
for (const auto& source : props.available_external_power_source()) {
- if (!source.active_by_default())
+ if (!source.active_by_default()) {
continue;
+ }
if (selected_source && selected_source->active_by_default() &&
source.max_power() < selected_source->max_power()) {
continue;
@@ -613,8 +617,9 @@
device.Set("incoming", false);
base::Value::List uuids;
- for (const std::string& uuid : props->uuids.value())
+ for (const std::string& uuid : props->uuids.value()) {
uuids.Append(uuid);
+ }
device.Set("uuids", std::move(uuids));
return device;
@@ -642,16 +647,18 @@
}
void DeviceEmulatorMessageHandler::TouchpadExists(bool exists) {
- if (!IsJavascriptAllowed())
+ if (!IsJavascriptAllowed()) {
return;
+ }
FireWebUIListener("touchpad-exists-changed", base::Value(exists));
}
void DeviceEmulatorMessageHandler::HapticTouchpadExists(bool exists) {}
void DeviceEmulatorMessageHandler::MouseExists(bool exists) {
- if (!IsJavascriptAllowed())
+ if (!IsJavascriptAllowed()) {
return;
+ }
FireWebUIListener("mouse-exists-changed", base::Value(exists));
}
diff --git a/chrome/browser/ui/webui/ash/enterprise_reporting/history_converter.cc b/chrome/browser/ui/webui/ash/enterprise_reporting/history_converter.cc
index 9a4c7d6..e5bcfabe 100644
--- a/chrome/browser/ui/webui/ash/enterprise_reporting/history_converter.cc
+++ b/chrome/browser/ui/webui/ash/enterprise_reporting/history_converter.cc
@@ -126,7 +126,7 @@
}
void PopulateBlockedRecord(const ::reporting::BlockedRecordCall& source,
- enterprise_reporting::mojom::ErpHistoryEvent& dest){
+ enterprise_reporting::mojom::ErpHistoryEvent& dest) {
dest.call = "BlockedRecord";
dest.parameters.emplace_back(
enterprise_reporting::mojom::ErpHistoryEventParameter::New(
@@ -179,7 +179,7 @@
break;
case ::reporting::HealthDataHistory::RecordCase::kBlockedRecordCall:
PopulateBlockedRecord(history.blocked_record_call(),
- *result->events.back());
+ *result->events.back());
break;
case ::reporting::HealthDataHistory::RecordCase::
kBlockedDestinationsUpdatedCall:
diff --git a/chrome/browser/ui/webui/ash/in_session_password_change/password_change_dialogs.cc b/chrome/browser/ui/webui/ash/in_session_password_change/password_change_dialogs.cc
index af136e3bd..d5eea449 100644
--- a/chrome/browser/ui/webui/ash/in_session_password_change/password_change_dialogs.cc
+++ b/chrome/browser/ui/webui/ash/in_session_password_change/password_change_dialogs.cc
@@ -87,8 +87,9 @@
// static
void PasswordChangeDialog::Dismiss() {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- if (g_dialog)
+ if (g_dialog) {
g_dialog->Close();
+ }
}
PasswordChangeDialog::PasswordChangeDialog()
@@ -117,8 +118,9 @@
// static
void ConfirmPasswordChangeDialog::Dismiss() {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- if (g_confirm_dialog)
+ if (g_confirm_dialog) {
g_confirm_dialog->Close();
+ }
}
ConfirmPasswordChangeDialog::ConfirmPasswordChangeDialog(
@@ -179,8 +181,9 @@
// static
void UrgentPasswordExpiryNotificationDialog::Dismiss() {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- if (g_notification_dialog)
+ if (g_notification_dialog) {
g_notification_dialog->Close();
+ }
}
UrgentPasswordExpiryNotificationDialog::UrgentPasswordExpiryNotificationDialog()
diff --git a/chrome/browser/ui/webui/ash/in_session_password_change/password_change_handler.cc b/chrome/browser/ui/webui/ash/in_session_password_change/password_change_handler.cc
index 681bfa0..9a754161 100644
--- a/chrome/browser/ui/webui/ash/in_session_password_change/password_change_handler.cc
+++ b/chrome/browser/ui/webui/ash/in_session_password_change/password_change_handler.cc
@@ -37,8 +37,9 @@
params.Set("passwordChangeUrl", password_change_url_);
const user_manager::User* user =
ProfileHelper::Get()->GetUserByProfile(profile);
- if (user)
+ if (user) {
params.Set("userName", user->GetDisplayEmail());
+ }
CallJavascriptFunction("$(\'main-element\').loadAuthenticator", params);
}
diff --git a/chrome/browser/ui/webui/ash/internet/internet_detail_dialog.cc b/chrome/browser/ui/webui/ash/internet/internet_detail_dialog.cc
index 968c7ac..880d46bf 100644
--- a/chrome/browser/ui/webui/ash/internet/internet_detail_dialog.cc
+++ b/chrome/browser/ui/webui/ash/internet/internet_detail_dialog.cc
@@ -68,8 +68,9 @@
{"networkProxyConnectionType",
IDS_SETTINGS_INTERNET_NETWORK_PROXY_CONNECTION_TYPE_DIALOG},
};
- for (const auto& entry : localized_strings)
+ for (const auto& entry : localized_strings) {
html_source->AddLocalizedString(entry.name, entry.id);
+ }
}
std::string GetNetworkName8(const NetworkState& network) {
@@ -113,10 +114,11 @@
gfx::NativeWindow parent) {
auto* network_state_handler = NetworkHandler::Get()->network_state_handler();
const NetworkState* network;
- if (!network_id.empty())
+ if (!network_id.empty()) {
network = network_state_handler->GetNetworkStateFromGuid(network_id);
- else
+ } else {
network = network_state_handler->DefaultNetwork();
+ }
if (!network) {
LOG(ERROR) << "Network not found: " << network_id;
return;
diff --git a/chrome/browser/ui/webui/ash/kerberos/kerberos_in_browser_browsertest.cc b/chrome/browser/ui/webui/ash/kerberos/kerberos_in_browser_browsertest.cc
index ccb54962..ac401d83 100644
--- a/chrome/browser/ui/webui/ash/kerberos/kerberos_in_browser_browsertest.cc
+++ b/chrome/browser/ui/webui/ash/kerberos/kerberos_in_browser_browsertest.cc
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/ui/webui/ash/kerberos/kerberos_in_browser_dialog.h"
-
#include <string>
#include "base/memory/raw_ptr.h"
@@ -14,6 +12,7 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/ui/ash/system_web_apps/system_web_app_ui_utils.h"
#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/webui/ash/kerberos/kerberos_in_browser_dialog.h"
#include "chrome/test/base/chrome_test_utils.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
diff --git a/chrome/browser/ui/webui/ash/launcher_internals/launcher_internals_ui.cc b/chrome/browser/ui/webui/ash/launcher_internals/launcher_internals_ui.cc
index e7594cb..5c076f73 100644
--- a/chrome/browser/ui/webui/ash/launcher_internals/launcher_internals_ui.cc
+++ b/chrome/browser/ui/webui/ash/launcher_internals/launcher_internals_ui.cc
@@ -37,8 +37,9 @@
mojo::PendingRemote<launcher_internals::mojom::Page> page) {
auto* search_controller =
AppListClientImpl::GetInstance()->search_controller();
- if (!search_controller)
+ if (!search_controller) {
return;
+ }
page_handler_ = std::make_unique<LauncherInternalsHandler>(search_controller,
std::move(page));
diff --git a/chrome/browser/ui/webui/ash/lock_screen_reauth/lock_screen_captive_portal_dialog.cc b/chrome/browser/ui/webui/ash/lock_screen_reauth/lock_screen_captive_portal_dialog.cc
index aed2aaf..d9fcfd7 100644
--- a/chrome/browser/ui/webui/ash/lock_screen_reauth/lock_screen_captive_portal_dialog.cc
+++ b/chrome/browser/ui/webui/ash/lock_screen_reauth/lock_screen_captive_portal_dialog.cc
@@ -73,8 +73,9 @@
bool LockScreenCaptivePortalDialog::IsDialogClosedForTesting(
base::OnceClosure callback) {
- if (!is_running_)
+ if (!is_running_) {
return true;
+ }
DCHECK(!on_closed_callback_for_testing_);
on_closed_callback_for_testing_ = std::move(callback);
return false;
@@ -82,8 +83,9 @@
bool LockScreenCaptivePortalDialog::IsDialogShownForTesting(
base::OnceClosure callback) {
- if (is_running_)
+ if (is_running_) {
return true;
+ }
DCHECK(!on_shown_callback_for_testing_);
on_shown_callback_for_testing_ = std::move(callback);
return false;
diff --git a/chrome/browser/ui/webui/ash/lock_screen_reauth/lock_screen_network_handler.cc b/chrome/browser/ui/webui/ash/lock_screen_reauth/lock_screen_network_handler.cc
index 2229e10..79d503a4 100644
--- a/chrome/browser/ui/webui/ash/lock_screen_reauth/lock_screen_network_handler.cc
+++ b/chrome/browser/ui/webui/ash/lock_screen_reauth/lock_screen_network_handler.cc
@@ -76,8 +76,9 @@
// been loaded.
LockScreenStartReauthDialog* start_reauth_dialog =
LockScreenStartReauthDialog::GetInstance();
- if (!start_reauth_dialog)
+ if (!start_reauth_dialog) {
return;
+ }
start_reauth_dialog->OnNetworkDialogReadyForTesting();
}
diff --git a/chrome/browser/ui/webui/ash/lock_screen_reauth/lock_screen_reauth_dialogs.cc b/chrome/browser/ui/webui/ash/lock_screen_reauth/lock_screen_reauth_dialogs.cc
index 49f1495..a5927c0 100644
--- a/chrome/browser/ui/webui/ash/lock_screen_reauth/lock_screen_reauth_dialogs.cc
+++ b/chrome/browser/ui/webui/ash/lock_screen_reauth/lock_screen_reauth_dialogs.cc
@@ -49,16 +49,18 @@
bool IsDialogLoaded(bool is_loaded,
base::OnceClosure& on_loaded_callback,
base::OnceClosure callback) {
- if (is_loaded)
+ if (is_loaded) {
return true;
+ }
DCHECK(!on_loaded_callback);
on_loaded_callback = std::move(callback);
return false;
}
void OnDialogLoaded(bool& is_loaded, base::OnceClosure& on_loaded_callback) {
- if (is_loaded)
+ if (is_loaded) {
return;
+ }
is_loaded = true;
if (on_loaded_callback) {
std::move(on_loaded_callback).Run();
@@ -84,8 +86,9 @@
void WebContentsDestroyed() override { ResetDelegate(); }
void ResetDelegate() {
- if (!web_contents())
+ if (!web_contents()) {
return;
+ }
web_modal::WebContentsModalDialogManager::FromWebContents(web_contents())
->SetDelegate(nullptr);
}
@@ -160,8 +163,9 @@
// static
void LockScreenStartReauthDialog::Dismiss() {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- if (g_dialog)
+ if (g_dialog) {
g_dialog->Close();
+ }
}
// static
@@ -177,14 +181,16 @@
content::WebContents* LockScreenStartReauthDialog::GetWebContents() {
auto* web_ui = webui();
- if (!web_ui)
+ if (!web_ui) {
return nullptr;
+ }
return web_ui->GetWebContents();
}
void LockScreenStartReauthDialog::DeleteLockScreenNetworkDialog() {
- if (!lock_screen_network_dialog_)
+ if (!lock_screen_network_dialog_) {
return;
+ }
lock_screen_network_dialog_.reset();
if (is_network_dialog_visible_) {
is_network_dialog_visible_ = false;
@@ -224,14 +230,16 @@
}
void LockScreenStartReauthDialog::DismissLockScreenCaptivePortalDialog() {
- if (captive_portal_dialog_)
+ if (captive_portal_dialog_) {
captive_portal_dialog_->Dismiss();
+ }
}
void LockScreenStartReauthDialog::ShowLockScreenNetworkDialog() {
TerminateAutoReload();
- if (lock_screen_network_dialog_)
+ if (lock_screen_network_dialog_) {
return;
+ }
DCHECK(profile_);
is_network_dialog_visible_ = true;
lock_screen_network_dialog_ =
@@ -320,8 +328,9 @@
void LockScreenStartReauthDialog::UpdateState(
NetworkError::ErrorReason reason) {
- if (is_proxy_auth_in_progress_)
+ if (is_proxy_auth_in_progress_) {
return;
+ }
const NetworkStateInformer::State state = network_state_informer_->state();
@@ -362,8 +371,9 @@
bool LockScreenStartReauthDialog::IsLoadedForTesting(
base::OnceClosure callback) {
- if (is_dialog_loaded_for_testing_)
+ if (is_dialog_loaded_for_testing_) {
return true;
+ }
DCHECK(!on_dialog_loaded_callback_for_testing_);
on_dialog_loaded_callback_for_testing_ = std::move(callback);
return false;
@@ -371,16 +381,18 @@
bool LockScreenStartReauthDialog::IsClosedForTesting(
base::OnceClosure callback) {
- if (!is_dialog_loaded_for_testing_)
+ if (!is_dialog_loaded_for_testing_) {
return true;
+ }
DCHECK(!on_dialog_closed_callback_for_testing_);
on_dialog_closed_callback_for_testing_ = std::move(callback);
return false;
}
void LockScreenStartReauthDialog::OnReadyForTesting() {
- if (is_dialog_loaded_for_testing_)
+ if (is_dialog_loaded_for_testing_) {
return;
+ }
is_dialog_loaded_for_testing_ = true;
if (on_dialog_loaded_callback_for_testing_) {
std::move(on_dialog_loaded_callback_for_testing_).Run();
diff --git a/chrome/browser/ui/webui/ash/login/add_child_screen_handler.cc b/chrome/browser/ui/webui/ash/login/add_child_screen_handler.cc
index dc33223..745eb60 100644
--- a/chrome/browser/ui/webui/ash/login/add_child_screen_handler.cc
+++ b/chrome/browser/ui/webui/ash/login/add_child_screen_handler.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "chrome/browser/ui/webui/ash/login/add_child_screen_handler.h"
+
#include "base/logging.h"
#include "chrome/browser/ash/login/oobe_screen.h"
#include "chrome/browser/ash/login/wizard_controller.h"
diff --git a/chrome/browser/ui/webui/ash/login/ai_intro_screen_handler.h b/chrome/browser/ui/webui/ash/login/ai_intro_screen_handler.h
index 84e1d4d..f266183 100644
--- a/chrome/browser/ui/webui/ash/login/ai_intro_screen_handler.h
+++ b/chrome/browser/ui/webui/ash/login/ai_intro_screen_handler.h
@@ -31,7 +31,7 @@
};
class AiIntroScreenHandler final : public BaseScreenHandler,
- public AiIntroScreenView {
+ public AiIntroScreenView {
public:
using TView = AiIntroScreenView;
diff --git a/chrome/browser/ui/webui/ash/login/assistant_optin_flow_screen_handler.cc b/chrome/browser/ui/webui/ash/login/assistant_optin_flow_screen_handler.cc
index b4a023bd..168c43a 100644
--- a/chrome/browser/ui/webui/ash/login/assistant_optin_flow_screen_handler.cc
+++ b/chrome/browser/ui/webui/ash/login/assistant_optin_flow_screen_handler.cc
@@ -56,8 +56,9 @@
std::u16string GetGivenNameIfIsChild() {
const user_manager::User* user =
user_manager::UserManager::Get()->GetActiveUser();
- if (!user || !user->IsChild())
+ if (!user || !user->IsChild()) {
return std::u16string();
+ }
return user->GetGivenName();
}
@@ -67,10 +68,12 @@
: BaseScreenHandler(kScreenId), is_oobe_(is_oobe) {}
AssistantOptInFlowScreenHandler::~AssistantOptInFlowScreenHandler() {
- if (assistant::AssistantSettings::Get() && voice_match_enrollment_started_)
+ if (assistant::AssistantSettings::Get() && voice_match_enrollment_started_) {
StopSpeakerIdEnrollment();
- if (AssistantState::Get())
+ }
+ if (AssistantState::Get()) {
AssistantState::Get()->RemoveObserver(this);
+ }
}
void AssistantOptInFlowScreenHandler::DeclareLocalizedValues(
@@ -311,8 +314,9 @@
void AssistantOptInFlowScreenHandler::OnAssistantSettingsEnabled(bool enabled) {
// Close the opt-in screen is the Assistant is disabled.
- if (!enabled)
+ if (!enabled) {
HandleFlowFinished();
+ }
}
void AssistantOptInFlowScreenHandler::OnAssistantStatusChanged(
@@ -324,8 +328,9 @@
}
void AssistantOptInFlowScreenHandler::SendGetSettingsRequest() {
- if (!initialized_)
+ if (!initialized_) {
return;
+ }
if (AssistantState::Get()->assistant_status() ==
assistant::AssistantStatus::NOT_READY) {
@@ -497,8 +502,9 @@
ReloadContent(std::move(dictionary));
// Skip activity control and users will be in opted out mode.
- if (skip_activity_control)
+ if (skip_activity_control) {
ShowNextScreen();
+ }
}
void AssistantOptInFlowScreenHandler::OnUpdateSettingsResponse(
@@ -588,8 +594,9 @@
!voice_match_enrollment_error_) {
prefs->SetBoolean(assistant::prefs::kAssistantHotwordEnabled, false);
}
- if (voice_match_enrollment_started_)
+ if (voice_match_enrollment_started_) {
StopSpeakerIdEnrollment();
+ }
ShowNextScreen();
} else if (action == kRecordPressed) {
if (!prefs->GetBoolean(assistant::prefs::kAssistantHotwordEnabled)) {
@@ -602,8 +609,9 @@
assistant::AssistantSettings::Get()->StartSpeakerIdEnrollment(
flow_type_ == FlowType::kSpeakerIdRetrain, weak_factory_.GetWeakPtr());
} else if (action == kReloadRequested) {
- if (voice_match_enrollment_started_)
+ if (voice_match_enrollment_started_) {
StopSpeakerIdEnrollment();
+ }
}
}
@@ -648,8 +656,9 @@
// Allow JavaScript. This is necessary for the in-session WebUI and is is not
// triggered in the OOBE flow, where `screen` objects are associated with
// handlers. TODO(crbug.com/1309022) - Separate in-session and OOBE handlers.
- if (!is_oobe_)
+ if (!is_oobe_) {
AllowJavascript();
+ }
auto* prefs = ProfileManager::GetActiveUserProfile()->GetPrefs();
// Do not skip the flow if the OOBE debug overlay is present. Otherwise it is
@@ -668,18 +677,21 @@
DCHECK(IsKnownEnumValue(static_cast<FlowType>(flow_type)));
flow_type_ = static_cast<FlowType>(flow_type);
- if (flow_type_ == FlowType::kConsentFlow)
+ if (flow_type_ == FlowType::kConsentFlow) {
SendGetSettingsRequest();
+ }
}
bool AssistantOptInFlowScreenHandler::DeviceHasBattery() {
// Assume that the device has a battery if we can't determine otherwise.
- if (!chromeos::PowerManagerClient::Get())
+ if (!chromeos::PowerManagerClient::Get()) {
return true;
+ }
auto status = chromeos::PowerManagerClient::Get()->GetLastStatus();
- if (!status.has_value() || !status->has_battery_state())
+ if (!status.has_value() || !status->has_battery_state()) {
return true;
+ }
return status->battery_state() !=
power_manager::PowerSupplyProperties_BatteryState_NOT_PRESENT;
diff --git a/chrome/browser/ui/webui/ash/login/base_webui_handler.cc b/chrome/browser/ui/webui/ash/login/base_webui_handler.cc
index 71dc6bfc1..bc4d14b9 100644
--- a/chrome/browser/ui/webui/ash/login/base_webui_handler.cc
+++ b/chrome/browser/ui/webui/ash/login/base_webui_handler.cc
@@ -22,8 +22,9 @@
void BaseWebUIHandler::OnJavascriptAllowed() {
auto deferred_calls = std::exchange(deferred_calls_, {});
- for (auto& call : deferred_calls)
+ for (auto& call : deferred_calls) {
std::move(call).Run();
+ }
InitAfterJavascriptAllowed();
}
@@ -43,8 +44,9 @@
void BaseWebUIHandler::InitAfterJavascriptAllowed() {}
void BaseWebUIHandler::ShowScreenDeprecated(OobeScreenId screen) {
- if (!GetOobeUI())
+ if (!GetOobeUI()) {
return;
+ }
GetOobeUI()->GetCoreOobe()->ShowScreenWithData(screen, std::nullopt);
}
@@ -54,8 +56,9 @@
OobeScreenId BaseWebUIHandler::GetCurrentScreen() {
OobeUI* oobe_ui = GetOobeUI();
- if (!oobe_ui)
+ if (!oobe_ui) {
return OOBE_SCREEN_UNKNOWN;
+ }
return oobe_ui->current_screen();
}
diff --git a/chrome/browser/ui/webui/ash/login/check_passwords_against_cryptohome_helper.h b/chrome/browser/ui/webui/ash/login/check_passwords_against_cryptohome_helper.h
index 800d1ff..367a74f 100644
--- a/chrome/browser/ui/webui/ash/login/check_passwords_against_cryptohome_helper.h
+++ b/chrome/browser/ui/webui/ash/login/check_passwords_against_cryptohome_helper.h
@@ -28,8 +28,8 @@
OnCheckPasswordsAgainstCryptohomeHelperSuccessCallback
on_check_passwords_against_cryptohome_helper_success_callback);
- CheckPasswordsAgainstCryptohomeHelper(const CheckPasswordsAgainstCryptohomeHelper&) =
- delete;
+ CheckPasswordsAgainstCryptohomeHelper(
+ const CheckPasswordsAgainstCryptohomeHelper&) = delete;
CheckPasswordsAgainstCryptohomeHelper& operator=(
const CheckPasswordsAgainstCryptohomeHelper&) = delete;
diff --git a/chrome/browser/ui/webui/ash/login/choobe_screen_handler.cc b/chrome/browser/ui/webui/ash/login/choobe_screen_handler.cc
index 5779924..fa621d0 100644
--- a/chrome/browser/ui/webui/ash/login/choobe_screen_handler.cc
+++ b/chrome/browser/ui/webui/ash/login/choobe_screen_handler.cc
@@ -5,7 +5,6 @@
#include "chrome/browser/ui/webui/ash/login/choobe_screen_handler.h"
#include "base/logging.h"
-
#include "chrome/browser/ash/login/choobe_flow_controller.h"
#include "chrome/browser/ash/login/oobe_screen.h"
#include "chrome/browser/ash/login/wizard_controller.h"
diff --git a/chrome/browser/ui/webui/ash/login/core_oobe_handler.cc b/chrome/browser/ui/webui/ash/login/core_oobe_handler.cc
index eae3df5..914000b 100644
--- a/chrome/browser/ui/webui/ash/login/core_oobe_handler.cc
+++ b/chrome/browser/ui/webui/ash/login/core_oobe_handler.cc
@@ -42,7 +42,6 @@
builder->Add("productName", IDS_SHORT_PRODUCT_NAME);
builder->Add("learnMore", IDS_LEARN_MORE);
-
// Strings for Asset Identifier shown in version string.
builder->Add("assetIdLabel", IDS_OOBE_ASSET_ID_LABEL);
diff --git a/chrome/browser/ui/webui/ash/login/debug/debug_overlay_handler.cc b/chrome/browser/ui/webui/ash/login/debug/debug_overlay_handler.cc
index f2505a1..1c915596 100644
--- a/chrome/browser/ui/webui/ash/login/debug/debug_overlay_handler.cc
+++ b/chrome/browser/ui/webui/ash/login/debug/debug_overlay_handler.cc
@@ -112,8 +112,9 @@
void DebugOverlayHandler::HandleCaptureScreenshot(const std::string& name) {
aura::Window::Windows root_windows = Shell::GetAllRootWindows();
- if (root_windows.size() == 0)
+ if (root_windows.size() == 0) {
return;
+ }
screenshot_index_++;
std::string filename_base =
@@ -127,8 +128,9 @@
filename.append(base::StringPrintf("- Display %zu", screen));
}
- if (add_resolution_to_filename_)
+ if (add_resolution_to_filename_) {
filename.append("_" + rect.size().ToString());
+ }
if (DarkLightModeController::Get()->IsDarkModeEnabled()) {
filename.append("_dark");
diff --git a/chrome/browser/ui/webui/ash/login/display_size_screen_handler.cc b/chrome/browser/ui/webui/ash/login/display_size_screen_handler.cc
index aad5be5..389d12a 100644
--- a/chrome/browser/ui/webui/ash/login/display_size_screen_handler.cc
+++ b/chrome/browser/ui/webui/ash/login/display_size_screen_handler.cc
@@ -5,7 +5,6 @@
#include "chrome/browser/ui/webui/ash/login/display_size_screen_handler.h"
#include "base/logging.h"
-
#include "chrome/browser/ash/login/oobe_screen.h"
#include "chrome/browser/ash/login/wizard_controller.h"
#include "chrome/browser/ui/webui/ash/login/base_screen_handler.h"
diff --git a/chrome/browser/ui/webui/ash/login/drive_pinning_screen_handler.cc b/chrome/browser/ui/webui/ash/login/drive_pinning_screen_handler.cc
index a02657c..a2577af8 100644
--- a/chrome/browser/ui/webui/ash/login/drive_pinning_screen_handler.cc
+++ b/chrome/browser/ui/webui/ash/login/drive_pinning_screen_handler.cc
@@ -5,7 +5,6 @@
#include "chrome/browser/ui/webui/ash/login/drive_pinning_screen_handler.h"
#include "base/logging.h"
-
#include "chrome/browser/ash/login/oobe_screen.h"
#include "chrome/browser/ash/login/wizard_controller.h"
#include "chrome/browser/ui/webui/ash/login/base_screen_handler.h"
diff --git a/chrome/browser/ui/webui/ash/login/enable_debugging_screen_handler.cc b/chrome/browser/ui/webui/ash/login/enable_debugging_screen_handler.cc
index 2d6ef509..1ff1ed99 100644
--- a/chrome/browser/ui/webui/ash/login/enable_debugging_screen_handler.cc
+++ b/chrome/browser/ui/webui/ash/login/enable_debugging_screen_handler.cc
@@ -36,8 +36,7 @@
void EnableDebuggingScreenHandler::DeclareLocalizedValues(
::login::LocalizedValuesBuilder* builder) {
- builder->Add("enableDebuggingScreenTitle",
- IDS_ENABLE_DEBUGGING_SCREEN_TITLE);
+ builder->Add("enableDebuggingScreenTitle", IDS_ENABLE_DEBUGGING_SCREEN_TITLE);
builder->Add("enableDebuggingScreenAccessibleTitle",
IDS_ENABLE_DEBUGGING_SCREEN_TITLE);
builder->Add("enableDebuggingCancelButton", IDS_CANCEL);
@@ -48,21 +47,17 @@
IDS_ENABLE_DEBUGGING_ENABLE_BUTTON);
builder->Add("enableDebuggingRemveRootfsMessage",
IDS_ENABLE_DEBUGGING_SCREEN_ROOTFS_REMOVE_MSG);
- builder->Add("enableDebuggingLearnMore",
- IDS_ENABLE_DEBUGGING_LEARN_MORE);
+ builder->Add("enableDebuggingLearnMore", IDS_ENABLE_DEBUGGING_LEARN_MORE);
builder->Add("enableDebuggingSetupMessage",
IDS_ENABLE_DEBUGGING_SETUP_MESSAGE);
builder->AddF("enableDebuggingWarningTitle",
IDS_ENABLE_DEBUGGING_SCREEN_WARNING_MSG,
IDS_SHORT_PRODUCT_NAME);
- builder->AddF("enableDebuggingDoneMessage",
- IDS_ENABLE_DEBUGGING_DONE_MESSAGE,
+ builder->AddF("enableDebuggingDoneMessage", IDS_ENABLE_DEBUGGING_DONE_MESSAGE,
IDS_SHORT_PRODUCT_NAME);
- builder->Add("enableDebuggingErrorTitle",
- IDS_ENABLE_DEBUGGING_ERROR_TITLE);
+ builder->Add("enableDebuggingErrorTitle", IDS_ENABLE_DEBUGGING_ERROR_TITLE);
builder->AddF("enableDebuggingErrorMessage",
- IDS_ENABLE_DEBUGGING_ERROR_MESSAGE,
- IDS_SHORT_PRODUCT_NAME);
+ IDS_ENABLE_DEBUGGING_ERROR_MESSAGE, IDS_SHORT_PRODUCT_NAME);
builder->Add("enableDebuggingPasswordLabel",
IDS_ENABLE_DEBUGGING_ROOT_PASSWORD_LABEL);
builder->Add("enableDebuggingConfirmPasswordLabel",
diff --git a/chrome/browser/ui/webui/ash/login/enrollment_screen_handler.cc b/chrome/browser/ui/webui/ash/login/enrollment_screen_handler.cc
index 570bd11..7a24355 100644
--- a/chrome/browser/ui/webui/ash/login/enrollment_screen_handler.cc
+++ b/chrome/browser/ui/webui/ash/login/enrollment_screen_handler.cc
@@ -172,10 +172,11 @@
}
void EnrollmentScreenHandler::Show() {
- if (!IsJavascriptAllowed())
+ if (!IsJavascriptAllowed()) {
show_on_init_ = true;
- else
+ } else {
DoShow();
+ }
}
void EnrollmentScreenHandler::Hide() {
@@ -712,9 +713,10 @@
}
void EnrollmentScreenHandler::HandleOnLearnMore() {
- if (!help_app_.get())
+ if (!help_app_.get()) {
help_app_ = new HelpAppLauncher(
LoginDisplayHost::default_host()->GetNativeWindow());
+ }
help_app_->ShowHelpTopic(HelpAppLauncher::HELP_DEVICE_ATTRIBUTES);
}
@@ -783,8 +785,9 @@
const std::string& partition_name) {
// If enrollment ends and the browser is being restarted, the renderers are
// killed so we can not talk to them anymore.
- if (shutdown_)
+ if (shutdown_) {
return;
+ }
signin_partition_name_ = partition_name;
@@ -819,8 +822,9 @@
screen_data.Set("gaia_buttons_type",
GetGaiaButtonsTypeString(gaia_buttons_type_));
const std::string& app_locale = g_browser_process->GetApplicationLocale();
- if (!app_locale.empty())
+ if (!app_locale.empty()) {
screen_data.Set("hl", app_locale);
+ }
const std::string& email = config_.enrollment_nudge_email;
if (!email.empty()) {
screen_data.Set("email", email);
diff --git a/chrome/browser/ui/webui/ash/login/error_screen_handler.cc b/chrome/browser/ui/webui/ash/login/error_screen_handler.cc
index f03e3471..c279b45 100644
--- a/chrome/browser/ui/webui/ash/login/error_screen_handler.cc
+++ b/chrome/browser/ui/webui/ash/login/error_screen_handler.cc
@@ -85,7 +85,8 @@
builder->Add("proxySettingsMenuName",
IDS_NETWORK_PROXY_SETTINGS_LIST_ITEM_NAME);
builder->Add("addWiFiNetworkMenuName", IDS_NETWORK_ADD_WI_FI_LIST_ITEM_NAME);
- builder->Add("autoEnrollmentErrorMessageTitle", IDS_LOGIN_AUTO_ENROLLMENT_OFFLINE_TITLE);
+ builder->Add("autoEnrollmentErrorMessageTitle",
+ IDS_LOGIN_AUTO_ENROLLMENT_OFFLINE_TITLE);
ui::network_element::AddLocalizedValuesToBuilder(builder);
builder->Add("offlineLogin", IDS_OFFLINE_LOGIN_HTML);
diff --git a/chrome/browser/ui/webui/ash/login/gaia_info_screen_handler.cc b/chrome/browser/ui/webui/ash/login/gaia_info_screen_handler.cc
index 19f1ac0..f50b765 100644
--- a/chrome/browser/ui/webui/ash/login/gaia_info_screen_handler.cc
+++ b/chrome/browser/ui/webui/ash/login/gaia_info_screen_handler.cc
@@ -5,7 +5,6 @@
#include "chrome/browser/ui/webui/ash/login/gaia_info_screen_handler.h"
#include "base/logging.h"
-
#include "chrome/browser/ash/login/oobe_screen.h"
#include "chrome/browser/ash/login/wizard_controller.h"
#include "chrome/browser/ui/webui/ash/login/base_screen_handler.h"
diff --git a/chrome/browser/ui/webui/ash/login/gaia_screen_handler.cc b/chrome/browser/ui/webui/ash/login/gaia_screen_handler.cc
index b92ca5b..f5f5f11 100644
--- a/chrome/browser/ui/webui/ash/login/gaia_screen_handler.cc
+++ b/chrome/browser/ui/webui/ash/login/gaia_screen_handler.cc
@@ -226,8 +226,9 @@
cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user);
// nosignup flow if new users are not allowed.
- if (!allow_new_user)
+ if (!allow_new_user) {
params.Set("flow", "nosignup");
+ }
}
// TODO(crbug.com/40239091)
@@ -335,8 +336,9 @@
}
GaiaScreenHandler::~GaiaScreenHandler() {
- if (is_security_token_pin_enabled_)
+ if (is_security_token_pin_enabled_) {
GetLoginScreenPinDialogManager()->RemovePinDialogHost(this);
+ }
HttpAuthDialog::RemoveObserver(this);
}
@@ -422,8 +424,9 @@
params.Set("screenMode", screen_mode_);
const std::string app_locale = g_browser_process->GetApplicationLocale();
- if (!app_locale.empty())
+ if (!app_locale.empty()) {
params.Set("hl", app_locale);
+ }
const std::string enterprise_enrollment_domain(
GetEnterpriseEnrollmentDomain());
@@ -461,8 +464,9 @@
params.Set("chromeType", GetChromeType());
params.Set("clientId", gaia_urls.oauth2_chrome_client_id());
params.Set("clientVersion", version_info::GetVersionNumber());
- if (!platform_version->empty())
+ if (!platform_version->empty()) {
params.Set("platformVersion", *platform_version);
+ }
// Extended stable channel is not supported on Chrome OS Ash.
params.Set("releaseChannel",
chrome::GetChannelName(chrome::WithExtendedStable(false)));
@@ -512,8 +516,9 @@
// We only send `chromeos_board` Gaia URL parameter if user has opted into
// sending device statistics.
- if (*collect_stats_consent)
+ if (*collect_stats_consent) {
params.Set("lsbReleaseBoard", base::SysInfo::GetLsbReleaseBoard());
+ }
params.Set("webviewPartitionName", partition_name);
signin_partition_name_ = partition_name;
@@ -1018,11 +1023,13 @@
frame_state_ = FRAME_STATE_LOADED;
const NetworkStateInformer::State state = network_state_informer_->state();
- if (state == NetworkStateInformer::ONLINE)
+ if (state == NetworkStateInformer::ONLINE) {
UpdateState(NetworkError::ERROR_REASON_UPDATE);
+ }
- if (test_expects_complete_login_)
+ if (test_expects_complete_login_) {
SubmitLoginFormForTest();
+ }
if (LoginDisplayHost::default_host()) {
LoginDisplayHost::default_host()->OnGaiaScreenReady();
@@ -1081,8 +1088,9 @@
void GaiaScreenHandler::HandleOnFatalError(int error_code,
const base::Value::Dict& params) {
- if (!LoginDisplayHost::default_host())
+ if (!LoginDisplayHost::default_host()) {
return;
+ }
LoginDisplayHost::default_host()
->GetWizardController()
->ShowSignInFatalErrorScreen(
@@ -1236,8 +1244,9 @@
enable_ash_httpauth_ = HttpAuthDialog::Enable();
base::Value::Dict data;
- if (LoginDisplayHost::default_host())
+ if (LoginDisplayHost::default_host()) {
data.Set("hasUserPods", LoginDisplayHost::default_host()->HasUserPods());
+ }
ShowInWebUI(std::move(data));
elapsed_timer_ = std::make_unique<base::ElapsedTimer>();
hidden_ = false;
diff --git a/chrome/browser/ui/webui/ash/login/gemini_intro_screen_handler.cc b/chrome/browser/ui/webui/ash/login/gemini_intro_screen_handler.cc
index 78e8b345..17cd789 100644
--- a/chrome/browser/ui/webui/ash/login/gemini_intro_screen_handler.cc
+++ b/chrome/browser/ui/webui/ash/login/gemini_intro_screen_handler.cc
@@ -17,8 +17,8 @@
namespace ash {
-GeminiIntroScreenHandler::GeminiIntroScreenHandler() :
- BaseScreenHandler(kScreenId) {}
+GeminiIntroScreenHandler::GeminiIntroScreenHandler()
+ : BaseScreenHandler(kScreenId) {}
GeminiIntroScreenHandler::~GeminiIntroScreenHandler() = default;
@@ -27,7 +27,7 @@
::login::LocalizedValuesBuilder* builder) {
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
if (base::FeatureList::IsEnabled(
- features::kFeatureManagementOobeGeminiIntro)) {
+ features::kFeatureManagementOobeGeminiIntro)) {
auto product_name =
ui::ResourceBundle::GetSharedInstance().LoadDataResourceString(
IDR_CROS_OOBE_PRODUCT_NAME);
diff --git a/chrome/browser/ui/webui/ash/login/hid_detection_screen_handler.cc b/chrome/browser/ui/webui/ash/login/hid_detection_screen_handler.cc
index e3bafc5b..07d7eae 100644
--- a/chrome/browser/ui/webui/ash/login/hid_detection_screen_handler.cc
+++ b/chrome/browser/ui/webui/ash/login/hid_detection_screen_handler.cc
@@ -83,22 +83,22 @@
builder->Add("hidDetectionContinue", IDS_HID_DETECTION_CONTINUE_BUTTON);
builder->Add("hidDetectionInvitation", IDS_HID_DETECTION_INVITATION_TEXT);
builder->Add("hidDetectionPrerequisites",
- IDS_HID_DETECTION_PRECONDITION_TEXT);
+ IDS_HID_DETECTION_PRECONDITION_TEXT);
builder->Add("hidDetectionPrerequisitesTouchscreen",
IDS_HID_DETECTION_PRECONDITION_TOUCHSCREEN_TEXT);
builder->Add("hidDetectionMouseSearching", IDS_HID_DETECTION_SEARCHING_MOUSE);
builder->Add("hidDetectionKeyboardSearching",
- IDS_HID_DETECTION_SEARCHING_KEYBOARD);
+ IDS_HID_DETECTION_SEARCHING_KEYBOARD);
builder->Add("hidDetectionUSBMouseConnected",
- IDS_HID_DETECTION_CONNECTED_USB_MOUSE);
+ IDS_HID_DETECTION_CONNECTED_USB_MOUSE);
builder->Add("hidDetectionPointingDeviceConnected",
- IDS_HID_DETECTION_CONNECTED_POINTING_DEVICE);
+ IDS_HID_DETECTION_CONNECTED_POINTING_DEVICE);
builder->Add("hidDetectionKeyboardPairing",
IDS_HID_DETECTION_PAIRING_BLUETOOTH_KEYBOARD);
builder->Add("hidDetectionUSBKeyboardConnected",
- IDS_HID_DETECTION_CONNECTED_USB_KEYBOARD);
+ IDS_HID_DETECTION_CONNECTED_USB_KEYBOARD);
builder->Add("hidDetectionBTMousePaired",
- IDS_HID_DETECTION_PAIRED_BLUETOOTH_MOUSE);
+ IDS_HID_DETECTION_PAIRED_BLUETOOTH_MOUSE);
builder->Add("hidDetectionBTEnterKey", IDS_HID_DETECTION_BLUETOOTH_ENTER_KEY);
builder->Add("hidDetectionPinDialogTitle",
IDS_HID_DETECTION_PAIRING_BLUETOOTH_KEYBOARD_PIN_DIALOG_TITLE);
diff --git a/chrome/browser/ui/webui/ash/login/l10n_util.cc b/chrome/browser/ui/webui/ash/login/l10n_util.cc
index e7615bd..cf7b8cb 100644
--- a/chrome/browser/ui/webui/ash/login/l10n_util.cc
+++ b/chrome/browser/ui/webui/ash/login/l10n_util.cc
@@ -112,14 +112,16 @@
std::set<std::string> language_codes;
// Collect the language codes from the supported input methods.
for (const auto& descriptor : descriptors) {
- for (const auto& language : descriptor.language_codes())
+ for (const auto& language : descriptor.language_codes()) {
language_codes.insert(language);
+ }
}
// Language sort order.
std::map<std::string, int /* index */> language_index;
- for (size_t i = 0; i < most_relevant_language_codes.size(); ++i)
+ for (size_t i = 0; i < most_relevant_language_codes.size(); ++i) {
language_index[most_relevant_language_codes[i]] = i;
+ }
// Map of display name -> {language code, native_display_name}.
// In theory, we should be able to create a map that is sorted by
@@ -151,16 +153,18 @@
const std::string lang = l10n_util::GetLanguage(language_id);
// Ignore non-specific codes.
- if (lang.empty() || lang == language_id)
+ if (lang.empty() || lang == language_id) {
continue;
+ }
if (base::Contains(base_language_codes, language_id)) {
// Language is supported. No need to replace
continue;
}
std::string resolved_locale;
- if (!l10n_util::CheckAndResolveLocale(language_id, &resolved_locale))
+ if (!l10n_util::CheckAndResolveLocale(language_id, &resolved_locale)) {
continue;
+ }
if (!base::Contains(base_language_codes, resolved_locale)) {
// Resolved locale is not supported.
@@ -183,8 +187,9 @@
for (const auto& language_code : language_codes) {
// Exclude the language which is not in `base_langauge_codes` even it has
// input methods.
- if (!base::Contains(base_language_codes, language_code))
+ if (!base::Contains(base_language_codes, language_code)) {
continue;
+ }
const std::u16string display_name =
l10n_util::GetDisplayNameForLocale(language_code, app_locale, true);
@@ -213,8 +218,9 @@
// Build the list of display names, and build the language map.
for (const auto& base_language_code : base_language_codes) {
// Skip this language if it was already added.
- if (language_codes.find(base_language_code) != language_codes.end())
+ if (language_codes.find(base_language_code) != language_codes.end()) {
continue;
+ }
std::u16string display_name = l10n_util::GetDisplayNameForLocale(
base_language_code, app_locale, false);
@@ -240,8 +246,9 @@
std::vector<std::u16string> out_display_names;
for (const auto& most_relevant_locales_display_name :
most_relevant_locales_display_names) {
- if (most_relevant_locales_display_name.size() == 0)
+ if (most_relevant_locales_display_name.size() == 0) {
continue;
+ }
out_display_names.push_back(most_relevant_locales_display_name);
}
@@ -315,8 +322,9 @@
it != layouts.end(); ++it) {
const input_method::InputMethodDescriptor* ime =
util->GetInputMethodDescriptorFromId(*it);
- if (!InsertString(ime->id(), &input_methods_added))
+ if (!InsertString(ime->id(), &input_methods_added)) {
continue;
+ }
input_methods_list.Append(CreateInputMethodsEntry(*ime, selected, util));
}
@@ -330,11 +338,13 @@
std::string CalculateSelectedLanguage(const std::string& requested_locale,
const std::string& loaded_locale) {
std::string resolved_locale;
- if (!l10n_util::CheckAndResolveLocale(requested_locale, &resolved_locale))
+ if (!l10n_util::CheckAndResolveLocale(requested_locale, &resolved_locale)) {
return loaded_locale;
+ }
- if (resolved_locale == loaded_locale)
+ if (resolved_locale == loaded_locale) {
return requested_locale;
+ }
return loaded_locale;
}
@@ -410,8 +420,9 @@
language_info.Set("value", value);
language_info.Set("title", display_name);
- if (value == selected)
+ if (value == selected) {
language_info.Set("selected", true);
+ }
}
}
@@ -472,15 +483,17 @@
for (const auto& most_relevant : most_relevant_language_codes) {
for (const auto& entry : available_locales) {
const std::string* available_locale = nullptr;
- if (entry.is_dict())
+ if (entry.is_dict()) {
available_locale = entry.GetDict().FindString("value");
+ }
if (!available_locale) {
NOTREACHED();
}
- if (*available_locale == most_relevant)
+ if (*available_locale == most_relevant) {
return most_relevant;
+ }
}
}
@@ -523,8 +536,9 @@
for (size_t i = 0; i < input_methods.size(); ++i) {
// Makes sure the id is in legacy xkb id format.
const std::string& ime_id = input_methods[i].id();
- if (!InsertString(ime_id, &input_methods_added))
+ if (!InsertString(ime_id, &input_methods_added)) {
continue;
+ }
if (!optgroup_added) {
optgroup_added = true;
AddOptgroupOtherLayouts(input_methods_list);
diff --git a/chrome/browser/ui/webui/ash/login/l10n_util_unittest.cc b/chrome/browser/ui/webui/ash/login/l10n_util_unittest.cc
index 287e077..3f8a0e9 100644
--- a/chrome/browser/ui/webui/ash/login/l10n_util_unittest.cc
+++ b/chrome/browser/ui/webui/ash/login/l10n_util_unittest.cc
@@ -110,23 +110,19 @@
std::vector<std::string> most_relevant_language_codes;
EXPECT_EQ("en-US", FindMostRelevantLocale(most_relevant_language_codes,
- available_locales,
- "en-US"));
+ available_locales, "en-US"));
most_relevant_language_codes.push_back("xx");
EXPECT_EQ("en-US", FindMostRelevantLocale(most_relevant_language_codes,
- available_locales,
- "en-US"));
+ available_locales, "en-US"));
most_relevant_language_codes.push_back("fr");
EXPECT_EQ("fr", FindMostRelevantLocale(most_relevant_language_codes,
- available_locales,
- "en-US"));
+ available_locales, "en-US"));
most_relevant_language_codes.push_back("de");
EXPECT_EQ("fr", FindMostRelevantLocale(most_relevant_language_codes,
- available_locales,
- "en-US"));
+ available_locales, "en-US"));
}
void InitStartupCustomizationDocumentForTesting(const std::string& manifest) {
diff --git a/chrome/browser/ui/webui/ash/login/network_state_informer.cc b/chrome/browser/ui/webui/ash/login/network_state_informer.cc
index 45b1c571..f7ac9917 100644
--- a/chrome/browser/ui/webui/ash/login/network_state_informer.cc
+++ b/chrome/browser/ui/webui/ash/login/network_state_informer.cc
@@ -68,8 +68,9 @@
}
void NetworkStateInformer::AddObserver(NetworkStateInformerObserver* observer) {
- if (!observers_.HasObserver(observer))
+ if (!observers_.HasObserver(observer)) {
observers_.AddObserver(observer);
+ }
}
void NetworkStateInformer::RemoveObserver(
@@ -119,8 +120,9 @@
const NetworkState* network =
NetworkHandler::Get()->network_state_handler()->GetNetworkState(
service_path);
- if (!network)
+ if (!network) {
return std::string();
+ }
return network->name();
}
@@ -135,19 +137,22 @@
bool NetworkStateInformer::UpdateState(const NetworkState* network) {
State new_state = GetStateForNetwork(network);
std::string new_network_path;
- if (network)
+ if (network) {
new_network_path = network->path();
+ }
- if (new_state == state_ && new_network_path == network_path_)
+ if (new_state == state_ && new_network_path == network_path_) {
return false;
+ }
state_ = new_state;
network_path_ = new_network_path;
proxy_config_.reset();
if (state_ == ONLINE) {
- for (NetworkStateInformerObserver& observer : observers_)
+ for (NetworkStateInformerObserver& observer : observers_) {
observer.OnNetworkReady();
+ }
}
return true;
@@ -185,18 +190,20 @@
void NetworkStateInformer::UpdateStateAndNotify(const NetworkState* network) {
bool state_changed = UpdateState(network);
bool proxy_config_changed = UpdateProxyConfig(network);
- if (state_changed)
+ if (state_changed) {
SendStateToObservers(NetworkError::ERROR_REASON_NETWORK_STATE_CHANGED);
- else if (proxy_config_changed)
+ } else if (proxy_config_changed) {
SendStateToObservers(NetworkError::ERROR_REASON_PROXY_CONFIG_CHANGED);
- else
+ } else {
SendStateToObservers(NetworkError::ERROR_REASON_UPDATE);
+ }
}
void NetworkStateInformer::SendStateToObservers(
NetworkError::ErrorReason reason) {
- for (NetworkStateInformerObserver& observer : observers_)
+ for (NetworkStateInformerObserver& observer : observers_) {
observer.UpdateState(reason);
+ }
}
} // namespace ash
diff --git a/chrome/browser/ui/webui/ash/login/online_login_utils.cc b/chrome/browser/ui/webui/ash/login/online_login_utils.cc
index 2a03ed43..d5fa118 100644
--- a/chrome/browser/ui/webui/ash/login/online_login_utils.cc
+++ b/chrome/browser/ui/webui/ash/login/online_login_utils.cc
@@ -98,8 +98,9 @@
OnSetCookieForLoadGaiaWithPartition callback) {
content::StoragePartition* partition =
signin_partition_manager->GetCurrentStoragePartition();
- if (!partition)
+ if (!partition) {
return;
+ }
// Note: The CanonicalCookie created here is not Secure. This is fine because
// it's being set into a different StoragePartition than the user's actual
@@ -117,8 +118,9 @@
std::nullopt /* server_time */, std::nullopt /* cookie_partition_key */,
net::CookieSourceType::kOther,
/*status=*/nullptr));
- if (!cc)
+ if (!cc) {
return;
+ }
const net::CookieOptions options = net::CookieOptions::MakeAllInclusive();
partition->GetCookieManagerForBrowserProcess()->SetCanonicalCookie(
@@ -260,8 +262,9 @@
content::StoragePartition* partition =
signin_partition_manager_->GetCurrentStoragePartition();
- if (!partition)
+ if (!partition) {
return;
+ }
// Validity check that partition did not change during login flow.
DCHECK_EQ(signin_partition_manager_->GetCurrentStoragePartitionName(),
@@ -309,12 +312,13 @@
login::GaiaCookiesData cookie_data;
for (const auto& cookie_with_access_result : cookies) {
const auto& cookie = cookie_with_access_result.cookie;
- if (cookie.Name() == login::kOAUTHCodeCookie)
+ if (cookie.Name() == login::kOAUTHCodeCookie) {
cookie_data.auth_code = cookie.Value();
- else if (cookie.Name() == login::kGAPSCookie)
+ } else if (cookie.Name() == login::kGAPSCookie) {
cookie_data.gaps_cookie = cookie.Value();
- else if (cookie.Name() == login::kRAPTCookie)
+ } else if (cookie.Name() == login::kRAPTCookie) {
cookie_data.rapt = cookie.Value();
+ }
}
if (cookie_data.auth_code.empty() && !allow_empty_auth_code_for_testing_) {
diff --git a/chrome/browser/ui/webui/ash/login/oobe_display_chooser.cc b/chrome/browser/ui/webui/ash/login/oobe_display_chooser.cc
index c4530e3..ce0a0ef 100644
--- a/chrome/browser/ui/webui/ash/login/oobe_display_chooser.cc
+++ b/chrome/browser/ui/webui/ash/login/oobe_display_chooser.cc
@@ -50,8 +50,9 @@
// Don't (potentially) queue a second task to run MoveToTouchDisplay if one
// already is queued.
- if (weak_ptr_factory_.HasWeakPtrs())
+ if (weak_ptr_factory_.HasWeakPtrs()) {
return;
+ }
display::Display primary_display =
display::Screen::GetScreen()->GetPrimaryDisplay();
diff --git a/chrome/browser/ui/webui/ash/login/oobe_ui.h b/chrome/browser/ui/webui/ash/login/oobe_ui.h
index a5e491f..9dfb9a01 100644
--- a/chrome/browser/ui/webui/ash/login/oobe_ui.h
+++ b/chrome/browser/ui/webui/ash/login/oobe_ui.h
@@ -150,8 +150,9 @@
THandler* GetHandler() {
OobeScreenId expected_screen = THandler::kScreenId;
for (BaseScreenHandler* handler : screen_handlers_) {
- if (expected_screen == handler->oobe_screen())
+ if (expected_screen == handler->oobe_screen()) {
return static_cast<THandler*>(handler);
+ }
}
NOTREACHED() << "Unable to find handler for screen " << expected_screen;
diff --git a/chrome/browser/ui/webui/ash/login/perks_discovery_screen_handler.cc b/chrome/browser/ui/webui/ash/login/perks_discovery_screen_handler.cc
index fafc7aec..093104ff 100644
--- a/chrome/browser/ui/webui/ash/login/perks_discovery_screen_handler.cc
+++ b/chrome/browser/ui/webui/ash/login/perks_discovery_screen_handler.cc
@@ -38,8 +38,10 @@
base::Value(perk.additional_text.value()));
}
if (perk.content.illustration.has_value()) {
- perk_dict.Set("illustrationUrl", base::Value(perk.content.illustration->url));
- perk_dict.Set("illustrationWidth", base::Value(perk.content.illustration->width));
+ perk_dict.Set("illustrationUrl",
+ base::Value(perk.content.illustration->url));
+ perk_dict.Set("illustrationWidth",
+ base::Value(perk.content.illustration->width));
perk_dict.Set("illustrationHeight",
base::Value(perk.content.illustration->height));
}
diff --git a/chrome/browser/ui/webui/ash/login/perks_discovery_screen_handler.h b/chrome/browser/ui/webui/ash/login/perks_discovery_screen_handler.h
index 331a4a3..274c7cda4 100644
--- a/chrome/browser/ui/webui/ash/login/perks_discovery_screen_handler.h
+++ b/chrome/browser/ui/webui/ash/login/perks_discovery_screen_handler.h
@@ -26,7 +26,8 @@
// Shows the contents of the screen.
virtual void Show() = 0;
- virtual void SetPerksData(const std::vector<SinglePerkDiscoveryPayload>& perks) = 0;
+ virtual void SetPerksData(
+ const std::vector<SinglePerkDiscoveryPayload>& perks) = 0;
virtual void SetOverviewStep() = 0;
// Gets a WeakPtr to the instance.
@@ -52,7 +53,8 @@
// PerksDiscoveryScreenView:
void Show() override;
- void SetPerksData(const std::vector<SinglePerkDiscoveryPayload>& perks) override;
+ void SetPerksData(
+ const std::vector<SinglePerkDiscoveryPayload>& perks) override;
void SetOverviewStep() override;
base::WeakPtr<PerksDiscoveryScreenView> AsWeakPtr() override;
diff --git a/chrome/browser/ui/webui/ash/login/personalized_recommend_apps_screen_handler.h b/chrome/browser/ui/webui/ash/login/personalized_recommend_apps_screen_handler.h
index 7eb5699..14251b1 100644
--- a/chrome/browser/ui/webui/ash/login/personalized_recommend_apps_screen_handler.h
+++ b/chrome/browser/ui/webui/ash/login/personalized_recommend_apps_screen_handler.h
@@ -11,8 +11,8 @@
namespace ash {
-// Interface for dependency injection between PersonalizedRecommendAppsScreen and
-// its WebUI representation.
+// Interface for dependency injection between PersonalizedRecommendAppsScreen
+// and its WebUI representation.
class PersonalizedRecommendAppsScreenView {
public:
inline constexpr static StaticOobeScreenId kScreenId{
diff --git a/chrome/browser/ui/webui/ash/login/reset_screen_handler.cc b/chrome/browser/ui/webui/ash/login/reset_screen_handler.cc
index 58e74711..7b723a2 100644
--- a/chrome/browser/ui/webui/ash/login/reset_screen_handler.cc
+++ b/chrome/browser/ui/webui/ash/login/reset_screen_handler.cc
@@ -41,8 +41,7 @@
builder->Add("resetWarningDataDetails",
IDS_RESET_SCREEN_WARNING_DETAILS_DATA);
builder->Add("resetRestartMessage", IDS_RESET_SCREEN_RESTART_MSG);
- builder->AddF("resetRevertPromise",
- IDS_RESET_SCREEN_PREPARING_REVERT_PROMISE,
+ builder->AddF("resetRevertPromise", IDS_RESET_SCREEN_PREPARING_REVERT_PROMISE,
IDS_SHORT_PRODUCT_NAME);
builder->AddF("resetRevertSpinnerMessage",
IDS_RESET_SCREEN_PREPARING_REVERT_SPINNER_MESSAGE,
diff --git a/chrome/browser/ui/webui/ash/login/signin_userlist_unittest.cc b/chrome/browser/ui/webui/ash/login/signin_userlist_unittest.cc
index f2f837071..3a0822b 100644
--- a/chrome/browser/ui/webui/ash/login/signin_userlist_unittest.cc
+++ b/chrome/browser/ui/webui/ash/login/signin_userlist_unittest.cc
@@ -55,16 +55,18 @@
TestingBrowserProcess::GetGlobal(), &local_state_);
ASSERT_TRUE(profile_manager_->SetUp());
- for (size_t i = 0; i < std::size(kUsersPublic); ++i)
+ for (size_t i = 0; i < std::size(kUsersPublic); ++i) {
fake_user_manager_->AddPublicAccountUser(
AccountId::FromUserEmail(kUsersPublic[i]));
+ }
for (size_t i = 0; i < kMaxUsers + 1; ++i) {
fake_user_manager_->AddUser(
AccountId::FromUserEmail(GenerateUserEmail(i)));
// Insert owner second to last.
- if (i == kMaxUsers - 1)
+ if (i == kMaxUsers - 1) {
fake_user_manager_->AddUser(AccountId::FromUserEmail(kOwner));
+ }
}
fake_user_manager_->SetOwnerId(AccountId::FromUserEmail(kOwner));
diff --git a/chrome/browser/ui/webui/ash/login/ssh_configured_handler.cc b/chrome/browser/ui/webui/ash/login/ssh_configured_handler.cc
index b659c87..1f329e3 100644
--- a/chrome/browser/ui/webui/ash/login/ssh_configured_handler.cc
+++ b/chrome/browser/ui/webui/ash/login/ssh_configured_handler.cc
@@ -47,10 +47,12 @@
}
void SshConfiguredHandler::InitAfterJavascriptAllowed() {
- if (callback_ids_.empty())
+ if (callback_ids_.empty()) {
return;
- if (!is_ssh_configured_.has_value())
+ }
+ if (!is_ssh_configured_.has_value()) {
return;
+ }
ResolveCallbacks();
}
@@ -83,8 +85,9 @@
}
void SshConfiguredHandler::ResolveCallbacks() {
- if (!IsJavascriptAllowed())
+ if (!IsJavascriptAllowed()) {
return;
+ }
DCHECK(is_ssh_configured_.has_value());
for (const std::string& callback_id : callback_ids_) {
ResolveJavascriptCallback(base::Value(callback_id),
diff --git a/chrome/browser/ui/webui/ash/login/testapi/oobe_test_api_handler.cc b/chrome/browser/ui/webui/ash/login/testapi/oobe_test_api_handler.cc
index 44de005..cbc40709 100644
--- a/chrome/browser/ui/webui/ash/login/testapi/oobe_test_api_handler.cc
+++ b/chrome/browser/ui/webui/ash/login/testapi/oobe_test_api_handler.cc
@@ -87,7 +87,7 @@
void OobeTestAPIHandler::GetAdditionalParameters(base::Value::Dict* dict) {
login::NetworkStateHelper helper_;
dict->Set("testapi_shouldSkipNetworkFirstShow",
- !switches::IsOOBENetworkScreenSkippingDisabledForTesting() &&
+ !switches::IsOOBENetworkScreenSkippingDisabledForTesting() &&
helper_.IsConnectedToEthernet());
dict->Set(
diff --git a/chrome/browser/ui/webui/ash/login/touchpad_scroll_screen_handler.cc b/chrome/browser/ui/webui/ash/login/touchpad_scroll_screen_handler.cc
index 55eae51..8e39b22e 100644
--- a/chrome/browser/ui/webui/ash/login/touchpad_scroll_screen_handler.cc
+++ b/chrome/browser/ui/webui/ash/login/touchpad_scroll_screen_handler.cc
@@ -5,7 +5,6 @@
#include "chrome/browser/ui/webui/ash/login/touchpad_scroll_screen_handler.h"
#include "base/logging.h"
-
#include "chrome/browser/ash/login/oobe_screen.h"
#include "chrome/browser/ash/login/wizard_controller.h"
#include "chrome/browser/ui/webui/ash/login/base_screen_handler.h"
diff --git a/chrome/browser/ui/webui/ash/login/wrong_hwid_screen_handler.cc b/chrome/browser/ui/webui/ash/login/wrong_hwid_screen_handler.cc
index d2559221..22a11e3 100644
--- a/chrome/browser/ui/webui/ash/login/wrong_hwid_screen_handler.cc
+++ b/chrome/browser/ui/webui/ash/login/wrong_hwid_screen_handler.cc
@@ -28,11 +28,10 @@
::login::LocalizedValuesBuilder* builder) {
builder->Add("wrongHWIDScreenHeader", IDS_WRONG_HWID_SCREEN_HEADER);
builder->Add("wrongHWIDMessageFirstPart",
- IDS_WRONG_HWID_SCREEN_MESSAGE_FIRST_PART);
+ IDS_WRONG_HWID_SCREEN_MESSAGE_FIRST_PART);
builder->Add("wrongHWIDMessageSecondPart",
- IDS_WRONG_HWID_SCREEN_MESSAGE_SECOND_PART);
- builder->Add("wrongHWIDScreenSkipLink",
- IDS_WRONG_HWID_SCREEN_SKIP_LINK);
+ IDS_WRONG_HWID_SCREEN_MESSAGE_SECOND_PART);
+ builder->Add("wrongHWIDScreenSkipLink", IDS_WRONG_HWID_SCREEN_SKIP_LINK);
}
} // namespace ash
diff --git a/chrome/browser/ui/webui/ash/multidevice_internals/multidevice_internals_phone_hub_handler.cc b/chrome/browser/ui/webui/ash/multidevice_internals/multidevice_internals_phone_hub_handler.cc
index e5ec0dc..d998284f 100644
--- a/chrome/browser/ui/webui/ash/multidevice_internals/multidevice_internals_phone_hub_handler.cc
+++ b/chrome/browser/ui/webui/ash/multidevice_internals/multidevice_internals_phone_hub_handler.cc
@@ -106,27 +106,32 @@
const base::Value::Dict* browser_tab_metadata =
browser_tab_status_dict->FindDict(key);
- if (!browser_tab_metadata)
+ if (!browser_tab_metadata) {
return;
+ }
const std::string* url = browser_tab_metadata->FindString("url");
- if (!url || url->empty())
+ if (!url || url->empty()) {
return;
+ }
const std::string* title = browser_tab_metadata->FindString("title");
- if (!title)
+ if (!title) {
return;
+ }
// JavaScript time stamps don't fit in int.
std::optional<double> last_accessed_timestamp =
browser_tab_metadata->FindDouble("lastAccessedTimeStamp");
- if (!last_accessed_timestamp)
+ if (!last_accessed_timestamp) {
return;
+ }
int favicon_image_type_as_int =
browser_tab_metadata->FindInt("favicon").value_or(0);
- if (!favicon_image_type_as_int)
+ if (!favicon_image_type_as_int) {
return;
+ }
auto favicon_image_type = static_cast<ImageType>(favicon_image_type_as_int);
gfx::Image favicon = gfx::Image::CreateFrom1xBitmap(
@@ -152,8 +157,9 @@
MultidevicePhoneHubHandler::MultidevicePhoneHubHandler() = default;
MultidevicePhoneHubHandler::~MultidevicePhoneHubHandler() {
- if (fake_phone_hub_manager_)
+ if (fake_phone_hub_manager_) {
EnableRealPhoneHubManager();
+ }
}
void MultidevicePhoneHubHandler::RegisterMessages() {
@@ -344,8 +350,9 @@
void MultidevicePhoneHubHandler::EnableRealPhoneHubManager() {
// If no FakePhoneHubManager is active, return early. This ensures that we
// don't unnecessarily re-initialize the Phone Hub UI.
- if (!fake_phone_hub_manager_)
+ if (!fake_phone_hub_manager_) {
return;
+ }
PA_LOG(VERBOSE) << "Setting real Phone Hub Manager";
Profile* profile = Profile::FromWebUI(web_ui());
@@ -359,8 +366,9 @@
void MultidevicePhoneHubHandler::EnableFakePhoneHubManager() {
// Don't create FakePhoneHubManager if it already exists to prevent UAF.
- if (fake_phone_hub_manager_)
+ if (fake_phone_hub_manager_) {
return;
+ }
PA_LOG(VERBOSE) << "Setting fake Phone Hub Manager";
fake_phone_hub_manager_ = std::make_unique<phonehub::FakePhoneHubManager>();
@@ -533,14 +541,16 @@
std::optional<std::u16string> opt_title;
const std::string* title = notification_data_value.FindString("title");
- if (title && !title->empty())
+ if (title && !title->empty()) {
opt_title = base::UTF8ToUTF16(*title);
+ }
std::optional<std::u16string> opt_text_content;
if (const std::string* text_content =
notification_data_value.FindString("textContent")) {
- if (!text_content->empty())
+ if (!text_content->empty()) {
opt_text_content = base::UTF8ToUTF16(*text_content);
+ }
}
std::optional<gfx::Image> opt_shared_image;
diff --git a/chrome/browser/ui/webui/ash/multidevice_setup/multidevice_setup_dialog.cc b/chrome/browser/ui/webui/ash/multidevice_setup/multidevice_setup_dialog.cc
index c640132..52c27c6 100644
--- a/chrome/browser/ui/webui/ash/multidevice_setup/multidevice_setup_dialog.cc
+++ b/chrome/browser/ui/webui/ash/multidevice_setup/multidevice_setup_dialog.cc
@@ -87,8 +87,9 @@
std::u16string()) {}
MultiDeviceSetupDialog::~MultiDeviceSetupDialog() {
- for (auto& callback : on_close_callbacks_)
+ for (auto& callback : on_close_callbacks_) {
std::move(callback).Run();
+ }
}
void MultiDeviceSetupDialog::GetDialogSize(gfx::Size* size) const {
@@ -140,8 +141,9 @@
MultiDeviceSetupService* service =
MultiDeviceSetupServiceFactory::GetForProfile(
Profile::FromWebUI(web_ui()));
- if (service)
+ if (service) {
service->BindMultiDeviceSetup(std::move(receiver));
+ }
}
void MultiDeviceSetupDialogUI::BindInterface(
diff --git a/chrome/browser/ui/webui/ash/multidevice_setup/multidevice_setup_localized_strings_provider.cc b/chrome/browser/ui/webui/ash/multidevice_setup/multidevice_setup_localized_strings_provider.cc
index 39cee66..0f5c7a5d 100644
--- a/chrome/browser/ui/webui/ash/multidevice_setup/multidevice_setup_localized_strings_provider.cc
+++ b/chrome/browser/ui/webui/ash/multidevice_setup/multidevice_setup_localized_strings_provider.cc
@@ -155,8 +155,9 @@
}
void AddLocalizedValuesToBuilder(::login::LocalizedValuesBuilder* builder) {
- for (const auto& entry : kLocalizedStringsWithoutPlaceholders)
+ for (const auto& entry : kLocalizedStringsWithoutPlaceholders) {
builder->Add(entry.name, entry.id);
+ }
// TODO(crbug.com/964547): Refactor so that any change to these strings will
// surface in both the OOBE and post-OOBE UIs without having to adjust both
diff --git a/chrome/browser/ui/webui/ash/network_ui/network_logs_message_handler.cc b/chrome/browser/ui/webui/ash/network_ui/network_logs_message_handler.cc
index fcffe19..64688b88 100644
--- a/chrome/browser/ui/webui/ash/network_ui/network_logs_message_handler.cc
+++ b/chrome/browser/ui/webui/ash/network_ui/network_logs_message_handler.cc
@@ -33,8 +33,9 @@
Profile* profile = Profile::FromWebUI(web_ui);
const DownloadPrefs* const prefs = DownloadPrefs::FromBrowserContext(profile);
base::FilePath path = prefs->DownloadPath();
- if (file_manager::util::IsUnderNonNativeLocalPath(profile, path))
+ if (file_manager::util::IsUnderNonNativeLocalPath(profile, path)) {
path = prefs->GetDefaultDownloadDirectoryForProfile();
+ }
return path;
}
diff --git a/chrome/browser/ui/webui/ash/network_ui/network_ui.cc b/chrome/browser/ui/webui/ash/network_ui/network_ui.cc
index 96d0951..6568ea7 100644
--- a/chrome/browser/ui/webui/ash/network_ui/network_ui.cc
+++ b/chrome/browser/ui/webui/ash/network_ui/network_ui.cc
@@ -101,8 +101,9 @@
const NetworkState* network =
NetworkHandler::Get()->network_state_handler()->GetNetworkStateFromGuid(
guid);
- if (!network)
+ if (!network) {
return false;
+ }
*service_path = network->path();
return true;
}
@@ -110,12 +111,14 @@
void SetDeviceProperties(base::Value::Dict* dictionary) {
DCHECK(dictionary);
const std::string* device = dictionary->FindString(shill::kDeviceProperty);
- if (!device)
+ if (!device) {
return;
+ }
const DeviceState* device_state =
NetworkHandler::Get()->network_state_handler()->GetDeviceState(*device);
- if (!device_state)
+ if (!device_state) {
return;
+ }
base::Value::Dict device_dictionary = device_state->properties().Clone();
if (!device_state->ip_configs().empty()) {
@@ -126,8 +129,9 @@
}
device_dictionary.Set(shill::kIPConfigsProperty, std::move(ip_configs));
}
- if (!device_dictionary.empty())
+ if (!device_dictionary.empty()) {
dictionary->Set(shill::kDeviceProperty, std::move(device_dictionary));
+ }
}
bool IsGuestModeActive() {
@@ -152,8 +156,9 @@
const ManagedNetworkConfigurationHandler*
managed_network_configuration_handler =
NetworkHandler::Get()->managed_network_configuration_handler();
- if (!managed_network_configuration_handler)
+ if (!managed_network_configuration_handler) {
return std::nullopt;
+ }
if (managed_network_configuration_handler
->AllowOnlyPolicyCellularNetworks()) {
NET_LOG(ERROR)
@@ -162,8 +167,9 @@
}
NetworkStateHandler* network_state_handler =
NetworkHandler::Get()->network_state_handler();
- if (!network_state_handler)
+ if (!network_state_handler) {
return std::nullopt;
+ }
NetworkStateHandler::NetworkStateList state_list;
network_state_handler->GetNetworkListByType(NetworkTypePattern::Cellular(),
/*configured_only=*/false,
@@ -416,8 +422,9 @@
void ResetESimCache(const base::Value::List& arg_list) {
CellularESimProfileHandler* handler =
NetworkHandler::Get()->cellular_esim_profile_handler();
- if (!handler)
+ if (!handler) {
return;
+ }
CellularESimProfileHandlerImpl* handler_impl =
static_cast<CellularESimProfileHandlerImpl*>(handler);
@@ -427,8 +434,9 @@
void DisableActiveESimProfile(const base::Value::List& arg_list) {
CellularESimProfileHandler* handler =
NetworkHandler::Get()->cellular_esim_profile_handler();
- if (!handler)
+ if (!handler) {
return;
+ }
CellularESimProfileHandlerImpl* handler_impl =
static_cast<CellularESimProfileHandlerImpl*>(handler);
@@ -437,13 +445,15 @@
void ResetEuicc(const base::Value::List& arg_list) {
std::optional<dbus::ObjectPath> euicc_path = GetEuiccResetPath();
- if (!euicc_path)
+ if (!euicc_path) {
return;
+ }
CellularESimUninstallHandler* handler =
NetworkHandler::Get()->cellular_esim_uninstall_handler();
- if (!handler)
+ if (!handler) {
return;
+ }
NET_LOG(EVENT) << "Executing reset EUICC on " << euicc_path->value();
handler->ResetEuiccMemory(
*euicc_path, base::BindOnce(&NetworkConfigMessageHandler::OnEuiccReset,
diff --git a/chrome/browser/ui/webui/ash/network_ui/onc_import_message_handler.cc b/chrome/browser/ui/webui/ash/network_ui/onc_import_message_handler.cc
index d42fc88..ba32fa7a 100644
--- a/chrome/browser/ui/webui/ash/network_ui/onc_import_message_handler.cc
+++ b/chrome/browser/ui/webui/ash/network_ui/onc_import_message_handler.cc
@@ -44,8 +44,9 @@
auto split_callback = base::SplitOnceCallback(std::move(callback));
net::NSSCertDatabase* cert_db =
std::move(database_getter).Run(std::move(split_callback.first));
- if (cert_db)
+ if (cert_db) {
std::move(split_callback.second).Run(cert_db);
+ }
}
} // namespace
@@ -123,8 +124,9 @@
result +=
base::StringPrintf("Networks imported: %d\n", num_networks_imported);
if (certificates.empty()) {
- if (!num_networks_imported)
+ if (!num_networks_imported) {
has_error = true;
+ }
Respond(callback_id, result, has_error);
return;
}
diff --git a/chrome/browser/ui/webui/ash/office_fallback/office_fallback_dialog.cc b/chrome/browser/ui/webui/ash/office_fallback/office_fallback_dialog.cc
index 8b74119..bfd9d44 100644
--- a/chrome/browser/ui/webui/ash/office_fallback/office_fallback_dialog.cc
+++ b/chrome/browser/ui/webui/ash/office_fallback/office_fallback_dialog.cc
@@ -212,8 +212,9 @@
// Delete class.
SystemWebDialogDelegate::OnDialogClosed(choice);
// Run callback after dialog closed.
- if (callback)
+ if (callback) {
std::move(callback).Run(choice);
+ }
}
OfficeFallbackDialog::OfficeFallbackDialog(
diff --git a/chrome/browser/ui/webui/ash/office_fallback/office_fallback_dialog_browsertest.cc b/chrome/browser/ui/webui/ash/office_fallback/office_fallback_dialog_browsertest.cc
index e5efd7c..aaf9b130 100644
--- a/chrome/browser/ui/webui/ash/office_fallback/office_fallback_dialog_browsertest.cc
+++ b/chrome/browser/ui/webui/ash/office_fallback/office_fallback_dialog_browsertest.cc
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "chrome/browser/ui/webui/ash/office_fallback/office_fallback_dialog.h"
+
#include <utility>
#include "base/test/bind.h"
@@ -10,7 +12,6 @@
#include "chrome/browser/ash/file_manager/office_file_tasks.h"
#include "chrome/browser/ash/file_system_provider/service.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/webui/ash/office_fallback/office_fallback_dialog.h"
#include "chrome/browser/ui/webui/ash/office_fallback/office_fallback_ui.h"
#include "chrome/common/extensions/extension_constants.h"
#include "chrome/grit/generated_resources.h"
diff --git a/chrome/browser/ui/webui/ash/parent_access/parent_access_metrics_utils.cc b/chrome/browser/ui/webui/ash/parent_access/parent_access_metrics_utils.cc
index 21a674e..d5c68b2 100644
--- a/chrome/browser/ui/webui/ash/parent_access/parent_access_metrics_utils.cc
+++ b/chrome/browser/ui/webui/ash/parent_access/parent_access_metrics_utils.cc
@@ -2,9 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "chrome/browser/ui/webui/ash/parent_access/parent_access_metrics_utils.h"
+
#include <string_view>
-#include "chrome/browser/ui/webui/ash/parent_access/parent_access_metrics_utils.h"
#include "base/strings/string_util.h"
namespace parent_access {
diff --git a/chrome/browser/ui/webui/ash/set_time/set_time_ui.cc b/chrome/browser/ui/webui/ash/set_time/set_time_ui.cc
index 3836e03..e32262cd 100644
--- a/chrome/browser/ui/webui/ash/set_time/set_time_ui.cc
+++ b/chrome/browser/ui/webui/ash/set_time/set_time_ui.cc
@@ -146,8 +146,9 @@
}
void OnParentAccessValidation(bool success) {
- if (success)
+ if (success) {
FireWebUIListener("validation-complete");
+ }
}
base::ScopedObservation<SystemClockClient, SystemClockClient::Observer>
diff --git a/chrome/browser/ui/webui/ash/settings/os_settings_features_util.cc b/chrome/browser/ui/webui/ash/settings/os_settings_features_util.cc
index e2a5f31..96fda88 100644
--- a/chrome/browser/ui/webui/ash/settings/os_settings_features_util.cc
+++ b/chrome/browser/ui/webui/ash/settings/os_settings_features_util.cc
@@ -56,12 +56,14 @@
bool ShouldShowParentalControlSettings(const Profile* profile) {
// Not shown for secondary users.
- if (profile != ProfileManager::GetPrimaryUserProfile())
+ if (profile != ProfileManager::GetPrimaryUserProfile()) {
return false;
+ }
// Also not shown for guest sessions.
- if (profile->IsGuestSession())
+ if (profile->IsGuestSession()) {
return false;
+ }
return profile->IsChild() ||
!profile->GetProfilePolicyConnector()->IsManaged();
diff --git a/chrome/browser/ui/webui/ash/settings/pages/a11y/accessibility_handler_unittest.cc b/chrome/browser/ui/webui/ash/settings/pages/a11y/accessibility_handler_unittest.cc
index 9b79552f8..117f0bf5 100644
--- a/chrome/browser/ui/webui/ash/settings/pages/a11y/accessibility_handler_unittest.cc
+++ b/chrome/browser/ui/webui/ash/settings/pages/a11y/accessibility_handler_unittest.cc
@@ -48,9 +48,7 @@
web_ui_->AddMessageHandler(std::move(handler));
}
- void TearDown() override {
- web_ui_.reset();
- }
+ void TearDown() override { web_ui_.reset(); }
protected:
MockNewWindowDelegate& new_window_delegate() { return new_window_delegate_; }
diff --git a/chrome/browser/ui/webui/ash/settings/pages/a11y/settings_with_tts_preview_handler.cc b/chrome/browser/ui/webui/ash/settings/pages/a11y/settings_with_tts_preview_handler.cc
index 66e725e..fa4903c 100644
--- a/chrome/browser/ui/webui/ash/settings/pages/a11y/settings_with_tts_preview_handler.cc
+++ b/chrome/browser/ui/webui/ash/settings/pages/a11y/settings_with_tts_preview_handler.cc
@@ -57,16 +57,19 @@
const std::string& text = args[0].GetString();
const std::string& voice_id = args[1].GetString();
- if (text.empty() || voice_id.empty())
+ if (text.empty() || voice_id.empty()) {
return;
+ }
std::optional<base::Value> json = base::JSONReader::Read(voice_id);
std::string name;
std::string extension_id;
- if (const std::string* ptr = json->GetDict().FindString("name"))
+ if (const std::string* ptr = json->GetDict().FindString("name")) {
name = *ptr;
- if (const std::string* ptr = json->GetDict().FindString("extension"))
+ }
+ if (const std::string* ptr = json->GetDict().FindString("extension")) {
extension_id = *ptr;
+ }
std::unique_ptr<content::TtsUtterance> utterance =
content::TtsUtterance::Create(web_ui()->GetWebContents());
diff --git a/chrome/browser/ui/webui/ash/settings/pages/apps/mojom/app_type_mojom_traits_unittest.cc b/chrome/browser/ui/webui/ash/settings/pages/apps/mojom/app_type_mojom_traits_unittest.cc
index 4239e5a..ed67d99 100644
--- a/chrome/browser/ui/webui/ash/settings/pages/apps/mojom/app_type_mojom_traits_unittest.cc
+++ b/chrome/browser/ui/webui/ash/settings/pages/apps/mojom/app_type_mojom_traits_unittest.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "chrome/browser/ui/webui/ash/settings/pages/apps/mojom/app_type_mojom_traits.h"
+
#include "chrome/browser/ui/webui/ash/settings/pages/apps/mojom/app_notification_handler.mojom.h"
#include "components/services/app_service/public/cpp/app_types.h"
#include "mojo/public/cpp/test_support/test_utils.h"
diff --git a/chrome/browser/ui/webui/ash/settings/pages/crostini/crostini_handler.cc b/chrome/browser/ui/webui/ash/settings/pages/crostini/crostini_handler.cc
index b45b0ca7..07865d0 100644
--- a/chrome/browser/ui/webui/ash/settings/pages/crostini/crostini_handler.cc
+++ b/chrome/browser/ui/webui/ash/settings/pages/crostini/crostini_handler.cc
@@ -217,16 +217,16 @@
base::BindRepeating(&CrostiniHandler::HandleSetVmDeviceShared,
handler_weak_ptr_factory_.GetWeakPtr()));
}
- web_ui()->RegisterMessageCallback(
- "requestBruschettaInstallerView",
- base::BindRepeating(
- &CrostiniHandler::HandleRequestBruschettaInstallerView,
- handler_weak_ptr_factory_.GetWeakPtr()));
- web_ui()->RegisterMessageCallback(
- "requestBruschettaUninstallerView",
- base::BindRepeating(
- &CrostiniHandler::HandleRequestBruschettaUninstallerView,
- handler_weak_ptr_factory_.GetWeakPtr()));
+ web_ui()->RegisterMessageCallback(
+ "requestBruschettaInstallerView",
+ base::BindRepeating(
+ &CrostiniHandler::HandleRequestBruschettaInstallerView,
+ handler_weak_ptr_factory_.GetWeakPtr()));
+ web_ui()->RegisterMessageCallback(
+ "requestBruschettaUninstallerView",
+ base::BindRepeating(
+ &CrostiniHandler::HandleRequestBruschettaUninstallerView,
+ handler_weak_ptr_factory_.GetWeakPtr()));
}
void CrostiniHandler::OnJavascriptAllowed() {
diff --git a/chrome/browser/ui/webui/ash/settings/pages/main/os_settings_hats_handler.cc b/chrome/browser/ui/webui/ash/settings/pages/main/os_settings_hats_handler.cc
index 6637ffa7..27fb5bc 100644
--- a/chrome/browser/ui/webui/ash/settings/pages/main/os_settings_hats_handler.cc
+++ b/chrome/browser/ui/webui/ash/settings/pages/main/os_settings_hats_handler.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "chrome/browser/ui/webui/ash/settings/pages/main/os_settings_hats_handler.h"
+
#include "chrome/browser/ui/webui/ash/settings/os_settings_ui.h"
#include "chrome/browser/ui/webui/ash/settings/services/hats/os_settings_hats_manager.h"
#include "chrome/browser/ui/webui/ash/settings/services/hats/os_settings_hats_manager_factory.h"
diff --git a/chrome/browser/ui/webui/ash/settings/pages/main/os_settings_hats_handler_unittest.cc b/chrome/browser/ui/webui/ash/settings/pages/main/os_settings_hats_handler_unittest.cc
index 186c901..f359cc1 100644
--- a/chrome/browser/ui/webui/ash/settings/pages/main/os_settings_hats_handler_unittest.cc
+++ b/chrome/browser/ui/webui/ash/settings/pages/main/os_settings_hats_handler_unittest.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "chrome/browser/ui/webui/ash/settings/pages/main/os_settings_hats_handler.h"
+
#include "chrome/browser/ui/webui/ash/settings/services/hats/os_settings_hats_manager.h"
#include "chrome/browser/ui/webui/ash/settings/services/hats/os_settings_hats_manager_factory.h"
#include "chrome/test/base/browser_with_test_window_test.h"
diff --git a/chrome/browser/ui/webui/ash/settings/pages/os_settings_section.cc b/chrome/browser/ui/webui/ash/settings/pages/os_settings_section.cc
index 7daca55..fc25a355 100644
--- a/chrome/browser/ui/webui/ash/settings/pages/os_settings_section.cc
+++ b/chrome/browser/ui/webui/ash/settings/pages/os_settings_section.cc
@@ -34,8 +34,9 @@
mojom::Subpage subpage,
const base::span<const mojom::Setting>& settings,
HierarchyGenerator* generator) {
- for (const auto& setting : settings)
+ for (const auto& setting : settings) {
generator->RegisterNestedSetting(setting, subpage);
+ }
}
OsSettingsSection::~OsSettingsSection() = default;
@@ -80,8 +81,9 @@
OsSettingsIdentifier id,
const std::string& url_to_modify) {
// Default case for static URLs which do not need to be modified.
- if (type != mojom::SearchResultType::kSetting)
+ if (type != mojom::SearchResultType::kSetting) {
return url_to_modify;
+ }
std::stringstream ss;
ss << url_to_modify;
diff --git a/chrome/browser/ui/webui/ash/settings/pages/people/people_section.h b/chrome/browser/ui/webui/ash/settings/pages/people/people_section.h
index 61f08237..0fef2bb 100644
--- a/chrome/browser/ui/webui/ash/settings/pages/people/people_section.h
+++ b/chrome/browser/ui/webui/ash/settings/pages/people/people_section.h
@@ -74,7 +74,6 @@
void UpdateAccountManagerSearchTags(
const std::vector<::account_manager::Account>& accounts);
-
raw_ptr<account_manager::AccountManager> account_manager_ = nullptr;
raw_ptr<account_manager::AccountManagerFacade> account_manager_facade_ =
nullptr;
diff --git a/chrome/browser/ui/webui/ash/settings/pages/personalization/personalization_hub_handler.h b/chrome/browser/ui/webui/ash/settings/pages/personalization/personalization_hub_handler.h
index d1ccf044..3655d20d 100644
--- a/chrome/browser/ui/webui/ash/settings/pages/personalization/personalization_hub_handler.h
+++ b/chrome/browser/ui/webui/ash/settings/pages/personalization/personalization_hub_handler.h
@@ -5,9 +5,8 @@
#ifndef CHROME_BROWSER_UI_WEBUI_ASH_SETTINGS_PAGES_PERSONALIZATION_PERSONALIZATION_HUB_HANDLER_H_
#define CHROME_BROWSER_UI_WEBUI_ASH_SETTINGS_PAGES_PERSONALIZATION_PERSONALIZATION_HUB_HANDLER_H_
-#include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h"
-
#include "base/values.h"
+#include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h"
namespace ash::settings {
diff --git a/chrome/browser/ui/webui/ash/settings/pages/power/device_power_handler_browsertest.cc b/chrome/browser/ui/webui/ash/settings/pages/power/device_power_handler_browsertest.cc
index ddc9df24..b25aaea 100644
--- a/chrome/browser/ui/webui/ash/settings/pages/power/device_power_handler_browsertest.cc
+++ b/chrome/browser/ui/webui/ash/settings/pages/power/device_power_handler_browsertest.cc
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "chrome/browser/ui/webui/ash/settings/pages/power/device_power_handler.h"
+
#include <memory>
#include <set>
#include <utility>
@@ -14,7 +16,6 @@
#include "base/test/scoped_feature_list.h"
#include "base/values.h"
#include "chrome/browser/profiles/profile_manager.h"
-#include "chrome/browser/ui/webui/ash/settings/pages/power/device_power_handler.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chromeos/dbus/power/fake_power_manager_client.h"
#include "chromeos/dbus/power/power_policy_controller.h"
diff --git a/chrome/browser/ui/webui/ash/settings/pages/privacy/app_permission_handler_unittest.cc b/chrome/browser/ui/webui/ash/settings/pages/privacy/app_permission_handler_unittest.cc
index 4564a89..4de3d49 100644
--- a/chrome/browser/ui/webui/ash/settings/pages/privacy/app_permission_handler_unittest.cc
+++ b/chrome/browser/ui/webui/ash/settings/pages/privacy/app_permission_handler_unittest.cc
@@ -138,9 +138,7 @@
handler_->AddObserver(observer_->GenerateRemote());
}
- void TearDown() override {
- handler_.reset();
- }
+ void TearDown() override { handler_.reset(); }
protected:
AppPermissionHandlerTestObserver* observer() { return observer_.get(); }
diff --git a/chrome/browser/ui/webui/ash/settings/pages/privacy/metrics_consent_handler_unittest.cc b/chrome/browser/ui/webui/ash/settings/pages/privacy/metrics_consent_handler_unittest.cc
index c04f26ad..73d72d4 100644
--- a/chrome/browser/ui/webui/ash/settings/pages/privacy/metrics_consent_handler_unittest.cc
+++ b/chrome/browser/ui/webui/ash/settings/pages/privacy/metrics_consent_handler_unittest.cc
@@ -60,8 +60,9 @@
: public ::metrics::TestMetricsServiceClient {
public:
std::optional<bool> GetCurrentUserMetricsConsent() const override {
- if (should_use_user_consent_)
+ if (should_use_user_consent_) {
return current_user_metrics_consent_;
+ }
return std::nullopt;
}
diff --git a/chrome/browser/ui/webui/ash/settings/pages/privacy/peripheral_data_access_handler.cc b/chrome/browser/ui/webui/ash/settings/pages/privacy/peripheral_data_access_handler.cc
index 86bae5b..5a73c06c 100644
--- a/chrome/browser/ui/webui/ash/settings/pages/privacy/peripheral_data_access_handler.cc
+++ b/chrome/browser/ui/webui/ash/settings/pages/privacy/peripheral_data_access_handler.cc
@@ -122,9 +122,10 @@
}
void PeripheralDataAccessHandler::OnFilePathChecked(
- const std::string& callback_id, bool is_thunderbolt_supported) {
+ const std::string& callback_id,
+ bool is_thunderbolt_supported) {
ResolveJavascriptCallback(base::Value(callback_id),
- base::Value(is_thunderbolt_supported));
+ base::Value(is_thunderbolt_supported));
}
void PeripheralDataAccessHandler::OnPeripheralDataAccessProtectionChanged() {
diff --git a/chrome/browser/ui/webui/ash/settings/pages/privacy/peripheral_data_access_handler.h b/chrome/browser/ui/webui/ash/settings/pages/privacy/peripheral_data_access_handler.h
index fd852a6..f686929 100644
--- a/chrome/browser/ui/webui/ash/settings/pages/privacy/peripheral_data_access_handler.h
+++ b/chrome/browser/ui/webui/ash/settings/pages/privacy/peripheral_data_access_handler.h
@@ -40,7 +40,7 @@
void OnPeripheralDataAccessProtectionChanged();
void OnFilePathChecked(const std::string& callback_id,
- bool is_thunderbolt_supported);
+ bool is_thunderbolt_supported);
void OnLocalStatePrefChanged();
diff --git a/chrome/browser/ui/webui/ash/settings/pages/search/search_engines_handler_unittest.cc b/chrome/browser/ui/webui/ash/settings/pages/search/search_engines_handler_unittest.cc
index 715843f..5dbbebb 100644
--- a/chrome/browser/ui/webui/ash/settings/pages/search/search_engines_handler_unittest.cc
+++ b/chrome/browser/ui/webui/ash/settings/pages/search/search_engines_handler_unittest.cc
@@ -56,9 +56,7 @@
handler_->AllowJavascriptForTesting();
}
- void TearDown() override {
- web_ui_.reset();
- }
+ void TearDown() override { web_ui_.reset(); }
protected:
MockNewWindowDelegate& new_window_delegate() { return new_window_delegate_; }
diff --git a/chrome/browser/ui/webui/ash/settings/search/hierarchy.cc b/chrome/browser/ui/webui/ash/settings/search/hierarchy.cc
index 07a3f6ba..6cdfe3d 100644
--- a/chrome/browser/ui/webui/ash/settings/search/hierarchy.cc
+++ b/chrome/browser/ui/webui/ash/settings/search/hierarchy.cc
@@ -120,8 +120,9 @@
auto it = subpage_map.find(subpage);
// Metadata already exists; return it.
- if (it != subpage_map.end())
+ if (it != subpage_map.end()) {
return it->second;
+ }
// Metadata does not exist yet; insert then return it.
auto pair = subpage_map.emplace(
@@ -139,8 +140,9 @@
auto it = settings_map.find(setting);
// Metadata already exists; return it.
- if (it != settings_map.end())
+ if (it != settings_map.end()) {
return it->second;
+ }
// Metadata does not exist yet; insert then return it.
auto pair = settings_map.emplace(setting, section_);
@@ -252,8 +254,9 @@
const SubpageMetadata& subpage_metadata = GetSubpageMetadata(subpage);
// Top-level subpage; simply return section hierarchy.
- if (!subpage_metadata.parent_subpage)
+ if (!subpage_metadata.parent_subpage) {
return GenerateHierarchyStrings(subpage_metadata.section);
+ }
// Nested subpage; use recursive call, then append parent subpage name itself.
std::vector<std::u16string> hierarchy_strings =
@@ -270,8 +273,9 @@
const SettingMetadata& setting_metadata = GetSettingMetadata(setting);
// Top-level setting; simply return section hierarchy.
- if (!setting_metadata.primary.subpage)
+ if (!setting_metadata.primary.subpage) {
return GenerateHierarchyStrings(setting_metadata.primary.section);
+ }
// Nested setting; use subpage ancestors, then append subpage name itself.
std::vector<std::u16string> hierarchy_strings =
diff --git a/chrome/browser/ui/webui/ash/settings/services/hats/os_settings_hats_manager.cc b/chrome/browser/ui/webui/ash/settings/services/hats/os_settings_hats_manager.cc
index a650125..9c80e63e 100644
--- a/chrome/browser/ui/webui/ash/settings/services/hats/os_settings_hats_manager.cc
+++ b/chrome/browser/ui/webui/ash/settings/services/hats/os_settings_hats_manager.cc
@@ -3,13 +3,13 @@
// found in the LICENSE file.
#include "chrome/browser/ui/webui/ash/settings/services/hats/os_settings_hats_manager.h"
-#include "chrome/browser/ui/webui/ash/settings/services/hats/os_settings_hats_manager_factory.h"
#include "base/functional/bind.h"
#include "base/time/time.h"
#include "chrome/browser/ash/hats/hats_config.h"
#include "chrome/browser/ash/hats/hats_notification_controller.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/webui/ash/settings/services/hats/os_settings_hats_manager_factory.h"
#include "content/public/browser/browser_context.h"
namespace ash::settings {
diff --git a/chrome/browser/ui/webui/ash/settings/services/hats/os_settings_hats_manager_factory.cc b/chrome/browser/ui/webui/ash/settings/services/hats/os_settings_hats_manager_factory.cc
index c9322bb2..4abdf777 100644
--- a/chrome/browser/ui/webui/ash/settings/services/hats/os_settings_hats_manager_factory.cc
+++ b/chrome/browser/ui/webui/ash/settings/services/hats/os_settings_hats_manager_factory.cc
@@ -2,8 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/no_destructor.h"
#include "chrome/browser/ui/webui/ash/settings/services/hats/os_settings_hats_manager_factory.h"
+
+#include "base/no_destructor.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/webui/ash/settings/services/hats/os_settings_hats_manager.h"
diff --git a/chrome/browser/ui/webui/ash/slow/slow_trace_ui.cc b/chrome/browser/ui/webui/ash/slow/slow_trace_ui.cc
index 0eecc17..dd1e094 100644
--- a/chrome/browser/ui/webui/ash/slow/slow_trace_ui.cc
+++ b/chrome/browser/ui/webui/ash/slow/slow_trace_ui.cc
@@ -41,8 +41,7 @@
const std::string path = content::URLDataSource::URLToRequestPath(url);
size_t pos = path.find('#');
ContentTracingManager* manager = ContentTracingManager::Get();
- if (!manager ||
- pos == std::string::npos ||
+ if (!manager || pos == std::string::npos ||
!base::StringToInt(path.substr(pos + 1), &trace_id)) {
std::move(callback).Run(nullptr);
return;
@@ -78,7 +77,6 @@
SlowTraceController::SlowTraceController(content::WebUI* web_ui)
: WebUIController(web_ui) {
-
// Set up the chrome://slow_trace/ source.
content::URLDataSource::Add(Profile::FromWebUI(web_ui),
std::make_unique<SlowTraceSource>());
diff --git a/chrome/browser/ui/webui/ash/system_web_dialog/system_web_dialog_browsertest.cc b/chrome/browser/ui/webui/ash/system_web_dialog/system_web_dialog_browsertest.cc
index cf272c5..8187777 100644
--- a/chrome/browser/ui/webui/ash/system_web_dialog/system_web_dialog_browsertest.cc
+++ b/chrome/browser/ui/webui/ash/system_web_dialog/system_web_dialog_browsertest.cc
@@ -2,14 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/ui/webui/ash/system_web_dialog/system_web_dialog_delegate.h"
-
#include "ash/public/cpp/test/shell_test_api.h"
#include "chrome/browser/ash/login/login_manager_test.h"
#include "chrome/browser/ash/login/test/login_manager_mixin.h"
#include "chrome/browser/ash/login/test/oobe_base_test.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/webui/ash/system_web_dialog/system_web_dialog_delegate.h"
#include "chrome/browser/ui/zoom/chrome_zoom_level_prefs.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/webui_url_constants.h"
@@ -34,8 +33,9 @@
explicit MockSystemWebDialog(const char* id = nullptr)
: SystemWebDialogDelegate(GURL(chrome::kChromeUIInternetConfigDialogURL),
std::u16string()) {
- if (id)
+ if (id) {
id_ = std::string(id);
+ }
}
MockSystemWebDialog(const MockSystemWebDialog&) = delete;
diff --git a/chrome/browser/ui/webui/ash/system_web_dialog/system_web_dialog_delegate.cc b/chrome/browser/ui/webui/ash/system_web_dialog/system_web_dialog_delegate.cc
index 37920fc..4ce3aedf 100644
--- a/chrome/browser/ui/webui/ash/system_web_dialog/system_web_dialog_delegate.cc
+++ b/chrome/browser/ui/webui/ash/system_web_dialog/system_web_dialog_delegate.cc
@@ -107,8 +107,9 @@
// TODO(crbug.com/40112040): It could be possible that a Chromebox is
// hooked up to a low-resolution monitor. It might be a good idea to check
// that display's resolution as well.
- if (!display::HasInternalDisplay())
+ if (!display::HasInternalDisplay()) {
return preferred_size;
+ }
display::Display internal_display;
if (!display::Screen::GetScreen()->GetDisplayWithDisplayId(
diff --git a/chrome/browser/ui/webui/ash/user_image/user_image_source.cc b/chrome/browser/ui/webui/ash/user_image/user_image_source.cc
index 36039d7..aae9ba9 100644
--- a/chrome/browser/ui/webui/ash/user_image/user_image_source.cc
+++ b/chrome/browser/ui/webui/ash/user_image/user_image_source.cc
@@ -98,16 +98,18 @@
user_manager::UserImage::ImageFormat image_format,
int frame) {
// Return all frames.
- if (frame == -1)
+ if (frame == -1) {
return image_bytes;
+ }
// TODO(reveman): Add support for frames beyond 0 (crbug.com/750064).
if (frame) {
NOTIMPLEMENTED() << "Unsupported frame: " << frame;
return nullptr;
}
// Only PNGs can be animated.
- if (image_format != user_manager::UserImage::FORMAT_PNG)
+ if (image_format != user_manager::UserImage::FORMAT_PNG) {
return image_bytes;
+ }
// Extract first frame by re-encoding image.
SkBitmap bitmap = gfx::PNGCodec::Decode(*image_bytes);
if (bitmap.isNull()) {
diff --git a/chrome/browser/ui/webui/autofill_and_password_manager_internals/autofill_internals_ui_browsertest.cc b/chrome/browser/ui/webui/autofill_and_password_manager_internals/autofill_internals_ui_browsertest.cc
index 2a2e0de..6780c84 100644
--- a/chrome/browser/ui/webui/autofill_and_password_manager_internals/autofill_internals_ui_browsertest.cc
+++ b/chrome/browser/ui/webui/autofill_and_password_manager_internals/autofill_internals_ui_browsertest.cc
@@ -2,10 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/ui/webui/autofill_and_password_manager_internals/internals_ui_handler.h"
-
#include "base/task/single_thread_task_runner.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/webui/autofill_and_password_manager_internals/internals_ui_handler.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/browser/web_contents.h"
@@ -47,8 +46,9 @@
// Wait for reset-fake-button to become visible
constexpr char kGetResetButtonDisplayStyle[] =
"document.getElementById('reset-cache-fake-button').style.display";
- while ("inline" != EvalJs(kGetResetButtonDisplayStyle))
+ while ("inline" != EvalJs(kGetResetButtonDisplayStyle)) {
SpinRunLoop();
+ }
// Trigger reset button.
constexpr char kClickResetButton[] =
@@ -58,8 +58,9 @@
// Wait for dialog to appear.
constexpr char kDialogTextVisible[] =
"document.getElementsByClassName('modal-dialog-text').length > 0";
- while (!EvalJs(kDialogTextVisible).ExtractBool())
+ while (!EvalJs(kDialogTextVisible).ExtractBool()) {
SpinRunLoop();
+ }
// Check result text.
constexpr char kDialogText[] =
@@ -73,8 +74,9 @@
EXPECT_TRUE(ExecJs(kClickCloseButton));
// Wait for dialog to disappear.
- while (EvalJs(kDialogTextVisible).ExtractBool())
+ while (EvalJs(kDialogTextVisible).ExtractBool()) {
SpinRunLoop();
+ }
}
} // namespace
diff --git a/chrome/browser/ui/webui/autofill_and_password_manager_internals/internals_ui_handler.cc b/chrome/browser/ui/webui/autofill_and_password_manager_internals/internals_ui_handler.cc
index 9ff83ed..5d40b50 100644
--- a/chrome/browser/ui/webui/autofill_and_password_manager_internals/internals_ui_handler.cc
+++ b/chrome/browser/ui/webui/autofill_and_password_manager_internals/internals_ui_handler.cc
@@ -192,26 +192,30 @@
void InternalsUIHandler::StartSubscription() {
LogRouter* log_router =
get_log_router_function_.Run(Profile::FromWebUI(web_ui()));
- if (!log_router)
+ if (!log_router) {
return;
+ }
registered_with_log_router_ = true;
log_router->RegisterReceiver(this);
}
void InternalsUIHandler::EndSubscription() {
- if (!registered_with_log_router_)
+ if (!registered_with_log_router_) {
return;
+ }
registered_with_log_router_ = false;
LogRouter* log_router =
get_log_router_function_.Run(Profile::FromWebUI(web_ui()));
- if (log_router)
+ if (log_router) {
log_router->UnregisterReceiver(this);
+ }
}
void InternalsUIHandler::LogEntry(const base::Value::Dict& entry) {
- if (!registered_with_log_router_)
+ if (!registered_with_log_router_) {
return;
+ }
FireWebUIListener("add-structured-log", entry);
}
diff --git a/chrome/browser/ui/webui/bookmarks/bookmarks_ui.cc b/chrome/browser/ui/webui/bookmarks/bookmarks_ui.cc
index 64301ab..3edd4da 100644
--- a/chrome/browser/ui/webui/bookmarks/bookmarks_ui.cc
+++ b/chrome/browser/ui/webui/bookmarks/bookmarks_ui.cc
@@ -124,8 +124,9 @@
{"toastItemDeleted", IDS_BOOKMARK_MANAGER_TOAST_ITEM_DELETED},
{"undo", IDS_BOOKMARK_BAR_UNDO},
};
- for (const auto& str : kStrings)
+ for (const auto& str : kStrings) {
AddLocalizedString(source, str.name, str.id);
+ }
return source;
}
diff --git a/chrome/browser/ui/webui/browser_command/browser_command_handler.cc b/chrome/browser/ui/webui/browser_command/browser_command_handler.cc
index 28799ff..c0f897c 100644
--- a/chrome/browser/ui/webui/browser_command/browser_command_handler.cc
+++ b/chrome/browser/ui/webui/browser_command/browser_command_handler.cc
@@ -58,8 +58,9 @@
supported_commands_(supported_commands),
command_updater_(std::make_unique<CommandUpdaterImpl>(this)),
page_handler_(this, std::move(pending_page_handler)) {
- if (supported_commands_.empty())
+ if (supported_commands_.empty()) {
return;
+ }
EnableSupportedCommands();
}
@@ -111,8 +112,7 @@
can_execute = true;
break;
case Command::kOpenNTPAndStartCustomizeChromeTutorial:
- can_execute = TutorialServiceExists() &&
- DefaultSearchProviderIsGoogle();
+ can_execute = TutorialServiceExists() && DefaultSearchProviderIsGoogle();
break;
case Command::kStartPasswordManagerTutorial:
can_execute = TutorialServiceExists();
diff --git a/chrome/browser/ui/webui/browser_switch/browser_switch_ui.cc b/chrome/browser/ui/webui/browser_switch/browser_switch_ui.cc
index c6a1ea3c..7d23fad 100644
--- a/chrome/browser/ui/webui/browser_switch/browser_switch_ui.cc
+++ b/chrome/browser/ui/webui/browser_switch/browser_switch_ui.cc
@@ -52,11 +52,13 @@
profile = profile->GetOriginalProfile();
int tab_count = 0;
for (const Browser* browser : *BrowserList::GetInstance()) {
- if (browser->profile()->GetOriginalProfile() != profile)
+ if (browser->profile()->GetOriginalProfile() != profile) {
continue;
+ }
tab_count += browser->tab_strip_model()->count();
- if (tab_count > 1)
+ if (tab_count > 1) {
return false;
+ }
}
return true;
}
@@ -518,8 +520,9 @@
base::Value::Dict retval;
for (const auto& source : sources) {
base::Value val;
- if (source.url.is_valid())
+ if (source.url.is_valid()) {
val = base::Value(source.url.spec());
+ }
// |pref_name| is something like "browser_switcher.blah"; however path
// expansion is not expected on it as the JavaScript expects to see
// "browser_switcher.blah" as a key in the object, not a nested hierarchy.
diff --git a/chrome/browser/ui/webui/certificate_manager_localized_strings_provider.cc b/chrome/browser/ui/webui/certificate_manager_localized_strings_provider.cc
index c587651..921ec1e 100644
--- a/chrome/browser/ui/webui/certificate_manager_localized_strings_provider.cc
+++ b/chrome/browser/ui/webui/certificate_manager_localized_strings_provider.cc
@@ -16,98 +16,99 @@
void AddLocalizedStrings(content::WebUIDataSource* html_source) {
static constexpr webui::LocalizedString kLocalizedStrings[] = {
- {"certificateManagerExpandA11yLabel",
- IDS_SETTINGS_CERTIFICATE_MANAGER_EXPAND_ACCESSIBILITY_LABEL},
- {"certificateManagerNoCertificates",
- IDS_SETTINGS_CERTIFICATE_MANAGER_NO_CERTIFICATES},
- {"certificateManagerYourCertificates",
- IDS_SETTINGS_CERTIFICATE_MANAGER_YOUR_CERTIFICATES},
- {"certificateManagerYourCertificatesDescription",
- IDS_SETTINGS_CERTIFICATE_MANAGER_YOUR_CERTIFICATES_DESCRIPTION},
- {"certificateManagerServers", IDS_SETTINGS_CERTIFICATE_MANAGER_SERVERS},
- {"certificateManagerServersDescription",
- IDS_SETTINGS_CERTIFICATE_MANAGER_SERVERS_DESCRIPTION},
- {"certificateManagerAuthorities",
- IDS_SETTINGS_CERTIFICATE_MANAGER_AUTHORITIES},
- {"certificateManagerAuthoritiesDescription",
- IDS_SETTINGS_CERTIFICATE_MANAGER_AUTHORITIES_DESCRIPTION},
- {"certificateManagerOthers", IDS_SETTINGS_CERTIFICATE_MANAGER_OTHERS},
- {"certificateManagerOthersDescription",
- IDS_SETTINGS_CERTIFICATE_MANAGER_OTHERS_DESCRIPTION},
- {"certificateManagerView", IDS_SETTINGS_CERTIFICATE_MANAGER_VIEW},
- {"certificateManagerImport", IDS_SETTINGS_CERTIFICATE_MANAGER_IMPORT},
- {"certificateManagerImportAndBind",
- IDS_SETTINGS_CERTIFICATE_MANAGER_IMPORT_AND_BIND},
- {"certificateManagerExport", IDS_SETTINGS_CERTIFICATE_MANAGER_EXPORT},
- {"certificateManagerDelete", IDS_SETTINGS_DELETE},
- {"certificateManagerUntrusted", IDS_SETTINGS_CERTIFICATE_MANAGER_UNTRUSTED},
- // CA trust edit dialog.
- {"certificateManagerCaTrustEditDialogTitle",
- IDS_SETTINGS_CERTIFICATE_MANAGER_CA_TRUST_EDIT_DIALOG_TITLE},
- {"certificateManagerCaTrustEditDialogDescription",
- IDS_SETTINGS_CERTIFICATE_MANAGER_CA_TRUST_EDIT_DIALOG_DESCRIPTION},
- {"certificateManagerCaTrustEditDialogExplanation",
- IDS_SETTINGS_CERTIFICATE_MANAGER_CA_TRUST_EDIT_DIALOG_EXPLANATION},
- {"certificateManagerCaTrustEditDialogSsl",
- IDS_SETTINGS_CERTIFICATE_MANAGER_CA_TRUST_EDIT_DIALOG_SSL},
- {"certificateManagerCaTrustEditDialogEmail",
- IDS_SETTINGS_CERTIFICATE_MANAGER_CA_TRUST_EDIT_DIALOG_EMAIL},
- {"certificateManagerCaTrustEditDialogObjSign",
- IDS_SETTINGS_CERTIFICATE_MANAGER_CA_TRUST_EDIT_DIALOG_OBJ_SIGN},
- // Certificate delete confirmation dialog.
- {"certificateManagerDeleteUserTitle",
- IDS_SETTINGS_CERTIFICATE_MANAGER_DELETE_USER_TITLE},
- {"certificateManagerDeleteUserDescription",
- IDS_SETTINGS_CERTIFICATE_MANAGER_DELETE_USER_DESCRIPTION},
- {"certificateManagerDeleteServerTitle",
- IDS_SETTINGS_CERTIFICATE_MANAGER_DELETE_SERVER_TITLE},
- {"certificateManagerDeleteServerDescription",
- IDS_SETTINGS_CERTIFICATE_MANAGER_DELETE_SERVER_DESCRIPTION},
- {"certificateManagerDeleteCaTitle",
- IDS_SETTINGS_CERTIFICATE_MANAGER_DELETE_CA_TITLE},
- {"certificateManagerDeleteCaDescription",
- IDS_SETTINGS_CERTIFICATE_MANAGER_DELETE_CA_DESCRIPTION},
- {"certificateManagerDeleteOtherTitle",
- IDS_SETTINGS_CERTIFICATE_MANAGER_DELETE_OTHER_TITLE},
- // Encrypt/decrypt password dialogs.
- {"certificateManagerEncryptPasswordTitle",
- IDS_SETTINGS_CERTIFICATE_MANAGER_ENCRYPT_PASSWORD_TITLE},
- {"certificateManagerDecryptPasswordTitle",
- IDS_SETTINGS_CERTIFICATE_MANAGER_DECRYPT_PASSWORD_TITLE},
- {"certificateManagerEncryptPasswordDescription",
- IDS_SETTINGS_CERTIFICATE_MANAGER_ENCRYPT_PASSWORD_DESCRIPTION},
- {"certificateManagerPassword", IDS_SETTINGS_CERTIFICATE_MANAGER_PASSWORD},
- {"certificateManagerConfirmPassword",
- IDS_SETTINGS_CERTIFICATE_MANAGER_CONFIRM_PASSWORD},
- {"certificateImportErrorFormat",
- IDS_SETTINGS_CERTIFICATE_MANAGER_IMPORT_ERROR_FORMAT},
+ {"certificateManagerExpandA11yLabel",
+ IDS_SETTINGS_CERTIFICATE_MANAGER_EXPAND_ACCESSIBILITY_LABEL},
+ {"certificateManagerNoCertificates",
+ IDS_SETTINGS_CERTIFICATE_MANAGER_NO_CERTIFICATES},
+ {"certificateManagerYourCertificates",
+ IDS_SETTINGS_CERTIFICATE_MANAGER_YOUR_CERTIFICATES},
+ {"certificateManagerYourCertificatesDescription",
+ IDS_SETTINGS_CERTIFICATE_MANAGER_YOUR_CERTIFICATES_DESCRIPTION},
+ {"certificateManagerServers", IDS_SETTINGS_CERTIFICATE_MANAGER_SERVERS},
+ {"certificateManagerServersDescription",
+ IDS_SETTINGS_CERTIFICATE_MANAGER_SERVERS_DESCRIPTION},
+ {"certificateManagerAuthorities",
+ IDS_SETTINGS_CERTIFICATE_MANAGER_AUTHORITIES},
+ {"certificateManagerAuthoritiesDescription",
+ IDS_SETTINGS_CERTIFICATE_MANAGER_AUTHORITIES_DESCRIPTION},
+ {"certificateManagerOthers", IDS_SETTINGS_CERTIFICATE_MANAGER_OTHERS},
+ {"certificateManagerOthersDescription",
+ IDS_SETTINGS_CERTIFICATE_MANAGER_OTHERS_DESCRIPTION},
+ {"certificateManagerView", IDS_SETTINGS_CERTIFICATE_MANAGER_VIEW},
+ {"certificateManagerImport", IDS_SETTINGS_CERTIFICATE_MANAGER_IMPORT},
+ {"certificateManagerImportAndBind",
+ IDS_SETTINGS_CERTIFICATE_MANAGER_IMPORT_AND_BIND},
+ {"certificateManagerExport", IDS_SETTINGS_CERTIFICATE_MANAGER_EXPORT},
+ {"certificateManagerDelete", IDS_SETTINGS_DELETE},
+ {"certificateManagerUntrusted",
+ IDS_SETTINGS_CERTIFICATE_MANAGER_UNTRUSTED},
+ // CA trust edit dialog.
+ {"certificateManagerCaTrustEditDialogTitle",
+ IDS_SETTINGS_CERTIFICATE_MANAGER_CA_TRUST_EDIT_DIALOG_TITLE},
+ {"certificateManagerCaTrustEditDialogDescription",
+ IDS_SETTINGS_CERTIFICATE_MANAGER_CA_TRUST_EDIT_DIALOG_DESCRIPTION},
+ {"certificateManagerCaTrustEditDialogExplanation",
+ IDS_SETTINGS_CERTIFICATE_MANAGER_CA_TRUST_EDIT_DIALOG_EXPLANATION},
+ {"certificateManagerCaTrustEditDialogSsl",
+ IDS_SETTINGS_CERTIFICATE_MANAGER_CA_TRUST_EDIT_DIALOG_SSL},
+ {"certificateManagerCaTrustEditDialogEmail",
+ IDS_SETTINGS_CERTIFICATE_MANAGER_CA_TRUST_EDIT_DIALOG_EMAIL},
+ {"certificateManagerCaTrustEditDialogObjSign",
+ IDS_SETTINGS_CERTIFICATE_MANAGER_CA_TRUST_EDIT_DIALOG_OBJ_SIGN},
+ // Certificate delete confirmation dialog.
+ {"certificateManagerDeleteUserTitle",
+ IDS_SETTINGS_CERTIFICATE_MANAGER_DELETE_USER_TITLE},
+ {"certificateManagerDeleteUserDescription",
+ IDS_SETTINGS_CERTIFICATE_MANAGER_DELETE_USER_DESCRIPTION},
+ {"certificateManagerDeleteServerTitle",
+ IDS_SETTINGS_CERTIFICATE_MANAGER_DELETE_SERVER_TITLE},
+ {"certificateManagerDeleteServerDescription",
+ IDS_SETTINGS_CERTIFICATE_MANAGER_DELETE_SERVER_DESCRIPTION},
+ {"certificateManagerDeleteCaTitle",
+ IDS_SETTINGS_CERTIFICATE_MANAGER_DELETE_CA_TITLE},
+ {"certificateManagerDeleteCaDescription",
+ IDS_SETTINGS_CERTIFICATE_MANAGER_DELETE_CA_DESCRIPTION},
+ {"certificateManagerDeleteOtherTitle",
+ IDS_SETTINGS_CERTIFICATE_MANAGER_DELETE_OTHER_TITLE},
+ // Encrypt/decrypt password dialogs.
+ {"certificateManagerEncryptPasswordTitle",
+ IDS_SETTINGS_CERTIFICATE_MANAGER_ENCRYPT_PASSWORD_TITLE},
+ {"certificateManagerDecryptPasswordTitle",
+ IDS_SETTINGS_CERTIFICATE_MANAGER_DECRYPT_PASSWORD_TITLE},
+ {"certificateManagerEncryptPasswordDescription",
+ IDS_SETTINGS_CERTIFICATE_MANAGER_ENCRYPT_PASSWORD_DESCRIPTION},
+ {"certificateManagerPassword", IDS_SETTINGS_CERTIFICATE_MANAGER_PASSWORD},
+ {"certificateManagerConfirmPassword",
+ IDS_SETTINGS_CERTIFICATE_MANAGER_CONFIRM_PASSWORD},
+ {"certificateImportErrorFormat",
+ IDS_SETTINGS_CERTIFICATE_MANAGER_IMPORT_ERROR_FORMAT},
#if BUILDFLAG(IS_CHROMEOS)
- {"certificateProvisioningListHeader",
- IDS_SETTINGS_CERTIFICATE_MANAGER_PROVISIONING_LIST_HEADER},
- {"certificateProvisioningRefresh",
- IDS_SETTINGS_CERTIFICATE_MANAGER_PROVISIONING_REFRESH},
- {"certificateProvisioningReset",
- IDS_SETTINGS_CERTIFICATE_MANAGER_PROVISIONING_RESET},
- {"certificateProvisioningDetails",
- IDS_SETTINGS_CERTIFICATE_MANAGER_PROVISIONING_DETAILS},
- {"certificateProvisioningAdvancedSectionTitle",
- IDS_SETTINGS_CERTIFICATE_MANAGER_PROVISIONING_ADVANCED},
- {"certificateProvisioningProfileName",
- IDS_SETTINGS_CERTIFICATE_MANAGER_PROVISIONING_CERTIFICATE_PROFILE_NAME},
- {"certificateProvisioningProfileId",
- IDS_SETTINGS_CERTIFICATE_MANAGER_PROVISIONING_CERTIFICATE_PROFILE_ID},
- {"certificateProvisioningStatus",
- IDS_SETTINGS_CERTIFICATE_MANAGER_PROVISIONING_STATUS},
- {"certificateProvisioningStatusId",
- IDS_SETTINGS_CERTIFICATE_MANAGER_PROVISIONING_STATUS_ID},
- {"certificateProvisioningLastUpdate",
- IDS_SETTINGS_CERTIFICATE_MANAGER_PROVISIONING_LAST_UPDATE},
- {"certificateProvisioningLastUnsuccessfulStatus",
- IDS_SETTINGS_CERTIFICATE_MANAGER_PROVISIONING_LAST_UNSUCCESSFUL_STATUS},
- {"certificateProvisioningPublicKey", IDS_CERT_DETAILS_SUBJECT_KEY},
+ {"certificateProvisioningListHeader",
+ IDS_SETTINGS_CERTIFICATE_MANAGER_PROVISIONING_LIST_HEADER},
+ {"certificateProvisioningRefresh",
+ IDS_SETTINGS_CERTIFICATE_MANAGER_PROVISIONING_REFRESH},
+ {"certificateProvisioningReset",
+ IDS_SETTINGS_CERTIFICATE_MANAGER_PROVISIONING_RESET},
+ {"certificateProvisioningDetails",
+ IDS_SETTINGS_CERTIFICATE_MANAGER_PROVISIONING_DETAILS},
+ {"certificateProvisioningAdvancedSectionTitle",
+ IDS_SETTINGS_CERTIFICATE_MANAGER_PROVISIONING_ADVANCED},
+ {"certificateProvisioningProfileName",
+ IDS_SETTINGS_CERTIFICATE_MANAGER_PROVISIONING_CERTIFICATE_PROFILE_NAME},
+ {"certificateProvisioningProfileId",
+ IDS_SETTINGS_CERTIFICATE_MANAGER_PROVISIONING_CERTIFICATE_PROFILE_ID},
+ {"certificateProvisioningStatus",
+ IDS_SETTINGS_CERTIFICATE_MANAGER_PROVISIONING_STATUS},
+ {"certificateProvisioningStatusId",
+ IDS_SETTINGS_CERTIFICATE_MANAGER_PROVISIONING_STATUS_ID},
+ {"certificateProvisioningLastUpdate",
+ IDS_SETTINGS_CERTIFICATE_MANAGER_PROVISIONING_LAST_UPDATE},
+ {"certificateProvisioningLastUnsuccessfulStatus",
+ IDS_SETTINGS_CERTIFICATE_MANAGER_PROVISIONING_LAST_UNSUCCESSFUL_STATUS},
+ {"certificateProvisioningPublicKey", IDS_CERT_DETAILS_SUBJECT_KEY},
#endif // BUILDFLAG(IS_CHROMEOS)
- // For A11y.
- {"menu", IDS_MENU},
+ // For A11y.
+ {"menu", IDS_MENU},
};
html_source->AddLocalizedStrings(kLocalizedStrings);
}
diff --git a/chrome/browser/ui/webui/certificate_provisioning_ui_handler.cc b/chrome/browser/ui/webui/certificate_provisioning_ui_handler.cc
index faf9a5af..1742a65 100644
--- a/chrome/browser/ui/webui/certificate_provisioning_ui_handler.cc
+++ b/chrome/browser/ui/webui/certificate_provisioning_ui_handler.cc
@@ -2,15 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include <string>
-
-#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/ui/webui/certificate_provisioning_ui_handler.h"
+#include <string>
+
#include "base/check_is_test.h"
#include "base/containers/span.h"
#include "base/functional/bind.h"
#include "base/i18n/time_formatting.h"
+#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_process_platform_part.h"
@@ -121,8 +121,9 @@
// "5 minutes ago".
std::u16string GetTimeSinceLastUpdate(base::Time last_update_time) {
const base::Time now = base::Time::NowFromSystemTime();
- if (last_update_time.is_null() || last_update_time > now)
+ if (last_update_time.is_null() || last_update_time > now) {
return std::u16string();
+ }
const base::TimeDelta elapsed_time = now - last_update_time;
return ui::TimeFormat::Simple(ui::TimeFormat::FORMAT_ELAPSED,
ui::TimeFormat::LENGTH_SHORT, elapsed_time);
@@ -130,8 +131,9 @@
std::u16string GetMessageFromBackendError(
const crosapi::mojom::CertProvisioningBackendServerErrorPtr& call_info) {
- if (!call_info)
+ if (!call_info) {
return std::u16string();
+ }
std::u16string time_u16 =
base::UTF8ToUTF16(base::TimeFormatHTTP(call_info->time));
@@ -189,8 +191,9 @@
void CertificateProvisioningUiHandler::OnStateChanged() {
// If Javascript is not allowed yet, the UI will request a refresh during its
// first message to the handler.
- if (!IsJavascriptAllowed())
+ if (!IsJavascriptAllowed()) {
return;
+ }
RefreshCertificateProvisioningProcesses();
}
diff --git a/chrome/browser/ui/webui/certificate_provisioning_ui_handler_unittest.cc b/chrome/browser/ui/webui/certificate_provisioning_ui_handler_unittest.cc
index de24ca1..97ab4565 100644
--- a/chrome/browser/ui/webui/certificate_provisioning_ui_handler_unittest.cc
+++ b/chrome/browser/ui/webui/certificate_provisioning_ui_handler_unittest.cc
@@ -96,16 +96,19 @@
return;
}
if (value->is_list()) {
- for (base::Value& child : value->GetList())
+ for (base::Value& child : value->GetList()) {
FormatDictRecurse(&child, messages);
+ }
return;
}
- if (!value->is_string())
+ if (!value->is_string()) {
return;
+ }
for (size_t i = 0; i < messages.size(); ++i) {
std::string placeholder = std::string("$") + base::NumberToString(i);
- if (value->GetString() != placeholder)
+ if (value->GetString() != placeholder) {
continue;
+ }
*value = base::Value(messages[i]);
}
}
@@ -125,8 +128,9 @@
base::Value GetByProfileId(const base::Value& all_processes,
const std::string& profile_id) {
for (const base::Value& process : all_processes.GetList()) {
- if (profile_id == *process.GetDict().FindString("certProfileId"))
+ if (profile_id == *process.GetDict().FindString("certProfileId")) {
return process.Clone();
+ }
}
return base::Value();
}
@@ -187,8 +191,9 @@
*out_all_processes = std::move(args[0]);
// Extract all profile ids for easier verification.
- if (!out_profile_ids)
+ if (!out_profile_ids) {
return;
+ }
out_profile_ids->clear();
for (const base::Value& process : out_all_processes->GetList()) {
const std::string* profile_id =
diff --git a/chrome/browser/ui/webui/certificates_handler.cc b/chrome/browser/ui/webui/certificates_handler.cc
index 669483f..48238d7 100644
--- a/chrome/browser/ui/webui/certificates_handler.cc
+++ b/chrome/browser/ui/webui/certificates_handler.cc
@@ -91,13 +91,16 @@
std::u16string a_str;
std::u16string b_str;
const std::string* ptr = a_dict.FindString(kCertificatesHandlerNameField);
- if (ptr)
+ if (ptr) {
a_str = base::UTF8ToUTF16(*ptr);
+ }
ptr = b_dict.FindString(kCertificatesHandlerNameField);
- if (ptr)
+ if (ptr) {
b_str = base::UTF8ToUTF16(*ptr);
- if (collator_ == nullptr)
+ }
+ if (collator_ == nullptr) {
return a_str < b_str;
+ }
return base::i18n::CompareString16WithCollator(*collator_, a_str, b_str) ==
UCOL_LESS;
}
@@ -149,12 +152,14 @@
// Therefore PFX can be distingushed by checking if the file starts with an
// indefinite SEQUENCE, or a definite SEQUENCE { INTEGER, ... }.
bool CouldBePFX(std::string_view data) {
- if (data.size() < 4)
+ if (data.size() < 4) {
return false;
+ }
// Indefinite length SEQUENCE.
- if (data[0] == 0x30 && static_cast<uint8_t>(data[1]) == 0x80)
+ if (data[0] == 0x30 && static_cast<uint8_t>(data[1]) == 0x80) {
return true;
+ }
// If the SEQUENCE is definite length, it can be parsed through the version
// tag using DER parser, since INTEGER must be definite length, even in BER.
@@ -278,8 +283,9 @@
file_access_provider_(base::MakeRefCounted<FileAccessProvider>()) {}
CertificatesHandler::~CertificatesHandler() {
- if (select_file_dialog_.get())
+ if (select_file_dialog_.get()) {
select_file_dialog_->ListenerDestroyed();
+ }
select_file_dialog_.reset();
}
@@ -401,8 +407,9 @@
void CertificatesHandler::HandleViewCertificate(const base::Value::List& args) {
CertificateManagerModel::CertInfo* cert_info =
GetCertInfoFromCallbackArgs(args, 0 /* arg_index */);
- if (!cert_info)
+ if (!cert_info) {
return;
+ }
net::ScopedCERTCertificateList certs;
certs.push_back(net::x509_util::DupCERTCertificate(cert_info->cert()));
CertificateViewerDialog::ShowConstrained(
@@ -411,8 +418,9 @@
bool CertificatesHandler::AssignWebUICallbackId(const base::Value::List& args) {
CHECK_LE(1U, args.size());
- if (!webui_callback_id_.empty())
+ if (!webui_callback_id_.empty()) {
return false;
+ }
webui_callback_id_ = args[0].GetString();
return true;
}
@@ -428,8 +436,9 @@
CertificateManagerModel::CertInfo* cert_info =
GetCertInfoFromCallbackArgs(args, 1 /* arg_index */);
- if (!cert_info)
+ if (!cert_info) {
return;
+ }
net::NSSCertDatabase::TrustBits trust_bits =
certificate_manager_model_->cert_db()->GetCertTrust(cert_info->cert(),
@@ -457,8 +466,9 @@
CertificateManagerModel::CertInfo* cert_info =
GetCertInfoFromCallbackArgs(args, 1 /* arg_index */);
- if (!cert_info)
+ if (!cert_info) {
return;
+ }
if (!CanEditCertificate(cert_info)) {
RejectCallbackWithError(
@@ -492,8 +502,9 @@
void CertificatesHandler::HandleExportPersonal(const base::Value::List& args) {
// Early return if the select file dialog is already active.
- if (select_file_dialog_)
+ if (select_file_dialog_) {
return;
+ }
CHECK_EQ(2U, args.size());
if (!AssignWebUICallbackId(args)) {
@@ -503,8 +514,9 @@
CertificateManagerModel::CertInfo* cert_info =
GetCertInfoFromCallbackArgs(args, 1 /* arg_index */);
- if (!cert_info)
+ if (!cert_info) {
return;
+ }
selected_cert_list_.push_back(
net::x509_util::DupCERTCertificate(cert_info->cert()));
@@ -590,8 +602,9 @@
void CertificatesHandler::HandleImportPersonal(const base::Value::List& args) {
// Early return if the select file dialog is already active.
- if (select_file_dialog_)
+ if (select_file_dialog_) {
return;
+ }
// When the "allowed" value changes while user on the certificate manager
// page, the UI doesn't update without page refresh and user can still see and
@@ -767,16 +780,18 @@
// There may be pending file dialogs, we need to tell them that we've gone
// away so they don't try and call back to us.
- if (select_file_dialog_.get())
+ if (select_file_dialog_.get()) {
select_file_dialog_->ListenerDestroyed();
+ }
select_file_dialog_.reset();
pending_operation_ = std::nullopt;
}
void CertificatesHandler::HandleImportServer(const base::Value::List& args) {
// Early return if the select file dialog is already active.
- if (select_file_dialog_)
+ if (select_file_dialog_) {
return;
+ }
CHECK_EQ(1U, args.size());
if (!AssignWebUICallbackId(args)) {
@@ -851,8 +866,9 @@
void CertificatesHandler::HandleImportCA(const base::Value::List& args) {
// Early return if the select file dialog is already active.
- if (select_file_dialog_)
+ if (select_file_dialog_) {
return;
+ }
// When the "allowed" value changes while user on the certificate manager
// page, the UI doesn't update without page refresh and user can still see and
@@ -964,8 +980,9 @@
const base::Value::List& args) {
CertificateManagerModel::CertInfo* cert_info =
GetCertInfoFromCallbackArgs(args, 0 /* arg_index */);
- if (!cert_info)
+ if (!cert_info) {
return;
+ }
net::ScopedCERTCertificateList export_certs;
export_certs.push_back(net::x509_util::DupCERTCertificate(cert_info->cert()));
@@ -983,8 +1000,9 @@
CertificateManagerModel::CertInfo* cert_info =
GetCertInfoFromCallbackArgs(args, 1 /* arg_index */);
- if (!cert_info)
+ if (!cert_info) {
return;
+ }
if (!CanDeleteCertificate(cert_info)) {
RejectCallbackWithError(
@@ -1063,8 +1081,9 @@
UErrorCode error = U_ZERO_ERROR;
collator.reset(icu::Collator::createInstance(
icu::Locale(g_browser_process->GetApplicationLocale().c_str()), error));
- if (U_FAILURE(error))
+ if (U_FAILURE(error)) {
collator.reset();
+ }
DictionaryIdComparator comparator(collator.get());
CertificateManagerModel::OrgGroupingMap org_grouping_map;
@@ -1155,15 +1174,16 @@
const std::string& title,
const net::NSSCertDatabase::ImportCertFailureList& not_imported) {
std::string error;
- if (selected_cert_list_.size() == 1)
+ if (selected_cert_list_.size() == 1) {
error = l10n_util::GetStringUTF8(
IDS_SETTINGS_CERTIFICATE_MANAGER_IMPORT_SINGLE_NOT_IMPORTED);
- else if (not_imported.size() == selected_cert_list_.size())
+ } else if (not_imported.size() == selected_cert_list_.size()) {
error = l10n_util::GetStringUTF8(
IDS_SETTINGS_CERTIFICATE_MANAGER_IMPORT_ALL_NOT_IMPORTED);
- else
+ } else {
error = l10n_util::GetStringUTF8(
IDS_SETTINGS_CERTIFICATE_MANAGER_IMPORT_SOME_NOT_IMPORTED);
+ }
base::Value::List cert_error_list;
for (const auto& failure : not_imported) {
@@ -1190,15 +1210,18 @@
CertificateManagerModel::CertInfo*
CertificatesHandler::GetCertInfoFromCallbackArgs(const base::Value::List& args,
size_t arg_index) {
- if (arg_index >= args.size())
+ if (arg_index >= args.size()) {
return nullptr;
+ }
const auto& arg = args[arg_index];
- if (!arg.is_string())
+ if (!arg.is_string()) {
return nullptr;
+ }
int32_t cert_info_id = 0;
- if (!base::StringToInt(arg.GetString(), &cert_info_id))
+ if (!base::StringToInt(arg.GetString(), &cert_info_id)) {
return nullptr;
+ }
return cert_info_id_map_.Lookup(cert_info_id);
}
diff --git a/chrome/browser/ui/webui/chrome_url_data_manager_browsertest.cc b/chrome/browser/ui/webui/chrome_url_data_manager_browsertest.cc
index 4e9aa10c..543f7e09 100644
--- a/chrome/browser/ui/webui/chrome_url_data_manager_browsertest.cc
+++ b/chrome/browser/ui/webui/chrome_url_data_manager_browsertest.cc
@@ -509,8 +509,8 @@
#endif
#if BUILDFLAG(ENABLE_DICE_SUPPORT)
"chrome://signin-dice-web-intercept.top-chrome/?debug",
- // Note: Disabled because a DCHECK fires when directly visiting the URL.
- // "chrome://signin-reauth",
+// Note: Disabled because a DCHECK fires when directly visiting the URL.
+// "chrome://signin-reauth",
#endif
#if BUILDFLAG(IS_CHROMEOS_ASH)
// TODO(crbug.com/40250068): Uncomment when TrustedTypes are enabled.
diff --git a/chrome/browser/ui/webui/chrome_web_contents_handler.cc b/chrome/browser/ui/webui/chrome_web_contents_handler.cc
index 8d16b0b..edf38d2 100644
--- a/chrome/browser/ui/webui/chrome_web_contents_handler.cc
+++ b/chrome/browser/ui/webui/chrome_web_contents_handler.cc
@@ -38,8 +38,9 @@
const OpenURLParams& params,
base::OnceCallback<void(content::NavigationHandle&)>
navigation_handle_callback) {
- if (!context)
+ if (!context) {
return nullptr;
+ }
Profile* profile = Profile::FromBrowserContext(context);
@@ -73,8 +74,9 @@
}
// Close the browser if chrome::Navigate created a new one.
- if (browser_created && (browser != nav_params.browser))
+ if (browser_created && (browser != nav_params.browser)) {
browser->window()->Close();
+ }
return nav_params.navigated_or_inserted_contents;
}
@@ -93,8 +95,9 @@
WindowOpenDisposition disposition,
const blink::mojom::WindowFeatures& window_features,
bool user_gesture) {
- if (!context)
+ if (!context) {
return;
+ }
Profile* profile = Profile::FromBrowserContext(context);
@@ -119,8 +122,9 @@
Navigate(¶ms);
// Close the browser if chrome::Navigate created a new one.
- if (browser_created && (browser != params.browser))
+ if (browser_created && (browser != params.browser)) {
browser->window()->Close();
+ }
}
void ChromeWebContentsHandler::RunFileChooser(
diff --git a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
index 7231a00..e66f2c1 100644
--- a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
+++ b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
@@ -259,8 +259,9 @@
const GURL& url) {
Profile* profile = Profile::FromWebUI(web_ui);
WebUIFactoryFunction function = GetWebUIFactoryFunction(web_ui, profile, url);
- if (!function)
+ if (!function) {
return nullptr;
+ }
return base::WrapUnique((*function)(web_ui, url));
}
@@ -371,22 +372,27 @@
}
#endif
- if (!content::HasWebUIScheme(page_url))
+ if (!content::HasWebUIScheme(page_url)) {
return nullptr;
+ }
- if (page_url.host_piece() == chrome::kChromeUIComponentsHost)
+ if (page_url.host_piece() == chrome::kChromeUIComponentsHost) {
return ComponentsUI::GetFaviconResourceBytes(scale_factor);
+ }
#if BUILDFLAG(IS_WIN)
- if (page_url.host_piece() == chrome::kChromeUIConflictsHost)
+ if (page_url.host_piece() == chrome::kChromeUIConflictsHost) {
return ConflictsUI::GetFaviconResourceBytes(scale_factor);
+ }
#endif
- if (page_url.host_piece() == chrome::kChromeUICrashesHost)
+ if (page_url.host_piece() == chrome::kChromeUICrashesHost) {
return CrashesUI::GetFaviconResourceBytes(scale_factor);
+ }
- if (page_url.host_piece() == chrome::kChromeUIFlagsHost)
+ if (page_url.host_piece() == chrome::kChromeUIFlagsHost) {
return FlagsUI::GetFaviconResourceBytes(scale_factor);
+ }
#if !BUILDFLAG(IS_ANDROID)
#if !BUILDFLAG(IS_CHROMEOS)
@@ -396,35 +402,42 @@
}
#endif // !BUILDFLAG(IS_CHROMEOS)
- if (page_url.host_piece() == chrome::kChromeUINewTabPageHost)
+ if (page_url.host_piece() == chrome::kChromeUINewTabPageHost) {
return NewTabPageUI::GetFaviconResourceBytes(scale_factor);
+ }
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
- if (page_url.host_piece() == chrome::kChromeUIWhatsNewHost)
+ if (page_url.host_piece() == chrome::kChromeUIWhatsNewHost) {
return WhatsNewUI::GetFaviconResourceBytes(scale_factor);
+ }
#endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
// Bookmarks are part of NTP on Android.
- if (page_url.host_piece() == chrome::kChromeUIBookmarksHost)
+ if (page_url.host_piece() == chrome::kChromeUIBookmarksHost) {
return BookmarksUI::GetFaviconResourceBytes(scale_factor);
+ }
- if (page_url.host_piece() == chrome::kChromeUIHistoryHost)
+ if (page_url.host_piece() == chrome::kChromeUIHistoryHost) {
return HistoryUI::GetFaviconResourceBytes(scale_factor);
+ }
- if (page_url.host_piece() == password_manager::kChromeUIPasswordManagerHost)
+ if (page_url.host_piece() == password_manager::kChromeUIPasswordManagerHost) {
return PasswordManagerUI::GetFaviconResourceBytes(scale_factor);
+ }
// Android uses the native download manager.
- if (page_url.host_piece() == chrome::kChromeUIDownloadsHost)
+ if (page_url.host_piece() == chrome::kChromeUIDownloadsHost) {
return DownloadsUI::GetFaviconResourceBytes(scale_factor);
+ }
// Android doesn't use the Options/Settings pages.
if (page_url.host_piece() == chrome::kChromeUISettingsHost) {
return settings_utils::GetFaviconResourceBytes(scale_factor);
}
- if (page_url.host_piece() == chrome::kChromeUIManagementHost)
+ if (page_url.host_piece() == chrome::kChromeUIManagementHost) {
return ManagementUI::GetFaviconResourceBytes(scale_factor);
+ }
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
BUILDFLAG(IS_CHROMEOS)
@@ -443,8 +456,9 @@
#endif // !BUILDFLAG(IS_ANDROID)
#if BUILDFLAG(IS_CHROMEOS)
- if (page_url.host_piece() == chrome::kChromeUIOSSettingsHost)
+ if (page_url.host_piece() == chrome::kChromeUIOSSettingsHost) {
return settings_utils::GetFaviconResourceBytes(scale_factor);
+ }
#endif // BUILDFLAG(IS_CHROMEOS)
return nullptr;
diff --git a/chrome/browser/ui/webui/commerce/commerce_internals_ui_config.cc b/chrome/browser/ui/webui/commerce/commerce_internals_ui_config.cc
index 2e54256d..52bddd9 100644
--- a/chrome/browser/ui/webui/commerce/commerce_internals_ui_config.cc
+++ b/chrome/browser/ui/webui/commerce/commerce_internals_ui_config.cc
@@ -27,8 +27,7 @@
Profile* profile = Profile::FromWebUI(web_ui);
return std::make_unique<CommerceInternalsUI>(
- web_ui,
- commerce::ShoppingServiceFactory::GetForBrowserContext(profile));
+ web_ui, commerce::ShoppingServiceFactory::GetForBrowserContext(profile));
}
} // namespace commerce
diff --git a/chrome/browser/ui/webui/components/components_ui.cc b/chrome/browser/ui/webui/components/components_ui.cc
index 4b3670c..2c8082e 100644
--- a/chrome/browser/ui/webui/components/components_ui.cc
+++ b/chrome/browser/ui/webui/components/components_ui.cc
@@ -47,13 +47,13 @@
source->EnableReplaceI18nInJS();
static constexpr webui::LocalizedString kStrings[] = {
- {"componentsTitle", IDS_COMPONENTS_TITLE},
- {"componentsNoneInstalled", IDS_COMPONENTS_NONE_INSTALLED},
- {"componentVersion", IDS_COMPONENTS_VERSION},
- {"checkUpdate", IDS_COMPONENTS_CHECK_FOR_UPDATE},
- {"noComponents", IDS_COMPONENTS_NO_COMPONENTS},
- {"statusLabel", IDS_COMPONENTS_STATUS_LABEL},
- {"checkingLabel", IDS_COMPONENTS_CHECKING_LABEL},
+ {"componentsTitle", IDS_COMPONENTS_TITLE},
+ {"componentsNoneInstalled", IDS_COMPONENTS_NONE_INSTALLED},
+ {"componentVersion", IDS_COMPONENTS_VERSION},
+ {"checkUpdate", IDS_COMPONENTS_CHECK_FOR_UPDATE},
+ {"noComponents", IDS_COMPONENTS_NO_COMPONENTS},
+ {"statusLabel", IDS_COMPONENTS_STATUS_LABEL},
+ {"checkingLabel", IDS_COMPONENTS_CHECKING_LABEL},
};
source->AddLocalizedStrings(kStrings);
diff --git a/chrome/browser/ui/webui/compose/compose_untrusted_ui.cc b/chrome/browser/ui/webui/compose/compose_untrusted_ui.cc
index b35460b..31ef40b 100644
--- a/chrome/browser/ui/webui/compose/compose_untrusted_ui.cc
+++ b/chrome/browser/ui/webui/compose/compose_untrusted_ui.cc
@@ -119,9 +119,9 @@
"enableOnDeviceDogfoodFooter",
base::FeatureList::IsEnabled(
compose::features::kEnableComposeOnDeviceDogfoodFooter));
- source->AddBoolean(
- "enableUpfrontInputModes",
- base::FeatureList::IsEnabled(compose::features::kComposeUpfrontInputModes));
+ source->AddBoolean("enableUpfrontInputModes",
+ base::FeatureList::IsEnabled(
+ compose::features::kComposeUpfrontInputModes));
source->OverrideContentSecurityPolicy(
network::mojom::CSPDirectiveName::StyleSrc,
diff --git a/chrome/browser/ui/webui/conflicts/conflicts_data_fetcher.cc b/chrome/browser/ui/webui/conflicts/conflicts_data_fetcher.cc
index ec754d6..85c2ade 100644
--- a/chrome/browser/ui/webui/conflicts/conflicts_data_fetcher.cc
+++ b/chrome/browser/ui/webui/conflicts/conflicts_data_fetcher.cc
@@ -29,14 +29,17 @@
std::string GetProcessTypesString(const ModuleInfoData& module_data) {
uint32_t process_types = module_data.process_types;
- if (!process_types)
+ if (!process_types) {
return "None";
+ }
std::string result;
- if (process_types & ProcessTypeToBit(content::PROCESS_TYPE_BROWSER))
+ if (process_types & ProcessTypeToBit(content::PROCESS_TYPE_BROWSER)) {
result.append("B");
- if (process_types & ProcessTypeToBit(content::PROCESS_TYPE_RENDERER))
+ }
+ if (process_types & ProcessTypeToBit(content::PROCESS_TYPE_RENDERER)) {
result.append("R");
+ }
// TODO(pmonette): Add additional process types as more get supported.
return result;
@@ -66,8 +69,9 @@
#endif
void AppendString(std::string_view input, std::string* output) {
- if (!output->empty())
+ if (!output->empty()) {
*output += ", ";
+ }
output->append(input);
}
@@ -79,14 +83,17 @@
// Output status regarding the blocklist cache, current blocking, and
// load status.
- if (blocking_state.was_blocked)
+ if (blocking_state.was_blocked) {
status = "Blocked";
- if (!blocking_state.was_loaded)
+ }
+ if (!blocking_state.was_loaded) {
AppendString(kNotLoaded, &status);
- else if (blocking_state.was_in_blocklist_cache)
+ } else if (blocking_state.was_in_blocklist_cache) {
AppendString("Bypassed blocking", &status);
- if (blocking_state.was_in_blocklist_cache)
+ }
+ if (blocking_state.was_in_blocklist_cache) {
AppendString("In blocklist cache", &status);
+ }
return status;
}
@@ -124,8 +131,9 @@
// This is a module explicitly allowed to load by the Module List
// component. But it is still valid for a potential warning, and so the
// warning status is used instead.
- if (incompatible_applications_updater)
+ if (incompatible_applications_updater) {
break;
+ }
return "Tolerated - Will be blocked in the future";
case BlockingDecision::kDisallowedExplicit:
return "Disallowed - Explicitly blocklisted";
@@ -183,8 +191,9 @@
const ModuleInfoKey& module_key,
IncompatibleApplicationsUpdater* incompatible_applications_updater,
ModuleBlocklistCacheUpdater* module_blocklist_cache_updater) {
- if (!incompatible_applications_updater && !module_blocklist_cache_updater)
+ if (!incompatible_applications_updater && !module_blocklist_cache_updater) {
return std::string();
+ }
std::string status;
@@ -261,8 +270,9 @@
}
}
- if (!ModuleDatabase::IsThirdPartyBlockingPolicyEnabled())
+ if (!ModuleDatabase::IsThirdPartyBlockingPolicyEnabled()) {
return kPolicyDisabled;
+ }
if (!IncompatibleApplicationsUpdater::IsWarningEnabled() &&
!ModuleBlocklistCacheUpdater::IsBlockingEnabled()) {
@@ -337,8 +347,9 @@
ConflictsDataFetcher::~ConflictsDataFetcher() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
- if (module_list_.has_value())
+ if (module_list_.has_value()) {
ModuleDatabase::GetInstance()->RemoveObserver(this);
+ }
}
// static
@@ -434,8 +445,9 @@
#endif // BUILDFLAG(GOOGLE_CHROME_BRANDING)
std::string type_string;
- if (module_data.module_properties & ModuleInfoData::kPropertyShellExtension)
+ if (module_data.module_properties & ModuleInfoData::kPropertyShellExtension) {
type_string = "Shell extension";
+ }
data.Set("type_description", type_string);
const auto& inspection_result = *module_data.inspection_result;
diff --git a/chrome/browser/ui/webui/constrained_web_dialog_ui.cc b/chrome/browser/ui/webui/constrained_web_dialog_ui.cc
index 78a92cd..e6852a76 100644
--- a/chrome/browser/ui/webui/constrained_web_dialog_ui.cc
+++ b/chrome/browser/ui/webui/constrained_web_dialog_ui.cc
@@ -43,7 +43,8 @@
: public base::SupportsUserData::Data {
public:
explicit ConstrainedWebDialogDelegateUserData(
- ConstrainedWebDialogDelegate* delegate) : delegate_(delegate) {}
+ ConstrainedWebDialogDelegate* delegate)
+ : delegate_(delegate) {}
~ConstrainedWebDialogDelegateUserData() override = default;
ConstrainedWebDialogDelegateUserData(
const ConstrainedWebDialogDelegateUserData&) = delete;
@@ -76,8 +77,9 @@
base::Unretained(this)));
ConstrainedWebDialogDelegate* delegate = GetConstrainedDelegate();
- if (!delegate)
+ if (!delegate) {
return;
+ }
ui::WebDialogDelegate* dialog_delegate = delegate->GetWebDialogDelegate();
std::vector<WebUIMessageHandler*> handlers;
@@ -94,8 +96,9 @@
void ConstrainedWebDialogUI::OnDialogCloseMessage(
const base::Value::List& args) {
ConstrainedWebDialogDelegate* delegate = GetConstrainedDelegate();
- if (!delegate)
+ if (!delegate) {
return;
+ }
std::string json_retval;
if (!args.empty()) {
@@ -129,8 +132,8 @@
ConstrainedWebDialogDelegate* ConstrainedWebDialogUI::GetConstrainedDelegate() {
ConstrainedWebDialogDelegateUserData* user_data =
static_cast<ConstrainedWebDialogDelegateUserData*>(
- web_ui()->GetWebContents()->
- GetUserData(&kConstrainedWebDialogDelegateUserDataKey));
+ web_ui()->GetWebContents()->GetUserData(
+ &kConstrainedWebDialogDelegateUserDataKey));
return user_data ? user_data->delegate() : nullptr;
}
diff --git a/chrome/browser/ui/webui/constrained_web_dialog_ui.h b/chrome/browser/ui/webui/constrained_web_dialog_ui.h
index 8e7190b..9c994df 100644
--- a/chrome/browser/ui/webui/constrained_web_dialog_ui.h
+++ b/chrome/browser/ui/webui/constrained_web_dialog_ui.h
@@ -18,7 +18,7 @@
namespace content {
class BrowserContext;
class WebContents;
-}
+} // namespace content
namespace ui {
class WebDialogDelegate;
diff --git a/chrome/browser/ui/webui/constrained_web_dialog_ui_browsertest.cc b/chrome/browser/ui/webui/constrained_web_dialog_ui_browsertest.cc
index 724c445e..760e26c 100644
--- a/chrome/browser/ui/webui/constrained_web_dialog_ui_browsertest.cc
+++ b/chrome/browser/ui/webui/constrained_web_dialog_ui_browsertest.cc
@@ -35,7 +35,8 @@
namespace {
-static const char kTestDataURL[] = "data:text/html,<!doctype html>"
+static const char kTestDataURL[] =
+ "data:text/html,<!doctype html>"
"<body></body>"
"<style>"
"body { height: 150px; width: 150px; }"
@@ -47,8 +48,10 @@
}
std::string GetChangeDimensionsScript(int dimension) {
- return base::StringPrintf("window.document.body.style.width = %d + 'px';"
- "window.document.body.style.height = %d + 'px';", dimension, dimension);
+ return base::StringPrintf(
+ "window.document.body.style.width = %d + 'px';"
+ "window.document.body.style.height = %d + 'px';",
+ dimension, dimension);
}
class AutoResizingTestWebDialogDelegate
diff --git a/chrome/browser/ui/webui/cr_components/most_visited/most_visited_handler.cc b/chrome/browser/ui/webui/cr_components/most_visited/most_visited_handler.cc
index 916a519b..cb2418f 100644
--- a/chrome/browser/ui/webui/cr_components/most_visited/most_visited_handler.cc
+++ b/chrome/browser/ui/webui/cr_components/most_visited/most_visited_handler.cc
@@ -312,6 +312,7 @@
}
void MostVisitedHandler::OnDestroyed() {
- if (preinstalled_web_app_observer_.IsObserving())
+ if (preinstalled_web_app_observer_.IsObserving()) {
preinstalled_web_app_observer_.Reset();
+ }
}
diff --git a/chrome/browser/ui/webui/data_sharing/data_sharing_page_handler.cc b/chrome/browser/ui/webui/data_sharing/data_sharing_page_handler.cc
index 78c770a..e2d908a 100644
--- a/chrome/browser/ui/webui/data_sharing/data_sharing_page_handler.cc
+++ b/chrome/browser/ui/webui/data_sharing/data_sharing_page_handler.cc
@@ -46,8 +46,8 @@
}
void DataSharingPageHandler::CloseUI(int status_code) {
- // TODO(crbug.com/368634445): In addition to closing the WebUI bubble some special
- // codes should trigger follow up native info dialogs.
+ // TODO(crbug.com/368634445): In addition to closing the WebUI bubble some
+ // special codes should trigger follow up native info dialogs.
auto embedder = webui_controller_->embedder();
if (embedder) {
embedder->CloseUI();
diff --git a/chrome/browser/ui/webui/devtools/devtools_ui.cc b/chrome/browser/ui/webui/devtools/devtools_ui.cc
index 372fdaa..9b2a07a 100644
--- a/chrome/browser/ui/webui/devtools/devtools_ui.cc
+++ b/chrome/browser/ui/webui/devtools/devtools_ui.cc
@@ -22,10 +22,12 @@
GURL DevToolsUI::GetProxyURL(const std::string& frontend_url) {
GURL url(frontend_url);
if (url.scheme() == content::kChromeDevToolsScheme &&
- url.host() == chrome::kChromeUIDevToolsHost)
+ url.host() == chrome::kChromeUIDevToolsHost) {
return GURL();
- if (!url.is_valid() || url.host() != kRemoteFrontendDomain)
+ }
+ if (!url.is_valid() || url.host() != kRemoteFrontendDomain) {
return GURL();
+ }
return GURL(base::StringPrintf(
"%s://%s/%s/%s?%s", content::kChromeDevToolsScheme,
chrome::kChromeUIDevToolsHost, chrome::kChromeUIDevToolsRemotePath,
@@ -41,8 +43,9 @@
// static
bool DevToolsUI::IsFrontendResourceURL(const GURL& url) {
- if (url.host_piece() == kRemoteFrontendDomain)
+ if (url.host_piece() == kRemoteFrontendDomain) {
return true;
+ }
const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess();
if (cmd_line->HasSwitch(switches::kCustomDevtoolsFrontend)) {
diff --git a/chrome/browser/ui/webui/devtools/devtools_ui_data_source.cc b/chrome/browser/ui/webui/devtools/devtools_ui_data_source.cc
index 3d47daa..42a8c0b 100644
--- a/chrome/browser/ui/webui/devtools/devtools_ui_data_source.cc
+++ b/chrome/browser/ui/webui/devtools/devtools_ui_data_source.cc
@@ -123,8 +123,9 @@
bool DevToolsDataSource::MaybeHandleCustomRequest(const std::string& path,
GotDataCallback* callback) {
GURL custom_devtools_frontend = GetCustomDevToolsFrontendURL();
- if (!custom_devtools_frontend.is_valid())
+ if (!custom_devtools_frontend.is_valid()) {
return false;
+ }
std::string stripped_path =
StripDevToolsRevisionWithPrefix(path, "serve_rev/");
stripped_path = StripDevToolsRevisionWithPrefix(stripped_path, "serve_file/");
@@ -382,6 +383,7 @@
default;
DevToolsDataSource::PendingRequest::~PendingRequest() {
- if (callback)
+ if (callback) {
std::move(callback).Run(CreateNotFoundResponse());
+ }
}
diff --git a/chrome/browser/ui/webui/devtools/devtools_ui_data_source.h b/chrome/browser/ui/webui/devtools/devtools_ui_data_source.h
index f251d4e..144b108 100644
--- a/chrome/browser/ui/webui/devtools/devtools_ui_data_source.h
+++ b/chrome/browser/ui/webui/devtools/devtools_ui_data_source.h
@@ -9,7 +9,6 @@
#include <memory>
#include "content/public/browser/url_data_source.h"
-
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "services/network/public/cpp/simple_url_loader.h"
#include "third_party/blink/public/public_buildflags.h"
diff --git a/chrome/browser/ui/webui/discards/discards_ui.cc b/chrome/browser/ui/webui/discards/discards_ui.cc
index b3b30f1..a538346 100644
--- a/chrome/browser/ui/webui/discards/discards_ui.cc
+++ b/chrome/browser/ui/webui/discards/discards_ui.cc
@@ -78,8 +78,9 @@
resource_coordinator::LifecycleUnit* GetLifecycleUnitById(int32_t id) {
for (resource_coordinator::LifecycleUnit* lifecycle_unit :
g_browser_process->GetTabManager()->GetSortedLifecycleUnits()) {
- if (lifecycle_unit->GetID() == id)
+ if (lifecycle_unit->GetID() == id) {
return lifecycle_unit;
+ }
}
return nullptr;
}
@@ -90,8 +91,9 @@
const int current_entry_index = controller.GetCurrentEntryIndex();
// A WebContents which hasn't navigated yet does not have a NavigationEntry.
- if (current_entry_index == -1)
+ if (current_entry_index == -1) {
return 0;
+ }
auto* nav_entry = controller.GetEntryAtIndex(current_entry_index);
DCHECK(nav_entry);
@@ -208,8 +210,9 @@
if (lifecycle_unit) {
auto* tab_lifecycle_unit_external =
lifecycle_unit->AsTabLifecycleUnitExternal();
- if (tab_lifecycle_unit_external)
+ if (tab_lifecycle_unit_external) {
tab_lifecycle_unit_external->SetAutoDiscardable(is_auto_discardable);
+ }
}
std::move(callback).Run();
}
@@ -253,8 +256,9 @@
void LoadById(int32_t id) override {
auto* lifecycle_unit = GetLifecycleUnitById(id);
- if (lifecycle_unit)
+ if (lifecycle_unit) {
lifecycle_unit->Load();
+ }
}
void Discard(DiscardCallback callback) override {
diff --git a/chrome/browser/ui/webui/discards/graph_dump_impl.cc b/chrome/browser/ui/webui/discards/graph_dump_impl.cc
index 08c8eef0..6ddf81aa 100644
--- a/chrome/browser/ui/webui/discards/graph_dump_impl.cc
+++ b/chrome/browser/ui/webui/discards/graph_dump_impl.cc
@@ -38,8 +38,9 @@
std::string ToJSON(const base::Value::Dict& value) {
std::string result;
JSONStringValueSerializer serializer(&result);
- if (serializer.Serialize(value))
+ if (serializer.Serialize(value)) {
return result;
+ }
return std::string();
}
@@ -70,19 +71,22 @@
base::WeakPtr<content::WebContents> web_contents,
FaviconAvailableCallback on_favicon_available) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
- if (!web_contents)
+ if (!web_contents) {
return;
+ }
Profile* profile =
Profile::FromBrowserContext(web_contents->GetBrowserContext());
- if (!profile)
+ if (!profile) {
return;
+ }
favicon::FaviconService* favicon_service =
FaviconServiceFactory::GetForProfile(profile,
ServiceAccessType::EXPLICIT_ACCESS);
- if (!favicon_service)
+ if (!favicon_service) {
return;
+ }
constexpr size_t kIconSize = 16;
constexpr bool kFallbackToHost = true;
@@ -99,8 +103,9 @@
FaviconAvailableCallback on_favicon_available,
const favicon_base::FaviconRawBitmapResult& result) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
- if (!result.is_valid())
+ if (!result.is_valid()) {
return;
+ }
std::move(on_favicon_available).Run(result.bitmap_data);
}
@@ -143,8 +148,9 @@
on_frame(parent_frame);
for (const performance_manager::FrameNode* child_frame :
- parent_frame->GetChildFrameNodes())
+ parent_frame->GetChildFrameNodes()) {
ForFrameAndOffspring(child_frame, on_frame);
+ }
}
} // namespace
@@ -382,8 +388,9 @@
int64_t DiscardsGraphDumpImpl::GetNodeId(
const performance_manager::Node* node) const {
- if (node == nullptr)
+ if (node == nullptr) {
return 0;
+ }
auto it = node_ids_.find(node);
CHECK(it != node_ids_.end(), base::NotFatalUntil::M130);
@@ -409,8 +416,9 @@
void DiscardsGraphDumpImpl::StartPageFaviconRequest(
const performance_manager::PageNode* page_node) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
- if (!page_node->GetMainFrameUrl().is_valid())
+ if (!page_node->GetMainFrameUrl().is_valid()) {
return;
+ }
EnsureFaviconRequestHelper()
.AsyncCall(&FaviconRequestHelper::RequestFavicon)
@@ -421,8 +429,9 @@
void DiscardsGraphDumpImpl::StartFrameFaviconRequest(
const performance_manager::FrameNode* frame_node) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
- if (!frame_node->GetURL().is_valid())
+ if (!frame_node->GetURL().is_valid()) {
return;
+ }
EnsureFaviconRequestHelper()
.AsyncCall(&FaviconRequestHelper::RequestFavicon)
@@ -441,8 +450,9 @@
for (const performance_manager::PageNode* page_node :
graph->GetAllPageNodes()) {
SendPageNotification(page_node, created);
- if (created)
+ if (created) {
StartPageFaviconRequest(page_node);
+ }
// Dispatch preorder frame notifications.
for (const performance_manager::FrameNode* main_frame_node :
@@ -451,8 +461,9 @@
main_frame_node,
[this, created](const performance_manager::FrameNode* frame_node) {
this->SendFrameNotification(frame_node, created);
- if (created)
+ if (created) {
this->StartFrameFaviconRequest(frame_node);
+ }
});
}
}
@@ -508,10 +519,11 @@
ToJSON(GetOwningGraph()->GetNodeDataDescriberRegistry()->DescribeNodeData(
page_node));
- if (created)
+ if (created) {
change_subscriber_->PageCreated(std::move(page_info));
- else
+ } else {
change_subscriber_->PageChanged(std::move(page_info));
+ }
}
void DiscardsGraphDumpImpl::SendProcessNotification(
@@ -529,10 +541,11 @@
ToJSON(GetOwningGraph()->GetNodeDataDescriberRegistry()->DescribeNodeData(
process));
- if (created)
+ if (created) {
change_subscriber_->ProcessCreated(std::move(process_info));
- else
+ } else {
change_subscriber_->ProcessChanged(std::move(process_info));
+ }
}
void DiscardsGraphDumpImpl::SendWorkerNotification(
@@ -563,10 +576,11 @@
ToJSON(GetOwningGraph()->GetNodeDataDescriberRegistry()->DescribeNodeData(
worker));
- if (created)
+ if (created) {
change_subscriber_->WorkerCreated(std::move(worker_info));
- else
+ } else {
change_subscriber_->WorkerChanged(std::move(worker_info));
+ }
}
void DiscardsGraphDumpImpl::SendDeletionNotification(
diff --git a/chrome/browser/ui/webui/discards/graph_dump_impl_unittest.cc b/chrome/browser/ui/webui/discards/graph_dump_impl_unittest.cc
index 9b69739..ceaf88b 100644
--- a/chrome/browser/ui/webui/discards/graph_dump_impl_unittest.cc
+++ b/chrome/browser/ui/webui/discards/graph_dump_impl_unittest.cc
@@ -271,8 +271,9 @@
EXPECT_NE(0u, frame->page_id);
// The page's main frame should have an URL.
- if (frame->id == impl_raw->GetNodeIdForTesting(main_frame))
+ if (frame->id == impl_raw->GetNodeIdForTesting(main_frame)) {
EXPECT_EQ(kExampleUrl, frame->url);
+ }
}
EXPECT_NE(0u, frame->id);
EXPECT_NE(0u, frame->process_id);
diff --git a/chrome/browser/ui/webui/download_internals/download_internals_ui_message_handler.cc b/chrome/browser/ui/webui/download_internals/download_internals_ui_message_handler.cc
index 564cab88..503c735 100644
--- a/chrome/browser/ui/webui/download_internals/download_internals_ui_message_handler.cc
+++ b/chrome/browser/ui/webui/download_internals/download_internals_ui_message_handler.cc
@@ -24,8 +24,9 @@
: download_service_(nullptr) {}
DownloadInternalsUIMessageHandler::~DownloadInternalsUIMessageHandler() {
- if (download_service_)
+ if (download_service_) {
download_service_->GetLogger()->RemoveObserver(this);
+ }
}
void DownloadInternalsUIMessageHandler::RegisterMessages() {
@@ -53,40 +54,45 @@
void DownloadInternalsUIMessageHandler::OnServiceStatusChanged(
const base::Value::Dict& service_status) {
- if (!IsJavascriptAllowed())
+ if (!IsJavascriptAllowed()) {
return;
+ }
FireWebUIListener("service-status-changed", service_status);
}
void DownloadInternalsUIMessageHandler::OnServiceDownloadsAvailable(
const base::Value::List& service_downloads) {
- if (!IsJavascriptAllowed())
+ if (!IsJavascriptAllowed()) {
return;
+ }
FireWebUIListener("service-downloads-available", service_downloads);
}
void DownloadInternalsUIMessageHandler::OnServiceDownloadChanged(
const base::Value::Dict& service_download) {
- if (!IsJavascriptAllowed())
+ if (!IsJavascriptAllowed()) {
return;
+ }
FireWebUIListener("service-download-changed", service_download);
}
void DownloadInternalsUIMessageHandler::OnServiceDownloadFailed(
const base::Value::Dict& service_download) {
- if (!IsJavascriptAllowed())
+ if (!IsJavascriptAllowed()) {
return;
+ }
FireWebUIListener("service-download-failed", service_download);
}
void DownloadInternalsUIMessageHandler::OnServiceRequestMade(
const base::Value::Dict& service_request) {
- if (!IsJavascriptAllowed())
+ if (!IsJavascriptAllowed()) {
return;
+ }
FireWebUIListener("service-request-made", service_request);
}
diff --git a/chrome/browser/ui/webui/downloads/downloads_dom_handler.h b/chrome/browser/ui/webui/downloads/downloads_dom_handler.h
index 569a8756..e50786d 100644
--- a/chrome/browser/ui/webui/downloads/downloads_dom_handler.h
+++ b/chrome/browser/ui/webui/downloads/downloads_dom_handler.h
@@ -26,7 +26,7 @@
class DownloadManager;
class WebContents;
class WebUI;
-}
+} // namespace content
namespace download {
class DownloadItem;
diff --git a/chrome/browser/ui/webui/downloads/downloads_list_tracker.cc b/chrome/browser/ui/webui/downloads/downloads_list_tracker.cc
index a25f8ab..f4ea0191 100644
--- a/chrome/browser/ui/webui/downloads/downloads_list_tracker.cc
+++ b/chrome/browser/ui/webui/downloads/downloads_list_tracker.cc
@@ -199,8 +199,9 @@
DownloadsListTracker::~DownloadsListTracker() = default;
void DownloadsListTracker::Reset() {
- if (sending_updates_)
+ if (sending_updates_) {
page_->ClearAll();
+ }
sent_to_page_ = 0u;
}
@@ -209,11 +210,13 @@
std::vector<std::u16string> new_terms;
new_terms.resize(search_terms.size());
- for (const auto& t : search_terms)
+ for (const auto& t : search_terms) {
new_terms.push_back(base::UTF8ToUTF16(t));
+ }
- if (new_terms == search_terms_)
+ if (new_terms == search_terms_) {
return false;
+ }
search_terms_.swap(new_terms);
RebuildSortedItems();
@@ -280,8 +283,9 @@
void DownloadsListTracker::OnDownloadCreated(DownloadManager* manager,
DownloadItem* download_item) {
DCHECK_EQ(0u, sorted_items_.count(download_item));
- if (should_show_.Run(*download_item))
+ if (should_show_.Run(*download_item)) {
InsertItem(sorted_items_.insert(download_item).first);
+ }
}
void DownloadsListTracker::OnDownloadUpdated(DownloadManager* manager,
@@ -290,19 +294,21 @@
bool is_showing = current_position != sorted_items_.end();
bool should_show = should_show_.Run(*download_item);
- if (!is_showing && should_show)
+ if (!is_showing && should_show) {
InsertItem(sorted_items_.insert(download_item).first);
- else if (is_showing && !should_show)
+ } else if (is_showing && !should_show) {
RemoveItem(current_position);
- else if (is_showing)
+ } else if (is_showing) {
UpdateItem(current_position);
+ }
}
void DownloadsListTracker::OnDownloadRemoved(DownloadManager* manager,
DownloadItem* download_item) {
auto current_position = sorted_items_.find(download_item);
- if (current_position != sorted_items_.end())
+ if (current_position != sorted_items_.end()) {
RemoveItem(current_position);
+ }
}
DownloadsListTracker::DownloadsListTracker(
@@ -357,8 +363,9 @@
auto* registry = extensions::ExtensionRegistry::Get(profile);
const extensions::Extension* extension = registry->GetExtensionById(
by_ext->id(), extensions::ExtensionRegistry::EVERYTHING);
- if (extension)
+ if (extension) {
by_ext_name = extension->name();
+ }
}
file_value->by_ext_id = by_ext_id;
file_value->by_ext_name = by_ext_name;
@@ -419,8 +426,9 @@
state = downloads::mojom::State::kInterrupted;
progress_status_text = download_model.GetTabProgressStatusText();
- if (download_item->CanResume())
+ if (download_item->CanResume()) {
percent = GetPercentComplete(download_item);
+ }
// TODO(crbug.com/40467967): GetHistoryPageStatusText() is using
// GetStatusText() as a temporary measure until the layout is fixed to
@@ -518,8 +526,9 @@
const DownloadItem* DownloadsListTracker::GetItemForTesting(
size_t index) const {
- if (index >= sorted_items_.size())
+ if (index >= sorted_items_.size()) {
return nullptr;
+ }
auto it = sorted_items_.begin();
std::advance(it, index);
@@ -567,8 +576,9 @@
GetMainNotifierManager()->GetAllDownloads(&all_items);
- if (GetOriginalNotifierManager())
+ if (GetOriginalNotifierManager()) {
GetOriginalNotifierManager()->GetAllDownloads(&all_items);
+ }
DownloadQuery query;
query.AddFilter(should_show_);
@@ -579,12 +589,14 @@
}
void DownloadsListTracker::InsertItem(const SortedSet::iterator& insert) {
- if (!sending_updates_)
+ if (!sending_updates_) {
return;
+ }
size_t index = GetIndex(insert);
- if (index >= chunk_size_ && index >= sent_to_page_)
+ if (index >= chunk_size_ && index >= sent_to_page_) {
return;
+ }
std::vector<downloads::mojom::DataPtr> list;
list.push_back(CreateDownloadData(*insert));
@@ -595,8 +607,9 @@
}
void DownloadsListTracker::UpdateItem(const SortedSet::iterator& update) {
- if (!sending_updates_ || GetIndex(update) >= sent_to_page_)
+ if (!sending_updates_ || GetIndex(update) >= sent_to_page_) {
return;
+ }
page_->UpdateItem(static_cast<int>(GetIndex(update)),
CreateDownloadData(*update));
diff --git a/chrome/browser/ui/webui/downloads/downloads_list_tracker_unittest.cc b/chrome/browser/ui/webui/downloads/downloads_list_tracker_unittest.cc
index e965111..5e0ea72 100644
--- a/chrome/browser/ui/webui/downloads/downloads_list_tracker_unittest.cc
+++ b/chrome/browser/ui/webui/downloads/downloads_list_tracker_unittest.cc
@@ -78,8 +78,8 @@
base::BindRepeating(&ShouldShowItem)) {}
~TestDownloadsListTracker() override = default;
- using DownloadsListTracker::IsIncognito;
using DownloadsListTracker::GetItemForTesting;
+ using DownloadsListTracker::IsIncognito;
using DownloadsListTracker::SetChunkSizeForTesting;
protected:
@@ -97,15 +97,17 @@
DownloadsListTrackerTest() = default;
~DownloadsListTrackerTest() override {
- for (const auto& mock_item : mock_items_)
+ for (const auto& mock_item : mock_items_) {
testing::Mock::VerifyAndClear(mock_item.get());
+ }
}
// testing::Test:
void SetUp() override {
ON_CALL(manager_, GetBrowserContext()).WillByDefault(Return(&profile_));
- ON_CALL(manager_, GetAllDownloads(_)).WillByDefault(
- testing::Invoke(this, &DownloadsListTrackerTest::GetAllDownloads));
+ ON_CALL(manager_, GetAllDownloads(_))
+ .WillByDefault(
+ testing::Invoke(this, &DownloadsListTrackerTest::GetAllDownloads));
}
MockDownloadItem* CreateMock(uint64_t id, const base::Time& started) {
@@ -149,8 +151,9 @@
private:
void GetAllDownloads(DownloadVector* result) {
- for (const auto& mock_item : mock_items_)
+ for (const auto& mock_item : mock_items_) {
result->push_back(mock_item.get());
+ }
}
// NOTE: The initialization order of these members matters.
@@ -181,12 +184,14 @@
}
MATCHER_P(MatchIds, expected, "") {
- if (arg.size() != expected.size())
+ if (arg.size() != expected.size()) {
return false;
+ }
for (size_t i = 0; i < arg.size(); ++i) {
- if (arg[i]->id != base::NumberToString(expected[i]))
+ if (arg[i]->id != base::NumberToString(expected[i])) {
return false;
+ }
}
return true;
}
@@ -271,8 +276,9 @@
TEST_F(DownloadsListTrackerTest, Incognito) {
testing::NiceMock<content::MockDownloadManager> incognito_manager;
- ON_CALL(incognito_manager, GetBrowserContext()).WillByDefault(Return(
- TestingProfile::Builder().BuildIncognito(profile())));
+ ON_CALL(incognito_manager, GetBrowserContext())
+ .WillByDefault(
+ Return(TestingProfile::Builder().BuildIncognito(profile())));
MockDownloadItem item;
EXPECT_CALL(item, GetId()).WillRepeatedly(Return(0));
diff --git a/chrome/browser/ui/webui/extensions/extension_icon_source.cc b/chrome/browser/ui/webui/extensions/extension_icon_source.cc
index 4442637..d92d7d57 100644
--- a/chrome/browser/ui/webui/extensions/extension_icon_source.cc
+++ b/chrome/browser/ui/webui/extensions/extension_icon_source.cc
@@ -71,8 +71,8 @@
} // namespace
-ExtensionIconSource::ExtensionIconSource(Profile* profile) : profile_(profile) {
-}
+ExtensionIconSource::ExtensionIconSource(Profile* profile)
+ : profile_(profile) {}
struct ExtensionIconSource::ExtensionIconRequest {
content::URLDataSource::GotDataCallback callback;
@@ -174,14 +174,14 @@
return default_extension_data_.get();
}
-void ExtensionIconSource::FinalizeImage(const SkBitmap* image,
- int request_id) {
+void ExtensionIconSource::FinalizeImage(const SkBitmap* image, int request_id) {
SkBitmap bitmap;
ExtensionIconRequest* request = GetData(request_id);
- if (request->grayscale)
+ if (request->grayscale) {
bitmap = DesaturateImage(image);
- else
+ } else {
bitmap = *image;
+ }
std::move(request->callback).Run(BitmapToMemory(&bitmap).get());
ClearData(request_id);
@@ -191,20 +191,22 @@
ExtensionIconRequest* request = GetData(request_id);
const SkBitmap* default_image = nullptr;
- if (request->extension->is_app())
+ if (request->extension->is_app()) {
default_image = GetDefaultAppImage();
- else
+ } else {
default_image = GetDefaultExtensionImage();
+ }
SkBitmap resized_image(skia::ImageOperations::Resize(
- *default_image, skia::ImageOperations::RESIZE_LANCZOS3,
- request->size, request->size));
+ *default_image, skia::ImageOperations::RESIZE_LANCZOS3, request->size,
+ request->size));
// There are cases where Resize returns an empty bitmap, for example if you
// ask for an image too large. In this case it is better to return the default
// image than returning nothing at all.
- if (resized_image.empty())
+ if (resized_image.empty()) {
resized_image = *default_image;
+ }
FinalizeImage(&resized_image, request_id);
}
@@ -261,10 +263,11 @@
void ExtensionIconSource::OnImageLoaded(int request_id,
const gfx::Image& image) {
- if (image.IsEmpty())
+ if (image.IsEmpty()) {
LoadIconFailed(request_id);
- else
+ } else {
FinalizeImage(image.ToSkBitmap(), request_id);
+ }
}
void ExtensionIconSource::LoadIconFailed(int request_id) {
@@ -272,10 +275,11 @@
ExtensionResource icon = IconsInfo::GetIconResource(
request->extension.get(), request->size, request->match);
- if (request->size == extension_misc::EXTENSION_ICON_BITTY)
+ if (request->size == extension_misc::EXTENSION_ICON_BITTY) {
LoadFaviconImage(request_id);
- else
+ } else {
LoadDefaultImage(request_id);
+ }
}
bool ExtensionIconSource::ParseData(
@@ -286,23 +290,27 @@
std::string path_lower = base::ToLowerASCII(path);
std::vector<std::string> path_parts = base::SplitString(
path_lower, "/", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
- if (path_lower.empty() || path_parts.size() < 3)
+ if (path_lower.empty() || path_parts.size() < 3) {
return false;
+ }
std::string size_param = path_parts.at(1);
std::string match_param = path_parts.at(2);
match_param = match_param.substr(0, match_param.find('?'));
int size;
- if (!base::StringToInt(size_param, &size))
+ if (!base::StringToInt(size_param, &size)) {
return false;
- if (size <= 0 || size > extension_misc::EXTENSION_ICON_GIGANTOR)
+ }
+ if (size <= 0 || size > extension_misc::EXTENSION_ICON_GIGANTOR) {
return false;
+ }
ExtensionIconSet::Match match_type;
int match_num;
- if (!base::StringToInt(match_param, &match_num))
+ if (!base::StringToInt(match_param, &match_num)) {
return false;
+ }
match_type = static_cast<ExtensionIconSet::Match>(match_num);
if (!(match_type == ExtensionIconSet::Match::kExactly ||
match_type == ExtensionIconSet::Match::kSmaller ||
@@ -313,8 +321,9 @@
std::string extension_id = path_parts.at(0);
const Extension* extension =
ExtensionRegistry::Get(profile_)->GetInstalledExtension(extension_id);
- if (!extension)
+ if (!extension) {
return false;
+ }
bool grayscale = path_lower.find("grayscale=true") != std::string::npos;
diff --git a/chrome/browser/ui/webui/extensions/extension_icon_source.h b/chrome/browser/ui/webui/extensions/extension_icon_source.h
index 24ac79d..a33f221 100644
--- a/chrome/browser/ui/webui/extensions/extension_icon_source.h
+++ b/chrome/browser/ui/webui/extensions/extension_icon_source.h
@@ -104,8 +104,7 @@
// Loads the extension's |icon| for the given |request_id| and returns the
// image to the client.
- void LoadExtensionImage(const ExtensionResource& icon,
- int request_id);
+ void LoadExtensionImage(const ExtensionResource& icon, int request_id);
// Loads the favicon image for the app associated with the |request_id|. If
// the image does not exist, we fall back to the default image.
diff --git a/chrome/browser/ui/webui/extensions/extensions_internals_source.cc b/chrome/browser/ui/webui/extensions/extensions_internals_source.cc
index a920d5f..fb70050 100644
--- a/chrome/browser/ui/webui/extensions/extensions_internals_source.cc
+++ b/chrome/browser/ui/webui/extensions/extensions_internals_source.cc
@@ -93,32 +93,45 @@
base::Value::List CreationFlagsToList(int creation_flags) {
base::Value::List flags_value;
- if (creation_flags == extensions::Extension::NO_FLAGS)
+ if (creation_flags == extensions::Extension::NO_FLAGS) {
flags_value.Append("NO_FLAGS");
- if (creation_flags & extensions::Extension::REQUIRE_KEY)
+ }
+ if (creation_flags & extensions::Extension::REQUIRE_KEY) {
flags_value.Append("REQUIRE_KEY");
- if (creation_flags & extensions::Extension::REQUIRE_MODERN_MANIFEST_VERSION)
+ }
+ if (creation_flags & extensions::Extension::REQUIRE_MODERN_MANIFEST_VERSION) {
flags_value.Append("REQUIRE_MODERN_MANIFEST_VERSION");
- if (creation_flags & extensions::Extension::ALLOW_FILE_ACCESS)
+ }
+ if (creation_flags & extensions::Extension::ALLOW_FILE_ACCESS) {
flags_value.Append("ALLOW_FILE_ACCESS");
- if (creation_flags & extensions::Extension::FROM_WEBSTORE)
+ }
+ if (creation_flags & extensions::Extension::FROM_WEBSTORE) {
flags_value.Append("FROM_WEBSTORE");
- if (creation_flags & extensions::Extension::FOLLOW_SYMLINKS_ANYWHERE)
+ }
+ if (creation_flags & extensions::Extension::FOLLOW_SYMLINKS_ANYWHERE) {
flags_value.Append("FOLLOW_SYMLINKS_ANYWHERE");
- if (creation_flags & extensions::Extension::ERROR_ON_PRIVATE_KEY)
+ }
+ if (creation_flags & extensions::Extension::ERROR_ON_PRIVATE_KEY) {
flags_value.Append("ERROR_ON_PRIVATE_KEY");
- if (creation_flags & extensions::Extension::WAS_INSTALLED_BY_DEFAULT)
+ }
+ if (creation_flags & extensions::Extension::WAS_INSTALLED_BY_DEFAULT) {
flags_value.Append("WAS_INSTALLED_BY_DEFAULT");
- if (creation_flags & extensions::Extension::REQUIRE_PERMISSIONS_CONSENT)
+ }
+ if (creation_flags & extensions::Extension::REQUIRE_PERMISSIONS_CONSENT) {
flags_value.Append("REQUIRE_PERMISSIONS_CONSENT");
- if (creation_flags & extensions::Extension::IS_EPHEMERAL)
+ }
+ if (creation_flags & extensions::Extension::IS_EPHEMERAL) {
flags_value.Append("IS_EPHEMERAL");
- if (creation_flags & extensions::Extension::WAS_INSTALLED_BY_OEM)
+ }
+ if (creation_flags & extensions::Extension::WAS_INSTALLED_BY_OEM) {
flags_value.Append("WAS_INSTALLED_BY_OEM");
- if (creation_flags & extensions::Extension::MAY_BE_UNTRUSTED)
+ }
+ if (creation_flags & extensions::Extension::MAY_BE_UNTRUSTED) {
flags_value.Append("MAY_BE_UNTRUSTED");
- if (creation_flags & extensions::Extension::WITHHOLD_PERMISSIONS)
+ }
+ if (creation_flags & extensions::Extension::WITHHOLD_PERMISSIONS) {
flags_value.Append("WITHHOLD_PERMISSIONS");
+ }
return flags_value;
}
diff --git a/chrome/browser/ui/webui/extensions/extensions_internals_unittest.cc b/chrome/browser/ui/webui/extensions/extensions_internals_unittest.cc
index 27d859d7..50257d3 100644
--- a/chrome/browser/ui/webui/extensions/extensions_internals_unittest.cc
+++ b/chrome/browser/ui/webui/extensions/extensions_internals_unittest.cc
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/ui/webui/extensions/extensions_internals_source.h"
-
#include "base/functional/bind.h"
#include "base/json/json_reader.h"
#include "base/values.h"
@@ -11,6 +9,7 @@
#include "chrome/browser/extensions/extension_service_test_base.h"
#include "chrome/browser/extensions/permissions/permissions_updater.h"
#include "chrome/browser/extensions/permissions/scripting_permissions_modifier.h"
+#include "chrome/browser/ui/webui/extensions/extensions_internals_source.h"
#include "chrome/test/base/testing_profile.h"
#include "extensions/browser/event_router.h"
#include "extensions/browser/event_router_factory.h"
diff --git a/chrome/browser/ui/webui/family_link_user_internals/family_link_user_internals_message_handler.cc b/chrome/browser/ui/webui/family_link_user_internals/family_link_user_internals_message_handler.cc
index 08fe048..5a9bd40 100644
--- a/chrome/browser/ui/webui/family_link_user_internals/family_link_user_internals_message_handler.cc
+++ b/chrome/browser/ui/webui/family_link_user_internals/family_link_user_internals_message_handler.cc
@@ -165,8 +165,9 @@
const base::Value::List& args) {
DCHECK(args.empty());
AllowJavascript();
- if (scoped_observation_.IsObserving())
+ if (scoped_observation_.IsObserving()) {
return;
+ }
scoped_observation_.Observe(GetSupervisedUserService()->GetURLFilter());
}
@@ -179,14 +180,16 @@
void FamilyLinkUserInternalsMessageHandler::HandleTryURL(
const base::Value::List& args) {
DCHECK_EQ(2u, args.size());
- if (!args[0].is_string() || !args[1].is_string())
+ if (!args[0].is_string() || !args[1].is_string()) {
return;
+ }
const std::string& callback_id = args[0].GetString();
const std::string& url_str = args[1].GetString();
GURL url = url_formatter::FixupURL(url_str, std::string());
- if (!url.is_valid())
+ if (!url.is_valid()) {
return;
+ }
supervised_user::SupervisedUserURLFilter* filter =
GetSupervisedUserService()->GetURLFilter();
diff --git a/chrome/browser/ui/webui/family_link_user_internals/family_link_user_internals_ui.cc b/chrome/browser/ui/webui/family_link_user_internals/family_link_user_internals_ui.cc
index 20ecf79..86f44788 100644
--- a/chrome/browser/ui/webui/family_link_user_internals/family_link_user_internals_ui.cc
+++ b/chrome/browser/ui/webui/family_link_user_internals/family_link_user_internals_ui.cc
@@ -22,7 +22,8 @@
content::WebUIDataSource* source = content::WebUIDataSource::CreateAndAdd(
profile, chrome::kChromeUIFamilyLinkUserInternalsHost);
webui::SetupWebUIDataSource(
- source, base::span<const webui::ResourcePath>(kFamilyLinkUserInternalsResources),
+ source,
+ base::span<const webui::ResourcePath>(kFamilyLinkUserInternalsResources),
IDR_FAMILY_LINK_USER_INTERNALS_FAMILY_LINK_USER_INTERNALS_HTML);
source->OverrideContentSecurityPolicy(
diff --git a/chrome/browser/ui/webui/favicon_source.h b/chrome/browser/ui/webui/favicon_source.h
index d6b61d2..7384c9e 100644
--- a/chrome/browser/ui/webui/favicon_source.h
+++ b/chrome/browser/ui/webui/favicon_source.h
@@ -25,7 +25,7 @@
namespace chrome {
enum class FaviconUrlFormat;
struct ParsedFaviconPath;
-}
+} // namespace chrome
namespace ui {
class NativeTheme;
@@ -70,12 +70,7 @@
private:
// Defines the allowed pixel sizes for requested favicons.
- enum IconSize {
- SIZE_16,
- SIZE_32,
- SIZE_64,
- NUM_SIZES
- };
+ enum IconSize { SIZE_16, SIZE_32, SIZE_64, NUM_SIZES };
// Called when favicon data is available from the history backend. If
// |bitmap_result| is valid, returns it to caller using |callback|. Otherwise
diff --git a/chrome/browser/ui/webui/feed_internals/feedv2_internals_page_handler.cc b/chrome/browser/ui/webui/feed_internals/feedv2_internals_page_handler.cc
index b80fa44..95dd822 100644
--- a/chrome/browser/ui/webui/feed_internals/feedv2_internals_page_handler.cc
+++ b/chrome/browser/ui/webui/feed_internals/feedv2_internals_page_handler.cc
@@ -62,10 +62,12 @@
properties->is_web_feed_follow_intro_debug_enabled =
IsWebFeedFollowIntroDebugEnabled();
properties->use_feed_query_requests = ShouldUseFeedQueryRequests();
- if (debug_data.fetch_info)
+ if (debug_data.fetch_info) {
properties->feed_fetch_url = debug_data.fetch_info->base_request_url;
- if (debug_data.upload_info)
+ }
+ if (debug_data.upload_info) {
properties->feed_actions_url = debug_data.upload_info->base_request_url;
+ }
properties->load_stream_status = debug_data.load_stream_status;
diff --git a/chrome/browser/ui/webui/feedback/feedback_dialog.cc b/chrome/browser/ui/webui/feedback/feedback_dialog.cc
index 042f6be..6ec2330 100644
--- a/chrome/browser/ui/webui/feedback/feedback_dialog.cc
+++ b/chrome/browser/ui/webui/feedback/feedback_dialog.cc
@@ -141,8 +141,9 @@
// The widget_ is set to null when the FeedbackDialog is constructed.
// After the following two function calls, it is finally initialized.
// Therefore, it is safer to check whether the widget_ is null
- if (this->widget_)
+ if (this->widget_) {
this->widget_->Show();
+ }
}
views::Widget* FeedbackDialog::GetWidget() const {
diff --git a/chrome/browser/ui/webui/fileicon_source.cc b/chrome/browser/ui/webui/fileicon_source.cc
index 4a09069..493a8818 100644
--- a/chrome/browser/ui/webui/fileicon_source.cc
+++ b/chrome/browser/ui/webui/fileicon_source.cc
@@ -42,8 +42,12 @@
const char kScaleFactorParameter[] = "scale";
IconLoader::IconSize SizeStringToIconSize(std::string_view size_string) {
- if (size_string == "small") return IconLoader::SMALL;
- if (size_string == "large") return IconLoader::LARGE;
+ if (size_string == "small") {
+ return IconLoader::SMALL;
+ }
+ if (size_string == "large") {
+ return IconLoader::LARGE;
+ }
// We default to NORMAL if we don't recognize the size_string. Including
// size_string=="normal".
return IconLoader::NORMAL;
@@ -72,8 +76,9 @@
FileIconSource::IconRequestDetails::IconRequestDetails() = default;
FileIconSource::IconRequestDetails::IconRequestDetails(
IconRequestDetails&& other) = default;
-FileIconSource::IconRequestDetails& FileIconSource::IconRequestDetails::
-operator=(IconRequestDetails&& other) = default;
+FileIconSource::IconRequestDetails&
+FileIconSource::IconRequestDetails::operator=(IconRequestDetails&& other) =
+ default;
FileIconSource::IconRequestDetails::~IconRequestDetails() = default;
FileIconSource::FileIconSource() = default;
diff --git a/chrome/browser/ui/webui/flags/flags_ui.cc b/chrome/browser/ui/webui/flags/flags_ui.cc
index df03c72..20727940b 100644
--- a/chrome/browser/ui/webui/flags/flags_ui.cc
+++ b/chrome/browser/ui/webui/flags/flags_ui.cc
@@ -105,8 +105,9 @@
std::unique_ptr<flags_ui::FlagsStorage> storage,
flags_ui::FlagAccess access) {
// If the flags_ui has gone away, there's nothing to do.
- if (!flags_ui)
+ if (!flags_ui) {
return;
+ }
// Note that |dom_handler| is owned by the web ui that owns |flags_ui|, so
// it is still alive if |flags_ui| is.
diff --git a/chrome/browser/ui/webui/flags/flags_ui_handler.cc b/chrome/browser/ui/webui/flags/flags_ui_handler.cc
index d677014..d84bec7 100644
--- a/chrome/browser/ui/webui/flags/flags_ui_handler.cc
+++ b/chrome/browser/ui/webui/flags/flags_ui_handler.cc
@@ -169,8 +169,9 @@
const base::Value::List& args) {
DCHECK(flags_storage_);
DCHECK_EQ(2u, args.size());
- if (args.size() != 2)
+ if (args.size() != 2) {
return;
+ }
if (!args[0].is_string() || !args[1].is_string()) {
NOTREACHED();
diff --git a/chrome/browser/ui/webui/flags/flags_ui_handler.h b/chrome/browser/ui/webui/flags/flags_ui_handler.h
index 4cc380f..111ec65 100644
--- a/chrome/browser/ui/webui/flags/flags_ui_handler.h
+++ b/chrome/browser/ui/webui/flags/flags_ui_handler.h
@@ -2,9 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/ui/webui/flags/flags_ui.h"
-
#include "build/build_config.h"
+#include "chrome/browser/ui/webui/flags/flags_ui.h"
#include "components/flags_ui/feature_entry.h"
#include "components/flags_ui/flags_state.h"
#include "content/public/browser/web_ui_message_handler.h"
diff --git a/chrome/browser/ui/webui/gcm_internals_ui.cc b/chrome/browser/ui/webui/gcm_internals_ui.cc
index 5ff3a8a..1c2bc5c 100644
--- a/chrome/browser/ui/webui/gcm_internals_ui.cc
+++ b/chrome/browser/ui/webui/gcm_internals_ui.cc
@@ -93,7 +93,7 @@
Profile* profile = Profile::FromWebUI(web_ui());
gcm::GCMProfileService* profile_service =
- gcm::GCMProfileServiceFactory::GetForProfile(profile);
+ gcm::GCMProfileServiceFactory::GetForProfile(profile);
if (!profile_service || !profile_service->driver()) {
ReturnResults(profile, nullptr, nullptr);
diff --git a/chrome/browser/ui/webui/help/help_utils_chromeos.cc b/chrome/browser/ui/webui/help/help_utils_chromeos.cc
index 49db3e7..19175bd 100644
--- a/chrome/browser/ui/webui/help/help_utils_chromeos.cc
+++ b/chrome/browser/ui/webui/help/help_utils_chromeos.cc
@@ -24,13 +24,15 @@
// Device Policy overrides the defaults.
ash::CrosSettings* settings = ash::CrosSettings::Get();
- if (!settings)
+ if (!settings) {
return default_update_over_cellular_allowed;
+ }
const base::Value* types_value =
settings->GetPref(ash::kAllowedConnectionTypesForUpdate);
- if (!types_value)
+ if (!types_value) {
return default_update_over_cellular_allowed;
+ }
CHECK(types_value->is_list());
const auto& list = types_value->GetList();
for (size_t i = 0; i < list.size(); ++i) {
@@ -39,8 +41,9 @@
continue;
}
- if (list[i].GetInt() == 4)
+ if (list[i].GetInt() == 4) {
return true;
+ }
}
// Device policy does not allow updates over cellular, as cellular is not
// included in allowed connection types for updates.
diff --git a/chrome/browser/ui/webui/help/version_updater_basic.cc b/chrome/browser/ui/webui/help/version_updater_basic.cc
index 753c402..ebcef56 100644
--- a/chrome/browser/ui/webui/help/version_updater_basic.cc
+++ b/chrome/browser/ui/webui/help/version_updater_basic.cc
@@ -2,11 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/ui/webui/help/version_updater.h"
-
#include <memory>
#include <string>
+#include "chrome/browser/ui/webui/help/version_updater.h"
#include "chrome/browser/upgrade_detector/upgrade_detector.h"
namespace {
diff --git a/chrome/browser/ui/webui/help/version_updater_chromeos.cc b/chrome/browser/ui/webui/help/version_updater_chromeos.cc
index 1105b60..0965e722 100644
--- a/chrome/browser/ui/webui/help/version_updater_chromeos.cc
+++ b/chrome/browser/ui/webui/help/version_updater_chromeos.cc
@@ -56,8 +56,9 @@
NetworkStatus GetNetworkStatus(bool interactive,
const ash::NetworkState* network,
bool metered) {
- if (!network || !network->IsConnectedState()) // Offline state.
+ if (!network || !network->IsConnectedState()) { // Offline state.
return NETWORK_STATUS_OFFLINE;
+ }
if (metered &&
!help_utils_chromeos::IsUpdateOverCellularAllowed(interactive)) {
@@ -70,8 +71,9 @@
bool IsAutoUpdateDisabled() {
bool update_disabled = kDefaultAutoUpdateDisabled;
ash::CrosSettings* settings = ash::CrosSettings::Get();
- if (!settings)
+ if (!settings) {
return update_disabled;
+ }
const base::Value* update_disabled_value =
settings->GetPref(ash::kUpdateDisabled);
if (update_disabled_value) {
@@ -85,16 +87,20 @@
bool metered) {
const std::string type = network->type();
if (ash::NetworkTypePattern::WiFi().MatchesType(type)) {
- if (metered)
+ if (metered) {
return l10n_util::GetStringUTF16(IDS_NETWORK_TYPE_METERED_WIFI);
+ }
return l10n_util::GetStringUTF16(IDS_NETWORK_TYPE_WIFI);
}
- if (ash::NetworkTypePattern::Ethernet().MatchesType(type))
+ if (ash::NetworkTypePattern::Ethernet().MatchesType(type)) {
return l10n_util::GetStringUTF16(IDS_NETWORK_TYPE_ETHERNET);
- if (ash::NetworkTypePattern::Mobile().MatchesType(type))
+ }
+ if (ash::NetworkTypePattern::Mobile().MatchesType(type)) {
return l10n_util::GetStringUTF16(IDS_NETWORK_TYPE_MOBILE_DATA);
- if (ash::NetworkTypePattern::VPN().MatchesType(type))
+ }
+ if (ash::NetworkTypePattern::VPN().MatchesType(type)) {
return l10n_util::GetStringUTF16(IDS_NETWORK_TYPE_VPN);
+ }
NOTREACHED();
}
@@ -143,12 +149,14 @@
callback_ = std::move(callback);
// User is not actively checking for updates.
- if (!EnsureCanUpdate(false /* interactive */, callback_))
+ if (!EnsureCanUpdate(false /* interactive */, callback_)) {
return;
+ }
UpdateEngineClient* update_engine_client = UpdateEngineClient::Get();
- if (!update_engine_client->HasObserver(this))
+ if (!update_engine_client->HasObserver(this)) {
update_engine_client->AddObserver(this);
+ }
this->UpdateStatusChanged(update_engine_client->GetLastStatus());
}
@@ -168,12 +176,14 @@
callback_ = std::move(callback);
// User is actively checking for updates.
- if (!EnsureCanUpdate(true /* interactive */, callback_))
+ if (!EnsureCanUpdate(true /* interactive */, callback_)) {
return;
+ }
UpdateEngineClient* update_engine_client = UpdateEngineClient::Get();
- if (!update_engine_client->HasObserver(this))
+ if (!update_engine_client->HasObserver(this)) {
update_engine_client->AddObserver(this);
+ }
if (update_engine_client->GetLastStatus().current_operation() !=
update_engine::Operation::IDLE) {
@@ -198,8 +208,9 @@
context_)
: nullptr;
// For local owner set the field in the policy blob.
- if (service)
+ if (service) {
service->SetString(ash::kReleaseChannel, channel);
+ }
UpdateEngineClient::Get()->SetChannel(channel, is_powerwash_allowed);
}
@@ -298,8 +309,9 @@
// If the status change is for an installation, this means that DLCs are being
// installed and has nothing to with the OS. Ignore this status change.
- if (status.is_install())
+ if (status.is_install()) {
return;
+ }
// If the updater is currently idle, just show the last operation (unless it
// was previously checking for an update -- in that case, the system is
@@ -399,6 +411,7 @@
UpdateEngineClient::UpdateCheckResult result) {
// If version updating is not implemented, this binary is the most up-to-date
// possible with respect to automatic updating.
- if (result == UpdateEngineClient::UPDATE_RESULT_NOTIMPLEMENTED)
+ if (result == UpdateEngineClient::UPDATE_RESULT_NOTIMPLEMENTED) {
callback_.Run(UPDATED, 0, false, false, std::string(), 0, std::u16string());
+ }
}
diff --git a/chrome/browser/ui/webui/help/version_updater_chromeos.h b/chrome/browser/ui/webui/help/version_updater_chromeos.h
index cf809d24..df6566f 100644
--- a/chrome/browser/ui/webui/help/version_updater_chromeos.h
+++ b/chrome/browser/ui/webui/help/version_updater_chromeos.h
@@ -14,7 +14,7 @@
namespace content {
class BrowserContext;
class WebContents;
-}
+} // namespace content
class VersionUpdaterCros : public VersionUpdater,
public ash::UpdateEngineClient::Observer {
diff --git a/chrome/browser/ui/webui/help/version_updater_chromeos_unittest.cc b/chrome/browser/ui/webui/help/version_updater_chromeos_unittest.cc
index 677f174d..0d9453b 100644
--- a/chrome/browser/ui/webui/help/version_updater_chromeos_unittest.cc
+++ b/chrome/browser/ui/webui/help/version_updater_chromeos_unittest.cc
@@ -69,9 +69,7 @@
ash::ShillServiceClient::TestInterface* service_test =
network_handler_test_helper_->service_test();
service_test->ClearServices();
- service_test->AddService("/service/eth",
- "eth" /* guid */,
- "eth",
+ service_test->AddService("/service/eth", "eth" /* guid */, "eth",
shill::kTypeEthernet, shill::kStateOnline,
true /* visible */);
base::RunLoop().RunUntilIdle();
diff --git a/chrome/browser/ui/webui/help/version_updater_mac.mm b/chrome/browser/ui/webui/help/version_updater_mac.mm
index 1b45d0c4..9dd6332 100644
--- a/chrome/browser/ui/webui/help/version_updater_mac.mm
+++ b/chrome/browser/ui/webui/help/version_updater_mac.mm
@@ -38,10 +38,11 @@
namespace {
int GetDownloadProgress(int64_t downloaded_bytes, int64_t total_bytes) {
- if (downloaded_bytes < 0 || total_bytes <= 0)
+ if (downloaded_bytes < 0 || total_bytes <= 0) {
return -1;
+ }
return 100 * std::clamp(static_cast<double>(downloaded_bytes) / total_bytes,
- 0.0, 1.0);
+ 0.0, 1.0);
}
void UpdateStatus(VersionUpdater::StatusCallback status_callback,
diff --git a/chrome/browser/ui/webui/history/browsing_history_handler.cc b/chrome/browser/ui/webui/history/browsing_history_handler.cc
index 3db964ac..c7eeaa4 100644
--- a/chrome/browser/ui/webui/history/browsing_history_handler.cc
+++ b/chrome/browser/ui/webui/history/browsing_history_handler.cc
@@ -77,7 +77,8 @@
// Gets the name and type of a device for the given sync client ID.
// |name| and |type| are out parameters.
void GetDeviceNameAndType(const syncer::DeviceInfoTracker* tracker,
- const std::string& client_id, std::string* name,
+ const std::string& client_id,
+ std::string* name,
std::string* type) {
// DeviceInfoTracker must be syncing in order for remote history entries to
// be available.
@@ -131,16 +132,18 @@
// as the title, we mark the title as LTR since URLs are always treated as
// left to right strings.
if (base::i18n::IsRTL()) {
- if (using_url_as_the_title)
+ if (using_url_as_the_title) {
base::i18n::WrapStringWithLTRFormatting(&title_to_set);
- else
+ } else {
base::i18n::AdjustStringForLocaleDirection(&title_to_set);
+ }
}
// Number of chars to truncate titles when making them "short".
static const size_t kShortTitleLength = 300;
- if (title_to_set.size() > kShortTitleLength)
+ if (title_to_set.size() > kShortTitleLength) {
title_to_set.resize(kShortTitleLength);
+ }
result->Set("title", title_to_set);
}
@@ -185,8 +188,10 @@
// Converts `entry` to a base::Value::Dict to be owned by the caller.
base::Value::Dict HistoryEntryToValue(
const BrowsingHistoryService::HistoryEntry& entry,
- BookmarkModel* bookmark_model, Profile& profile,
- const syncer::DeviceInfoTracker* tracker, base::Clock* clock) {
+ BookmarkModel* bookmark_model,
+ Profile& profile,
+ const syncer::DeviceInfoTracker* tracker,
+ base::Clock* clock) {
base::Value::Dict result;
SetHistoryEntryUrlAndTitle(entry, &result);
@@ -199,7 +204,9 @@
// When the domain is empty, use the scheme instead. This allows for a
// sensible treatment of e.g. file: URLs when group by domain is on.
- if (domain.empty()) domain = base::UTF8ToUTF16(entry.url.scheme() + ":");
+ if (domain.empty()) {
+ domain = base::UTF8ToUTF16(entry.url.scheme() + ":");
+ }
// The items which are to be written into result are also described in
// chrome/browser/resources/history/history.js in @typedef for
@@ -253,8 +260,9 @@
std::string device_name;
std::string device_type;
- if (!entry.client_id.empty())
+ if (!entry.client_id.empty()) {
GetDeviceNameAndType(tracker, entry.client_id, &device_name, &device_type);
+ }
result.Set("deviceName", device_name);
result.Set("deviceType", device_type);
@@ -409,7 +417,8 @@
}
void BrowsingHistoryHandler::SendHistoryQuery(
- int max_count, const std::u16string& query,
+ int max_count,
+ const std::u16string& query,
std::optional<double> begin_timestamp) {
history::QueryOptions options;
options.max_count = max_count;
@@ -581,7 +590,8 @@
}
void BrowsingHistoryHandler::HasOtherFormsOfBrowsingHistory(
- bool has_other_forms, bool has_synced_results) {
+ bool has_other_forms,
+ bool has_synced_results) {
if (IsJavascriptAllowed()) {
FireWebUIListener("has-other-forms-changed", base::Value(has_other_forms));
} else {
diff --git a/chrome/browser/ui/webui/history/browsing_history_handler.h b/chrome/browser/ui/webui/history/browsing_history_handler.h
index cc1bf7a9..d932da0e 100644
--- a/chrome/browser/ui/webui/history/browsing_history_handler.h
+++ b/chrome/browser/ui/webui/history/browsing_history_handler.h
@@ -83,7 +83,8 @@
}
protected:
- virtual void SendHistoryQuery(int count, const std::u16string& query,
+ virtual void SendHistoryQuery(int count,
+ const std::u16string& query,
std::optional<double> begin_timestamp);
private:
diff --git a/chrome/browser/ui/webui/history/browsing_history_handler_unittest.cc b/chrome/browser/ui/webui/history/browsing_history_handler_unittest.cc
index 2c9f4e3..4e6cb9b0 100644
--- a/chrome/browser/ui/webui/history/browsing_history_handler_unittest.cc
+++ b/chrome/browser/ui/webui/history/browsing_history_handler_unittest.cc
@@ -40,7 +40,8 @@
class MockBrowsingHistoryService : public BrowsingHistoryService {
public:
- MOCK_METHOD(void, QueryHistory,
+ MOCK_METHOD(void,
+ QueryHistory,
(const std::u16string& search_text, const QueryOptions& options),
(override));
};
@@ -81,7 +82,8 @@
BrowsingHistoryHandlerWithWebUIForTesting& operator=(
const BrowsingHistoryHandlerWithWebUIForTesting&) = delete;
- void SendHistoryQuery(int count, const std::u16string& query,
+ void SendHistoryQuery(int count,
+ const std::u16string& query,
std::optional<double> begin_timestamp) override {
if (postpone_query_results_) {
return;
diff --git a/chrome/browser/ui/webui/history/foreign_session_handler.cc b/chrome/browser/ui/webui/history/foreign_session_handler.cc
index 8fd6dd5..01661e6 100644
--- a/chrome/browser/ui/webui/history/foreign_session_handler.cc
+++ b/chrome/browser/ui/webui/history/foreign_session_handler.cc
@@ -48,16 +48,18 @@
// Helper method to create JSON compatible objects from Session objects.
std::optional<base::Value::Dict> SessionTabToValue(
const ::sessions::SessionTab& tab) {
- if (tab.navigations.empty())
+ if (tab.navigations.empty()) {
return std::nullopt;
+ }
int selected_index = std::min(tab.current_navigation_index,
static_cast<int>(tab.navigations.size() - 1));
const ::sessions::SerializedNavigationEntry& current_navigation =
tab.navigations.at(selected_index);
GURL tab_url = current_navigation.virtual_url();
- if (!tab_url.is_valid() || tab_url.spec() == chrome::kChromeUINewTabURL)
+ if (!tab_url.is_valid() || tab_url.spec() == chrome::kChromeUINewTabURL) {
return std::nullopt;
+ }
base::Value::Dict dictionary;
NewTabUI::SetUrlTitleAndDirection(&dictionary, current_navigation.title(),
@@ -89,8 +91,9 @@
// Helper method to create JSON compatible objects from SessionWindow objects.
std::optional<base::Value::Dict> SessionWindowToValue(
const ::sessions::SessionWindow& window) {
- if (window.tabs.empty())
+ if (window.tabs.empty()) {
return std::nullopt;
+ }
base::Value::List tab_values;
// Calculate the last |modification_time| for all entries within a window.
@@ -102,8 +105,9 @@
tab_values.Append(std::move(*tab_value));
}
}
- if (tab_values.empty())
+ if (tab_values.empty()) {
return std::nullopt;
+ }
base::Value::Dict dictionary =
BuildWindowData(window.timestamp, window.window_id);
@@ -130,8 +134,9 @@
SessionID tab_id,
const WindowOpenDisposition& disposition) {
sync_sessions::OpenTabsUIDelegate* open_tabs = GetOpenTabsUIDelegate(web_ui);
- if (!open_tabs)
+ if (!open_tabs) {
return;
+ }
const ::sessions::SessionTab* tab;
if (!open_tabs->GetForeignTab(session_string_value, tab_id, &tab)) {
@@ -151,8 +156,9 @@
content::WebUI* web_ui,
const std::string& session_string_value) {
sync_sessions::OpenTabsUIDelegate* open_tabs = GetOpenTabsUIDelegate(web_ui);
- if (!open_tabs)
+ if (!open_tabs) {
return;
+ }
// Note: we don't own the ForeignSessions themselves.
std::vector<const ::sessions::SessionWindow*> windows =
@@ -203,8 +209,9 @@
void ForeignSessionHandler::OnJavascriptAllowed() {
// This can happen if the page is refreshed.
- if (!initial_session_list_)
+ if (!initial_session_list_) {
initial_session_list_ = GetForeignSessions();
+ }
Profile* profile = Profile::FromWebUI(web_ui());
@@ -296,8 +303,9 @@
bool is_collapsed = collapsed_sessions.Find(session_tag);
session_data.Set("collapsed", is_collapsed);
- if (is_collapsed)
+ if (is_collapsed) {
current_collapsed_sessions.Set(session_tag, true);
+ }
base::Value::List window_list;
@@ -375,8 +383,9 @@
sync_sessions::OpenTabsUIDelegate* open_tabs =
GetOpenTabsUIDelegate(web_ui());
- if (open_tabs)
+ if (open_tabs) {
open_tabs->DeleteForeignSession(session_tag);
+ }
}
void ForeignSessionHandler::HandleSetForeignSessionCollapsed(
@@ -403,10 +412,11 @@
// collapsed state persists.
PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs();
ScopedDictPrefUpdate update(prefs, prefs::kNtpCollapsedForeignSessions);
- if (is_collapsed)
+ if (is_collapsed) {
update->Set(session_tag, true);
- else
+ } else {
update->Remove(session_tag);
+ }
}
} // namespace browser_sync
diff --git a/chrome/browser/ui/webui/history/history_login_handler.cc b/chrome/browser/ui/webui/history/history_login_handler.cc
index 0842110..6b27af65 100644
--- a/chrome/browser/ui/webui/history/history_login_handler.cc
+++ b/chrome/browser/ui/webui/history/history_login_handler.cc
@@ -57,8 +57,9 @@
void HistoryLoginHandler::ProfileInfoChanged() {
bool signed_in = !profile_info_watcher_->GetAuthenticatedUsername().empty();
- if (!signin_callback_.is_null())
+ if (!signin_callback_.is_null()) {
signin_callback_.Run();
+ }
FireWebUIListener("sign-in-state-changed", base::Value(signed_in));
}
diff --git a/chrome/browser/ui/webui/identity_internals_ui.cc b/chrome/browser/ui/webui/identity_internals_ui.cc
index 61ab0d5..57d39e48 100644
--- a/chrome/browser/ui/webui/identity_internals_ui.cc
+++ b/chrome/browser/ui/webui/identity_internals_ui.cc
@@ -180,8 +180,9 @@
extensions::ExtensionRegistry::Get(Profile::FromWebUI(web_ui()));
const extensions::Extension* extension =
registry->enabled_extensions().GetByID(access_tokens_key.extension_id);
- if (!extension)
+ if (!extension) {
return std::string();
+ }
return extension->name();
}
@@ -242,8 +243,9 @@
extensions::IdentityAPI* api =
extensions::IdentityAPI::GetFactoryInstance()->Get(
Profile::FromWebUI(web_ui()));
- if (api)
+ if (api) {
tokens = api->token_cache()->access_tokens_cache();
+ }
for (const auto& key_tokens : tokens) {
for (const auto& token : key_tokens.second) {
results.Append(GetInfoForToken(key_tokens.first, token));
@@ -308,7 +310,7 @@
} // namespace
IdentityInternalsUI::IdentityInternalsUI(content::WebUI* web_ui)
- : content::WebUIController(web_ui) {
+ : content::WebUIController(web_ui) {
// chrome://identity-internals source.
content::WebUIDataSource* html_source =
content::WebUIDataSource::CreateAndAdd(
diff --git a/chrome/browser/ui/webui/identity_internals_ui.h b/chrome/browser/ui/webui/identity_internals_ui.h
index 76b3315..bb7a173 100644
--- a/chrome/browser/ui/webui/identity_internals_ui.h
+++ b/chrome/browser/ui/webui/identity_internals_ui.h
@@ -17,8 +17,7 @@
};
// The WebUI for chrome://identity-internals
-class IdentityInternalsUI
- : public content::WebUIController {
+class IdentityInternalsUI : public content::WebUIController {
public:
explicit IdentityInternalsUI(content::WebUI* web_ui);
diff --git a/chrome/browser/ui/webui/identity_internals_ui_browsertest.cc b/chrome/browser/ui/webui/identity_internals_ui_browsertest.cc
index a0452eb..c0385f8 100644
--- a/chrome/browser/ui/webui/identity_internals_ui_browsertest.cc
+++ b/chrome/browser/ui/webui/identity_internals_ui_browsertest.cc
@@ -15,7 +15,7 @@
const char kChromeWebStoreId[] = "ahfgeienlihckogmohjhadlkjgocpleb";
const int kOneHour = 3600;
-} // namespace
+} // namespace
IdentityInternalsUIBrowserTest::IdentityInternalsUIBrowserTest() = default;
diff --git a/chrome/browser/ui/webui/inspect_ui.cc b/chrome/browser/ui/webui/inspect_ui.cc
index 723628ee..f53da7d 100644
--- a/chrome/browser/ui/webui/inspect_ui.cc
+++ b/chrome/browser/ui/webui/inspect_ui.cc
@@ -345,53 +345,60 @@
const base::Value::List& args) {
std::string source;
std::string id;
- if (ParseStringArgs(args, &source, &id))
+ if (ParseStringArgs(args, &source, &id)) {
inspect_ui_->Inspect(source, id);
+ }
}
void InspectMessageHandler::HandleInspectFallbackCommand(
const base::Value::List& args) {
std::string source;
std::string id;
- if (ParseStringArgs(args, &source, &id))
+ if (ParseStringArgs(args, &source, &id)) {
inspect_ui_->InspectFallback(source, id);
+ }
}
void InspectMessageHandler::HandleActivateCommand(
const base::Value::List& args) {
std::string source;
std::string id;
- if (ParseStringArgs(args, &source, &id))
+ if (ParseStringArgs(args, &source, &id)) {
inspect_ui_->Activate(source, id);
+ }
}
void InspectMessageHandler::HandleCloseCommand(const base::Value::List& args) {
std::string source;
std::string id;
- if (ParseStringArgs(args, &source, &id))
+ if (ParseStringArgs(args, &source, &id)) {
inspect_ui_->Close(source, id);
+ }
}
void InspectMessageHandler::HandleReloadCommand(const base::Value::List& args) {
std::string source;
std::string id;
- if (ParseStringArgs(args, &source, &id))
+ if (ParseStringArgs(args, &source, &id)) {
inspect_ui_->Reload(source, id);
+ }
}
void InspectMessageHandler::HandleOpenCommand(const base::Value::List& args) {
std::string source_id;
std::string browser_id;
std::string url;
- if (ParseStringArgs(args, &source_id, &browser_id, &url))
+ if (ParseStringArgs(args, &source_id, &browser_id, &url)) {
inspect_ui_->Open(source_id, browser_id, url);
+ }
}
void InspectMessageHandler::HandlePauseCommand(const base::Value::List& args) {
std::string source;
std::string id;
- if (ParseStringArgs(args, &source, &id))
+ if (ParseStringArgs(args, &source, &id)) {
inspect_ui_->Pause(source, id);
+ }
}
void InspectMessageHandler::HandleInspectBrowserCommand(
@@ -400,8 +407,8 @@
std::string browser_id;
std::string front_end;
if (ParseStringArgs(args, &source_id, &browser_id, &front_end)) {
- inspect_ui_->InspectBrowserWithCustomFrontend(
- source_id, browser_id, GURL(front_end));
+ inspect_ui_->InspectBrowserWithCustomFrontend(source_id, browser_id,
+ GURL(front_end));
}
}
@@ -409,41 +416,48 @@
const char* pref_name,
const base::Value::List& args) {
Profile* profile = Profile::FromWebUI(web_ui());
- if (!profile)
+ if (!profile) {
return;
+ }
- if (args.size() == 1 && args[0].is_bool())
+ if (args.size() == 1 && args[0].is_bool()) {
profile->GetPrefs()->SetBoolean(pref_name, args[0].GetBool());
+ }
}
void InspectMessageHandler::HandlePortForwardingConfigCommand(
const base::Value::List& args) {
Profile* profile = Profile::FromWebUI(web_ui());
- if (!profile)
+ if (!profile) {
return;
+ }
if (args.size() == 1) {
const base::Value& src = args[0];
- if (src.is_dict())
+ if (src.is_dict()) {
profile->GetPrefs()->Set(prefs::kDevToolsPortForwardingConfig, src);
+ }
}
}
void InspectMessageHandler::HandleTCPDiscoveryConfigCommand(
const base::Value::List& args) {
Profile* profile = Profile::FromWebUI(web_ui());
- if (!profile)
+ if (!profile) {
return;
+ }
- if (args.size() == 1u && args[0].is_list())
+ if (args.size() == 1u && args[0].is_list()) {
profile->GetPrefs()->Set(prefs::kDevToolsTCPDiscoveryConfig, args[0]);
+ }
}
void InspectMessageHandler::HandleOpenNodeFrontendCommand(
const base::Value::List& args) {
Profile* profile = Profile::FromWebUI(web_ui());
- if (!profile)
+ if (!profile) {
return;
+ }
DevToolsWindow::OpenNodeFrontendWindow(profile,
DevToolsOpenedByAction::kInspectLink);
}
@@ -459,16 +473,18 @@
ChromeBrowserMainExtraPartsViews::Get()->GetUiDevToolsServerInstance();
server->SetOnSessionEnded(base::BindOnce([]() {
if (ChromeBrowserMainExtraPartsViews::Get()
- ->GetUiDevToolsServerInstance())
+ ->GetUiDevToolsServerInstance()) {
ChromeBrowserMainExtraPartsViews::Get()->DestroyUiDevTools();
+ }
}));
}
inspect_ui_->PopulateNativeUITargets(GetUiDevToolsTargets());
std::vector<ui_devtools::UiDevToolsServer::NameUrlPair> pairs =
ui_devtools::UiDevToolsServer::GetClientNamesAndUrls();
- if (!pairs.empty())
+ if (!pairs.empty()) {
CreateNativeUIInspectionSession(pairs[0].second);
+ }
}
void InspectMessageHandler::HandleSetBubbleLocking(
@@ -556,8 +572,9 @@
void InspectUI::Activate(const std::string& source_id,
const std::string& target_id) {
scoped_refptr<DevToolsAgentHost> target = FindTarget(source_id, target_id);
- if (target)
+ if (target) {
target->Activate();
+ }
}
void InspectUI::Close(const std::string& source_id,
@@ -566,24 +583,27 @@
if (target) {
target->Close();
DevToolsTargetsUIHandler* handler = FindTargetHandler(source_id);
- if (handler)
+ if (handler) {
handler->ForceUpdate();
+ }
}
}
void InspectUI::Reload(const std::string& source_id,
const std::string& target_id) {
scoped_refptr<DevToolsAgentHost> target = FindTarget(source_id, target_id);
- if (target)
+ if (target) {
target->Reload();
+ }
}
void InspectUI::Open(const std::string& source_id,
const std::string& browser_id,
const std::string& url) {
DevToolsTargetsUIHandler* handler = FindTargetHandler(source_id);
- if (handler)
+ if (handler) {
handler->Open(browser_id, url);
+ }
}
void InspectUI::Pause(const std::string& source_id,
@@ -597,10 +617,9 @@
}
}
-void InspectUI::InspectBrowserWithCustomFrontend(
- const std::string& source_id,
- const std::string& browser_id,
- const GURL& frontend_url) {
+void InspectUI::InspectBrowserWithCustomFrontend(const std::string& source_id,
+ const std::string& browser_id,
+ const GURL& frontend_url) {
if (!frontend_url.SchemeIs(content::kChromeUIScheme) &&
!frontend_url.SchemeIs(content::kChromeDevToolsScheme) &&
frontend_url.host() != kInspectUiLocalHost) {
@@ -608,14 +627,16 @@
}
DevToolsTargetsUIHandler* handler = FindTargetHandler(source_id);
- if (!handler)
+ if (!handler) {
return;
+ }
// Fetch agent host from remote browser.
scoped_refptr<content::DevToolsAgentHost> agent_host =
handler->GetBrowserAgentHost(browser_id);
- if (agent_host->IsAttached())
+ if (agent_host->IsAttached()) {
return;
+ }
// Create web contents for the front-end.
WebContents* inspect_ui = web_ui()->GetWebContents();
@@ -643,8 +664,9 @@
}
void InspectUI::StartListeningNotifications() {
- if (!target_handlers_.empty()) // Possible when reloading the page.
+ if (!target_handlers_.empty()) { // Possible when reloading the page.
StopListeningNotifications();
+ }
Profile* profile = Profile::FromWebUI(web_ui());
@@ -696,8 +718,9 @@
}
void InspectUI::StopListeningNotifications() {
- if (target_handlers_.empty())
+ if (target_handlers_.empty()) {
return;
+ }
target_handlers_.clear();
@@ -747,8 +770,9 @@
auto default_set =
GetPrefValue(prefs::kDevToolsPortForwardingDefaultSet)->GetIfBool();
- if (!default_set || default_set.value())
+ if (!default_set || default_set.value()) {
return;
+ }
// This is the first chrome://inspect invocation on a fresh profile or after
// upgrade from a version that did not have kDevToolsPortForwardingDefaultSet.
@@ -756,17 +780,20 @@
auto enabled =
GetPrefValue(prefs::kDevToolsPortForwardingEnabled)->GetIfBool();
- if (!enabled)
+ if (!enabled) {
return;
+ }
const base::Value::Dict* config =
GetPrefValue(prefs::kDevToolsPortForwardingConfig)->GetIfDict();
- if (!config)
+ if (!config) {
return;
+ }
// Do nothing if user already took explicit action.
- if (enabled.value() || !config->empty())
+ if (enabled.value() || !config->empty()) {
return;
+ }
base::Value::Dict default_config;
default_config.Set(kInspectUiPortForwardingDefaultPort,
@@ -793,10 +820,11 @@
}
scoped_refptr<content::DevToolsAgentHost> InspectUI::FindTarget(
- const std::string& source_id, const std::string& target_id) {
+ const std::string& source_id,
+ const std::string& target_id) {
auto it = target_handlers_.find(source_id);
- return it != target_handlers_.end() ?
- it->second->GetTarget(target_id) : nullptr;
+ return it != target_handlers_.end() ? it->second->GetTarget(target_id)
+ : nullptr;
}
void InspectUI::PopulateTargets(const std::string& source,
diff --git a/chrome/browser/ui/webui/inspect_ui.h b/chrome/browser/ui/webui/inspect_ui.h
index 5ac5aee..96e683b 100644
--- a/chrome/browser/ui/webui/inspect_ui.h
+++ b/chrome/browser/ui/webui/inspect_ui.h
@@ -57,10 +57,9 @@
const std::string& browser_id,
const std::string& url);
void Pause(const std::string& source_id, const std::string& target_id);
- void InspectBrowserWithCustomFrontend(
- const std::string& source_id,
- const std::string& browser_id,
- const GURL& frontend_url);
+ void InspectBrowserWithCustomFrontend(const std::string& source_id,
+ const std::string& browser_id,
+ const GURL& frontend_url);
void PopulateNativeUITargets(const base::Value::List& targets);
void ShowNativeUILaunchButton(bool enabled);
@@ -88,8 +87,7 @@
void AddTargetUIHandler(std::unique_ptr<DevToolsTargetsUIHandler> handler);
- DevToolsTargetsUIHandler* FindTargetHandler(
- const std::string& source_id);
+ DevToolsTargetsUIHandler* FindTargetHandler(const std::string& source_id);
scoped_refptr<content::DevToolsAgentHost> FindTarget(
const std::string& source_id,
const std::string& target_id);
diff --git a/chrome/browser/ui/webui/internals/internals_ui.cc b/chrome/browser/ui/webui/internals/internals_ui.cc
index c420812..c35effc 100644
--- a/chrome/browser/ui/webui/internals/internals_ui.cc
+++ b/chrome/browser/ui/webui/internals/internals_ui.cc
@@ -25,8 +25,9 @@
bool ShouldHandleWebUIRequestCallback(const std::string& path) {
#if BUILDFLAG(ENABLE_SESSION_SERVICE)
- if (SessionServiceInternalsHandler::ShouldHandleWebUIRequestCallback(path))
+ if (SessionServiceInternalsHandler::ShouldHandleWebUIRequestCallback(path)) {
return true;
+ }
#endif
return false;
}
diff --git a/chrome/browser/ui/webui/interstitials/interstitial_ui.cc b/chrome/browser/ui/webui/interstitials/interstitial_ui.cc
index 18ace87..a58c87f 100644
--- a/chrome/browser/ui/webui/interstitials/interstitial_ui.cc
+++ b/chrome/browser/ui/webui/interstitials/interstitial_ui.cc
@@ -173,12 +173,14 @@
ssl_info.cert = ssl_info.unverified_cert = CreateFakeCert();
// This delegate doesn't create an interstitial.
int options_mask = 0;
- if (overridable)
+ if (overridable) {
options_mask |=
security_interstitials::SSLErrorOptionsMask::SOFT_OVERRIDE_ENABLED;
- if (strict_enforcement)
+ }
+ if (strict_enforcement) {
options_mask |=
security_interstitials::SSLErrorOptionsMask::STRICT_ENFORCEMENT;
+ }
ChromeSecurityBlockingPageFactory blocking_page_factory;
return blocking_page_factory.CreateSSLPage(web_contents, cert_error, ssl_info,
request_url, options_mask,
@@ -442,8 +444,9 @@
std::string url_param;
if (net::GetValueForKeyInQuery(web_contents->GetVisibleURL(), "url",
&url_param)) {
- if (GURL(url_param).is_valid())
+ if (GURL(url_param).is_valid()) {
request_url = GURL(url_param);
+ }
}
std::string type_param;
bool is_giant_webview = false;
@@ -503,14 +506,16 @@
std::string request_url_param;
if (net::GetValueForKeyInQuery(web_contents->GetVisibleURL(), "url",
&request_url_param)) {
- if (GURL(request_url_param).is_valid())
+ if (GURL(request_url_param).is_valid()) {
request_url = GURL(request_url_param);
+ }
}
std::string landing_url_param;
if (net::GetValueForKeyInQuery(web_contents->GetVisibleURL(), "landing_page",
&landing_url_param)) {
- if (GURL(landing_url_param).is_valid())
+ if (GURL(landing_url_param).is_valid()) {
landing_url = GURL(landing_url_param);
+ }
}
std::string wifi_connection_param;
if (net::GetValueForKeyInQuery(web_contents->GetVisibleURL(), "is_wifi",
diff --git a/chrome/browser/ui/webui/managed_ui_handler.cc b/chrome/browser/ui/webui/managed_ui_handler.cc
index 5a9861e..7469214 100644
--- a/chrome/browser/ui/webui/managed_ui_handler.cc
+++ b/chrome/browser/ui/webui/managed_ui_handler.cc
@@ -79,8 +79,9 @@
// Manually add/remove observers. ScopedObserver doesn't work with
// PolicyService::Observer because AddObserver() takes 2 arguments.
void ManagedUIHandler::AddObservers() {
- if (has_observers_)
+ if (has_observers_) {
return;
+ }
has_observers_ = true;
@@ -96,8 +97,9 @@
}
void ManagedUIHandler::RemoveObservers() {
- if (!has_observers_)
+ if (!has_observers_) {
return;
+ }
has_observers_ = false;
@@ -124,8 +126,9 @@
void ManagedUIHandler::NotifyIfChanged() {
bool managed = chrome::ShouldDisplayManagedUi(profile_);
- if (managed == managed_)
+ if (managed == managed_) {
return;
+ }
managed_ = managed;
FireWebUIListener("is-managed-changed", base::Value(managed));
content::WebUIDataSource::Update(profile_, source_name_,
diff --git a/chrome/browser/ui/webui/management/management_ui_handler.cc b/chrome/browser/ui/webui/management/management_ui_handler.cc
index 0482385..36a13ec 100644
--- a/chrome/browser/ui/webui/management/management_ui_handler.cc
+++ b/chrome/browser/ui/webui/management/management_ui_handler.cc
@@ -424,17 +424,17 @@
const char* title;
const char* permission;
} analysis_connector_permissions[] = {
- {enterprise_connectors::FILE_ATTACHED, kManagementOnFileAttachedEvent,
- kManagementOnFileAttachedVisibleData},
- {enterprise_connectors::FILE_DOWNLOADED, kManagementOnFileDownloadedEvent,
- kManagementOnFileDownloadedVisibleData},
- {enterprise_connectors::BULK_DATA_ENTRY, kManagementOnBulkDataEntryEvent,
- kManagementOnBulkDataEntryVisibleData},
- {enterprise_connectors::PRINT, kManagementOnPrintEvent,
- kManagementOnPrintVisibleData},
+ {enterprise_connectors::FILE_ATTACHED, kManagementOnFileAttachedEvent,
+ kManagementOnFileAttachedVisibleData},
+ {enterprise_connectors::FILE_DOWNLOADED, kManagementOnFileDownloadedEvent,
+ kManagementOnFileDownloadedVisibleData},
+ {enterprise_connectors::BULK_DATA_ENTRY, kManagementOnBulkDataEntryEvent,
+ kManagementOnBulkDataEntryVisibleData},
+ {enterprise_connectors::PRINT, kManagementOnPrintEvent,
+ kManagementOnPrintVisibleData},
#if BUILDFLAG(IS_CHROMEOS)
- {enterprise_connectors::FILE_TRANSFER, kManagementOnFileTransferEvent,
- kManagementOnFileTransferVisibleData},
+ {enterprise_connectors::FILE_TRANSFER, kManagementOnFileTransferEvent,
+ kManagementOnFileTransferVisibleData},
#endif
};
auto* connectors_service =
diff --git a/chrome/browser/ui/webui/management/management_ui_handler.h b/chrome/browser/ui/webui/management/management_ui_handler.h
index be64efa..af389f9 100644
--- a/chrome/browser/ui/webui/management/management_ui_handler.h
+++ b/chrome/browser/ui/webui/management/management_ui_handler.h
@@ -120,7 +120,6 @@
const extensions::Extension* extension,
extensions::UnloadedExtensionReason reason) override;
-
// policy::PolicyService::Observer
void OnPolicyUpdated(const policy::PolicyNamespace& ns,
const policy::PolicyMap& previous,
diff --git a/chrome/browser/ui/webui/management/management_ui_handler_chromeos.h b/chrome/browser/ui/webui/management/management_ui_handler_chromeos.h
index 0f98c73..6b553237 100644
--- a/chrome/browser/ui/webui/management/management_ui_handler_chromeos.h
+++ b/chrome/browser/ui/webui/management/management_ui_handler_chromeos.h
@@ -20,9 +20,8 @@
class SecureDnsManager;
}
-class ManagementUIHandlerChromeOS :
- public BitmapFetcherDelegate,
- public ManagementUIHandler {
+class ManagementUIHandlerChromeOS : public BitmapFetcherDelegate,
+ public ManagementUIHandler {
public:
explicit ManagementUIHandlerChromeOS(Profile* profile);
ManagementUIHandlerChromeOS(const ManagementUIHandlerChromeOS&) = delete;
diff --git a/chrome/browser/ui/webui/management/management_ui_handler_unittest.cc b/chrome/browser/ui/webui/management/management_ui_handler_unittest.cc
index 1874dcc..9c8395a 100644
--- a/chrome/browser/ui/webui/management/management_ui_handler_unittest.cc
+++ b/chrome/browser/ui/webui/management/management_ui_handler_unittest.cc
@@ -1625,8 +1625,8 @@
std::set<std::string> expected_messages = {
kProfileReportingOverview, kProfileReportingUsername,
- kProfileReportingBrowser, kProfileReportingExtension,
- kProfileReportingPolicy, kProfileReportingLearnMore};
+ kProfileReportingBrowser, kProfileReportingExtension,
+ kProfileReportingPolicy, kProfileReportingLearnMore};
ASSERT_PRED_FORMAT2(MessagesToBeEQ,
handler_.GetReportingInfo(/*can_collect_signals=*/false,
diff --git a/chrome/browser/ui/webui/media/media_engagement_ui.cc b/chrome/browser/ui/webui/media/media_engagement_ui.cc
index dcdc28b..e3f04aa 100644
--- a/chrome/browser/ui/webui/media/media_engagement_ui.cc
+++ b/chrome/browser/ui/webui/media/media_engagement_ui.cc
@@ -115,8 +115,9 @@
std::vector<component_updater::ComponentInfo> info = cus->GetComponents();
for (const auto& component : info) {
- if (component.id == kPreloadComponentID)
+ if (component.id == kPreloadComponentID) {
return component.version.GetString();
+ }
}
return std::string();
diff --git a/chrome/browser/ui/webui/media/webrtc_logs_ui.cc b/chrome/browser/ui/webui/media/webrtc_logs_ui.cc
index f191b77c..538ac79 100644
--- a/chrome/browser/ui/webui/media/webrtc_logs_ui.cc
+++ b/chrome/browser/ui/webui/media/webrtc_logs_ui.cc
@@ -305,8 +305,9 @@
// If we haven't set |value_w| above, we fall back on the upload time, which
// was already in the variable. In case it's empty set the string to
// inform that the time is unknown.
- if (value_w.empty())
+ if (value_w.empty()) {
value_w = std::u16string(u"(unknown time)");
+ }
upload_value.Set("capture_time", value_w);
result.Append(std::move(upload_value));
diff --git a/chrome/browser/ui/webui/metrics_handler.cc b/chrome/browser/ui/webui/metrics_handler.cc
index 3f5737d..64675006 100644
--- a/chrome/browser/ui/webui/metrics_handler.cc
+++ b/chrome/browser/ui/webui/metrics_handler.cc
@@ -69,10 +69,9 @@
// As |histogram_name| may change between calls, the UMA_HISTOGRAM_ENUMERATION
// macro cannot be used here.
- base::HistogramBase* counter =
- base::LinearHistogram::FactoryGet(
- histogram_name, 1, int_boundary_value, bucket_count + 1,
- base::HistogramBase::kUmaTargetedHistogramFlag);
+ base::HistogramBase* counter = base::LinearHistogram::FactoryGet(
+ histogram_name, 1, int_boundary_value, bucket_count + 1,
+ base::HistogramBase::kUmaTargetedHistogramFlag);
counter->Add(int_value);
}
diff --git a/chrome/browser/ui/webui/metrics_reporter/metrics_reporter_unittest.cc b/chrome/browser/ui/webui/metrics_reporter/metrics_reporter_unittest.cc
index a0649e5d..313e431 100644
--- a/chrome/browser/ui/webui/metrics_reporter/metrics_reporter_unittest.cc
+++ b/chrome/browser/ui/webui/metrics_reporter/metrics_reporter_unittest.cc
@@ -52,8 +52,9 @@
[](std::optional<base::TimeTicks> expected_time,
std::optional<base::TimeDelta> time) {
EXPECT_EQ(expected_time.has_value(), time.has_value());
- if (time.has_value())
+ if (time.has_value()) {
EXPECT_EQ(time, expected_time->since_origin());
+ }
},
expected_time);
}
diff --git a/chrome/browser/ui/webui/metrics_reporter/mock_metrics_reporter.h b/chrome/browser/ui/webui/metrics_reporter/mock_metrics_reporter.h
index ff2d7e31..8b9feba7 100644
--- a/chrome/browser/ui/webui/metrics_reporter/mock_metrics_reporter.h
+++ b/chrome/browser/ui/webui/metrics_reporter/mock_metrics_reporter.h
@@ -6,7 +6,6 @@
#define CHROME_BROWSER_UI_WEBUI_METRICS_REPORTER_MOCK_METRICS_REPORTER_H_
#include "chrome/browser/ui/webui/metrics_reporter/metrics_reporter.h"
-
#include "testing/gmock/include/gmock/gmock.h"
class MockMetricsReporter : public MetricsReporter {
diff --git a/chrome/browser/ui/webui/nacl_ui.cc b/chrome/browser/ui/webui/nacl_ui.cc
index 04c797cb..cb64901 100644
--- a/chrome/browser/ui/webui/nacl_ui.cc
+++ b/chrome/browser/ui/webui/nacl_ui.cc
@@ -142,8 +142,7 @@
NaClDomHandler::NaClDomHandler()
: has_plugin_info_(false),
pnacl_path_validated_(false),
- pnacl_path_exists_(false) {
-}
+ pnacl_path_exists_(false) {}
NaClDomHandler::~NaClDomHandler() = default;
@@ -176,8 +175,8 @@
bool NaClDomHandler::isPluginEnabled(size_t plugin_index) {
std::vector<content::WebPluginInfo> info_array;
- PluginService::GetInstance()->GetPluginInfoArray(
- GURL(), "application/x-nacl", false, &info_array, NULL);
+ PluginService::GetInstance()->GetPluginInfoArray(GURL(), "application/x-nacl",
+ false, &info_array, NULL);
PluginPrefs* plugin_prefs =
PluginPrefs::GetForProfile(Profile::FromWebUI(web_ui())).get();
return (!info_array.empty() &&
@@ -202,8 +201,8 @@
void NaClDomHandler::AddPluginList(base::Value::List* list) {
// Obtain the version of the NaCl plugin.
std::vector<content::WebPluginInfo> info_array;
- PluginService::GetInstance()->GetPluginInfoArray(
- GURL(), "application/x-nacl", false, &info_array, NULL);
+ PluginService::GetInstance()->GetPluginInfoArray(GURL(), "application/x-nacl",
+ false, &info_array, NULL);
std::u16string nacl_version;
std::u16string nacl_key = u"NaCl plugin";
if (info_array.empty()) {
@@ -256,9 +255,8 @@
void NaClDomHandler::AddNaClInfo(base::Value::List* list) {
std::u16string nacl_enabled_string = u"Disabled";
- if (isPluginEnabled(0) &&
- base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableNaCl)) {
+ if (isPluginEnabled(0) && base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableNaCl)) {
nacl_enabled_string = u"Enabled by flag '--enable-nacl'";
}
AddPair(list, u"Native Client (non-portable, outside web store)",
@@ -319,14 +317,16 @@
JSONFileValueDeserializer deserializer(pnacl_json_path);
std::string error;
std::unique_ptr<base::Value> root = deserializer.Deserialize(nullptr, &error);
- if (!root || !root->is_dict())
+ if (!root || !root->is_dict()) {
return;
+ }
// Now try to get the field. This may leave version empty if the
// the "get" fails (no key, or wrong type).
if (const std::string* ptr = root->GetDict().FindString("pnacl-version")) {
- if (base::IsStringASCII(*ptr))
+ if (base::IsStringASCII(*ptr)) {
*version = *ptr;
+ }
}
}
@@ -344,8 +344,9 @@
void NaClDomHandler::MaybeRespondToPage() {
// Don't reply until everything is ready. The page will show a 'loading'
// message until then.
- if (callback_id_.empty() || !has_plugin_info_)
+ if (callback_id_.empty() || !has_plugin_info_) {
return;
+ }
if (!pnacl_path_validated_) {
std::string* version_string = new std::string;
diff --git a/chrome/browser/ui/webui/nearby_internals/nearby_internals_contact_handler.cc b/chrome/browser/ui/webui/nearby_internals/nearby_internals_contact_handler.cc
index 05b57a6..86d7e23 100644
--- a/chrome/browser/ui/webui/nearby_internals/nearby_internals_contact_handler.cc
+++ b/chrome/browser/ui/webui/nearby_internals/nearby_internals_contact_handler.cc
@@ -67,8 +67,9 @@
if (contacts) {
base::Value::List contact_list;
contact_list.reserve(contacts->size());
- for (const auto& contact : *contacts)
+ for (const auto& contact : *contacts) {
contact_list.Append(ContactRecordToReadableDictionary(contact));
+ }
dictionary.Set(kContactMessageContactRecordKey,
FormatListAsJSON(contact_list));
diff --git a/chrome/browser/ui/webui/nearby_internals/nearby_internals_prefs_handler.cc b/chrome/browser/ui/webui/nearby_internals/nearby_internals_prefs_handler.cc
index 09ffb09..ce0b32b2 100644
--- a/chrome/browser/ui/webui/nearby_internals/nearby_internals_prefs_handler.cc
+++ b/chrome/browser/ui/webui/nearby_internals/nearby_internals_prefs_handler.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "chrome/browser/ui/webui/nearby_internals/nearby_internals_prefs_handler.h"
+
#include "base/functional/bind.h"
#include "chrome/browser/nearby_sharing/common/nearby_share_prefs.h"
#include "chrome/browser/profiles/profile.h"
diff --git a/chrome/browser/ui/webui/nearby_internals/quick_pair/quick_pair_handler.h b/chrome/browser/ui/webui/nearby_internals/quick_pair/quick_pair_handler.h
index e2045b01a..c5b871e4 100644
--- a/chrome/browser/ui/webui/nearby_internals/quick_pair/quick_pair_handler.h
+++ b/chrome/browser/ui/webui/nearby_internals/quick_pair/quick_pair_handler.h
@@ -6,6 +6,7 @@
#define CHROME_BROWSER_UI_WEBUI_NEARBY_INTERNALS_QUICK_PAIR_QUICK_PAIR_HANDLER_H_
#include <memory>
+
#include "ash/quick_pair/common/log_buffer.h"
#include "ash/quick_pair/common/logging.h"
#include "base/functional/callback.h"
diff --git a/chrome/browser/ui/webui/nearby_share/nearby_share_dialog_ui.cc b/chrome/browser/ui/webui/nearby_share/nearby_share_dialog_ui.cc
index 666b09b..fb55218 100644
--- a/chrome/browser/ui/webui/nearby_share/nearby_share_dialog_ui.cc
+++ b/chrome/browser/ui/webui/nearby_share/nearby_share_dialog_ui.cc
@@ -57,8 +57,9 @@
bool NearbyShareDialogUIConfig::IsWebUIEnabled(
content::BrowserContext* browser_context) {
- if (browser_context->IsOffTheRecord())
+ if (browser_context->IsOffTheRecord()) {
return false;
+ }
return NearbySharingServiceFactory::IsNearbyShareSupportedForBrowserContext(
browser_context);
}
@@ -191,8 +192,9 @@
}
void NearbyShareDialogUI::HandleClose(const base::Value::List& args) {
- if (!sharesheet_controller_)
+ if (!sharesheet_controller_) {
return;
+ }
CHECK_EQ(1u, args.size());
CHECK_GE(args[0].GetInt(), 0);
diff --git a/chrome/browser/ui/webui/nearby_share/nearby_share_dialog_ui_browsertest.cc b/chrome/browser/ui/webui/nearby_share/nearby_share_dialog_ui_browsertest.cc
index fcf9af58..ebc8aee 100644
--- a/chrome/browser/ui/webui/nearby_share/nearby_share_dialog_ui_browsertest.cc
+++ b/chrome/browser/ui/webui/nearby_share/nearby_share_dialog_ui_browsertest.cc
@@ -2,13 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "chrome/browser/ui/webui/nearby_share/nearby_share_dialog_ui.h"
+
#include "base/strings/stringprintf.h"
#include "chrome/browser/nearby_sharing/common/nearby_share_features.h"
#include "chrome/browser/sharesheet/sharesheet_controller.h"
#include "chrome/browser/sharesheet/sharesheet_types.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
-#include "chrome/browser/ui/webui/nearby_share/nearby_share_dialog_ui.h"
#include "chrome/common/webui_url_constants.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
diff --git a/chrome/browser/ui/webui/net_export_ui.cc b/chrome/browser/ui/webui/net_export_ui.cc
index 42a584f..24c1decd 100644
--- a/chrome/browser/ui/webui/net_export_ui.cc
+++ b/chrome/browser/ui/webui/net_export_ui.cc
@@ -58,8 +58,8 @@
namespace {
// May only be accessed on the UI thread
-base::LazyInstance<base::FilePath>::Leaky
- last_save_dir = LAZY_INSTANCE_INITIALIZER;
+base::LazyInstance<base::FilePath>::Leaky last_save_dir =
+ LAZY_INSTANCE_INITIALIZER;
void CreateAndAddNetExportHTMLSource(Profile* profile) {
content::WebUIDataSource* source = content::WebUIDataSource::CreateAndAdd(
@@ -160,8 +160,9 @@
NetExportMessageHandler::~NetExportMessageHandler() {
// There may be a pending file dialog, it needs to be told that the user
// has gone away so that it doesn't try to call back.
- if (select_file_dialog_)
+ if (select_file_dialog_) {
select_file_dialog_->ListenerDestroyed();
+ }
file_writer_->StopNetLog();
}
@@ -223,10 +224,12 @@
if (UsingMobileUI()) {
StartNetLog(base::FilePath());
} else {
- base::FilePath initial_dir = last_save_dir.Pointer()->empty() ?
- DownloadPrefs::FromBrowserContext(
- web_ui()->GetWebContents()->GetBrowserContext())->DownloadPath() :
- *last_save_dir.Pointer();
+ base::FilePath initial_dir =
+ last_save_dir.Pointer()->empty()
+ ? DownloadPrefs::FromBrowserContext(
+ web_ui()->GetWebContents()->GetBrowserContext())
+ ->DownloadPath()
+ : *last_save_dir.Pointer();
base::FilePath initial_path =
initial_dir.Append(FILE_PATH_LITERAL("chrome-net-export-log.json"));
ShowSelectFileDialog(initial_path);
@@ -290,8 +293,9 @@
void NetExportMessageHandler::SendEmail(const base::FilePath& file_to_send) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
#if BUILDFLAG(IS_ANDROID)
- if (file_to_send.empty())
+ if (file_to_send.empty()) {
return;
+ }
std::string email;
std::string subject = "net_internals_log";
std::string title = "Issue number: ";
@@ -318,8 +322,9 @@
void NetExportMessageHandler::ShowFileInShell(const base::FilePath& path) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
- if (path.empty())
+ if (path.empty()) {
return;
+ }
// (The |profile| parameter is relevant for Chrome OS)
Profile* profile = Profile::FromWebUI(web_ui());
@@ -347,8 +352,9 @@
const base::FilePath& default_path) {
// User may have clicked more than once before the save dialog appears.
// This prevents creating more than one save dialog.
- if (select_file_dialog_)
+ if (select_file_dialog_) {
return;
+ }
WebContents* webcontents = web_ui()->GetWebContents();
diff --git a/chrome/browser/ui/webui/net_internals/net_internals_ui.cc b/chrome/browser/ui/webui/net_internals/net_internals_ui.cc
index e49e417f..8eab6ab 100644
--- a/chrome/browser/ui/webui/net_internals/net_internals_ui.cc
+++ b/chrome/browser/ui/webui/net_internals/net_internals_ui.cc
@@ -554,7 +554,6 @@
} // namespace
-
////////////////////////////////////////////////////////////////////////////////
//
// NetInternalsUI
diff --git a/chrome/browser/ui/webui/net_internals/net_internals_ui_browsertest.cc b/chrome/browser/ui/webui/net_internals/net_internals_ui_browsertest.cc
index 535c12e..869b009 100644
--- a/chrome/browser/ui/webui/net_internals/net_internals_ui_browsertest.cc
+++ b/chrome/browser/ui/webui/net_internals/net_internals_ui_browsertest.cc
@@ -376,8 +376,9 @@
ASSERT_TRUE(browser());
auto resolve_host_parameters = network::mojom::ResolveHostParameters::New();
- if (local)
+ if (local) {
resolve_host_parameters->source = net::HostResolverSource::LOCAL_ONLY;
+ }
mojo::PendingRemote<network::mojom::ResolveHostClient> client;
// DnsLookupClient owns itself.
new DnsLookupClient(
diff --git a/chrome/browser/ui/webui/new_tab_page/foo/foo_handler.cc b/chrome/browser/ui/webui/new_tab_page/foo/foo_handler.cc
index 9cd81b06..ba5042a 100644
--- a/chrome/browser/ui/webui/new_tab_page/foo/foo_handler.cc
+++ b/chrome/browser/ui/webui/new_tab_page/foo/foo_handler.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "chrome/browser/ui/webui/new_tab_page/foo/foo_handler.h"
+
#include "base/strings/string_number_conversions.h"
FooHandler::FooHandler(mojo::PendingReceiver<foo::mojom::FooHandler> handler)
diff --git a/chrome/browser/ui/webui/new_tab_page/new_tab_page_handler.cc b/chrome/browser/ui/webui/new_tab_page/new_tab_page_handler.cc
index c4844a9..4b9e5ff 100644
--- a/chrome/browser/ui/webui/new_tab_page/new_tab_page_handler.cc
+++ b/chrome/browser/ui/webui/new_tab_page/new_tab_page_handler.cc
@@ -344,12 +344,14 @@
// PromoService to base::Value. The middle-slot promo part is then reencoded
// from base::Value to a JSON string stored in |data.middle_slot_json|.
auto middle_slot = base::JSONReader::Read(data.middle_slot_json);
- if (!middle_slot.has_value())
+ if (!middle_slot.has_value()) {
return nullptr;
+ }
base::Value::Dict& middle_slot_dict = middle_slot->GetDict();
- if (middle_slot_dict.FindBoolByDottedPath("hidden").value_or(false))
+ if (middle_slot_dict.FindBoolByDottedPath("hidden").value_or(false)) {
return nullptr;
+ }
auto promo = new_tab_page::mojom::Promo::New();
promo->id = data.promo_id;
@@ -682,8 +684,9 @@
void NewTabPageHandler::ChooseLocalCustomBackground(
ChooseLocalCustomBackgroundCallback callback) {
// Early return if the select file dialog is already active.
- if (select_file_dialog_)
+ if (select_file_dialog_) {
return;
+ }
select_file_dialog_ = ui::SelectFileDialog::Create(
this, std::make_unique<ChromeSelectFilePolicy>(web_contents_));
@@ -744,8 +747,9 @@
base::Value::List& list = update.Get();
base::Value module_id_value(module_id);
if (disabled) {
- if (!base::Contains(list, module_id_value))
+ if (!base::Contains(list, module_id_value)) {
list.Append(std::move(module_id_value));
+ }
} else {
list.EraseValue(module_id_value);
}
@@ -1275,8 +1279,9 @@
LogEvent(NTP_CUSTOMIZE_LOCAL_IMAGE_DONE);
LogEvent(NTP_BACKGROUND_UPLOAD_DONE);
- if (choose_local_custom_background_callback_)
+ if (choose_local_custom_background_callback_) {
std::move(choose_local_custom_background_callback_).Run(true);
+ }
}
void NewTabPageHandler::FileSelectionCanceled() {
@@ -1286,8 +1291,9 @@
// with the event.
LogEvent(NTP_CUSTOMIZE_LOCAL_IMAGE_CANCEL);
LogEvent(NTP_BACKGROUND_UPLOAD_CANCEL);
- if (choose_local_custom_background_callback_)
+ if (choose_local_custom_background_callback_) {
std::move(choose_local_custom_background_callback_).Run(false);
+ }
}
void NewTabPageHandler::OnTabInterfaceChanged() {
@@ -1335,8 +1341,7 @@
logo->metadata.type, logo->dark_encoded_image->as_string(),
logo->metadata.dark_mime_type, logo->metadata.dark_animated_url,
logo->metadata.dark_width_px, logo->metadata.dark_height_px,
- logo->metadata.dark_background_color,
- logo->metadata.dark_log_url,
+ logo->metadata.dark_background_color, logo->metadata.dark_log_url,
logo->metadata.dark_cta_log_url);
}
if (logo->metadata.on_click_url.is_valid()) {
diff --git a/chrome/browser/ui/webui/new_tab_page/new_tab_page_ui.cc b/chrome/browser/ui/webui/new_tab_page/new_tab_page_ui.cc
index 3092de6..8e20b994 100644
--- a/chrome/browser/ui/webui/new_tab_page/new_tab_page_ui.cc
+++ b/chrome/browser/ui/webui/new_tab_page/new_tab_page_ui.cc
@@ -649,8 +649,9 @@
void NewTabPageUI::BindInterface(
mojo::PendingReceiver<browser_command::mojom::CommandHandlerFactory>
pending_receiver) {
- if (browser_command_factory_receiver_.is_bound())
+ if (browser_command_factory_receiver_.is_bound()) {
browser_command_factory_receiver_.reset();
+ }
browser_command_factory_receiver_.Bind(std::move(pending_receiver));
}
@@ -786,8 +787,9 @@
// should not directly access any member variables.
void NewTabPageUI::OnColorProviderChanged() {
base::Value::Dict update;
- if (!web_contents() || !web_ui())
+ if (!web_contents() || !web_ui()) {
return;
+ }
const ui::ColorProvider& color_provider = web_contents()->GetColorProvider();
auto background_color = color_provider.GetColor(kColorNewTabPageBackground);
update.Set("backgroundColor", skia::SkColorToHexString(background_color));
diff --git a/chrome/browser/ui/webui/new_tab_page/new_tab_page_ui.h b/chrome/browser/ui/webui/new_tab_page/new_tab_page_ui.h
index f2abd4b..efc1b3a 100644
--- a/chrome/browser/ui/webui/new_tab_page/new_tab_page_ui.h
+++ b/chrome/browser/ui/webui/new_tab_page/new_tab_page_ui.h
@@ -96,14 +96,13 @@
bool IsWebUIEnabled(content::BrowserContext* browser_context) override;
};
-class NewTabPageUI
- : public ui::MojoWebUIController,
- public new_tab_page::mojom::PageHandlerFactory,
- public most_visited::mojom::MostVisitedPageHandlerFactory,
- public browser_command::mojom::CommandHandlerFactory,
- public help_bubble::mojom::HelpBubbleHandlerFactory,
- public NtpCustomBackgroundServiceObserver,
- content::WebContentsObserver {
+class NewTabPageUI : public ui::MojoWebUIController,
+ public new_tab_page::mojom::PageHandlerFactory,
+ public most_visited::mojom::MostVisitedPageHandlerFactory,
+ public browser_command::mojom::CommandHandlerFactory,
+ public help_bubble::mojom::HelpBubbleHandlerFactory,
+ public NtpCustomBackgroundServiceObserver,
+ content::WebContentsObserver {
public:
explicit NewTabPageUI(content::WebUI* web_ui);
diff --git a/chrome/browser/ui/webui/ntp/new_tab_ui.cc b/chrome/browser/ui/webui/ntp/new_tab_ui.cc
index 8f7f067..f18b4bb 100644
--- a/chrome/browser/ui/webui/ntp/new_tab_ui.cc
+++ b/chrome/browser/ui/webui/ntp/new_tab_ui.cc
@@ -73,8 +73,9 @@
const char kLTRHtmlTextDirection[] = "ltr";
const char* GetHtmlTextDirection(const std::u16string& text) {
- if (base::i18n::IsRTL() && base::i18n::StringContainsStrongRTLChars(text))
+ if (base::i18n::IsRTL() && base::i18n::StringContainsStrongRTLChars(text)) {
return kRTLHtmlTextDirection;
+ }
return kLTRHtmlTextDirection;
}
@@ -141,10 +142,11 @@
// title will be rendered as "!Yahoo" if its "dir" attribute is not set to
// "ltr".
std::string direction;
- if (using_url_as_the_title)
+ if (using_url_as_the_title) {
direction = kLTRHtmlTextDirection;
- else
+ } else {
direction = GetHtmlTextDirection(title);
+ }
dictionary->Set("title", title_to_set);
dictionary->Set("direction", direction);
diff --git a/chrome/browser/ui/webui/ntp/new_tab_ui_browsertest.cc b/chrome/browser/ui/webui/ntp/new_tab_ui_browsertest.cc
index 7b88870..1970e9a 100644
--- a/chrome/browser/ui/webui/ntp/new_tab_ui_browsertest.cc
+++ b/chrome/browser/ui/webui/ntp/new_tab_ui_browsertest.cc
@@ -45,9 +45,7 @@
class NewTabUIBrowserTest : public InProcessBrowserTest {
public:
- NewTabUIBrowserTest() {
- logging::SetLogMessageHandler(&HandleMessage);
- }
+ NewTabUIBrowserTest() { logging::SetLogMessageHandler(&HandleMessage); }
~NewTabUIBrowserTest() override { logging::SetLogMessageHandler(nullptr); }
diff --git a/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc b/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc
index b8fd352..9fa644a 100644
--- a/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc
+++ b/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc
@@ -156,19 +156,23 @@
NTPResourceCache::~NTPResourceCache() = default;
NTPResourceCache::WindowType NTPResourceCache::GetWindowType(Profile* profile) {
- if (profile->IsGuestSession())
+ if (profile->IsGuestSession()) {
return GUEST;
- if (profile->IsIncognitoProfile())
+ }
+ if (profile->IsIncognitoProfile()) {
return INCOGNITO;
- if (profile->IsOffTheRecord())
+ }
+ if (profile->IsOffTheRecord()) {
return NON_PRIMARY_OTR;
+ }
return NORMAL;
}
base::RefCountedMemory* NTPResourceCache::GetNewTabGuestHTML() {
- if (!new_tab_guest_html_)
+ if (!new_tab_guest_html_) {
CreateNewTabGuestHTML();
+ }
return new_tab_guest_html_.get();
}
@@ -182,8 +186,9 @@
return GetNewTabGuestHTML();
case INCOGNITO:
- if (!new_tab_incognito_html_)
+ if (!new_tab_incognito_html_) {
CreateNewTabIncognitoHTML(wc_getter);
+ }
return new_tab_incognito_html_.get();
case NON_PRIMARY_OTR:
@@ -204,19 +209,22 @@
DCHECK_CURRENTLY_ON(BrowserThread::UI);
// Guest mode doesn't have theme-related CSS.
- if (win_type == GUEST)
+ if (win_type == GUEST) {
return nullptr;
+ }
// Returns the cached CSS if it exists.
// The cache will be invalidated when the theme of |wc_getter| changes.
if (win_type == INCOGNITO) {
- if (!new_tab_incognito_css_)
+ if (!new_tab_incognito_css_) {
CreateNewTabIncognitoCSS(wc_getter);
+ }
return new_tab_incognito_css_.get();
}
- if (!new_tab_css_)
+ if (!new_tab_css_) {
CreateNewTabCSS(wc_getter);
+ }
return new_tab_css_.get();
}
diff --git a/chrome/browser/ui/webui/ntp/ntp_resource_cache.h b/chrome/browser/ui/webui/ntp/ntp_resource_cache.h
index cb0e238..0c6ac54 100644
--- a/chrome/browser/ui/webui/ntp/ntp_resource_cache.h
+++ b/chrome/browser/ui/webui/ntp/ntp_resource_cache.h
@@ -33,7 +33,7 @@
namespace ui {
class ColorProvider;
class ThemeProvider;
-}
+} // namespace ui
SkColor GetThemeColor(const ui::NativeTheme* native_theme,
const ui::ColorProvider& cp,
diff --git a/chrome/browser/ui/webui/offline/offline_internals_ui_message_handler.cc b/chrome/browser/ui/webui/offline/offline_internals_ui_message_handler.cc
index 31e7ef6..3236d8c9 100644
--- a/chrome/browser/ui/webui/offline/offline_internals_ui_message_handler.cc
+++ b/chrome/browser/ui/webui/offline/offline_internals_ui_message_handler.cc
@@ -58,8 +58,9 @@
const offline_pages::MultipleItemStatuses& results) {
// If any requests failed, return "failure", else "success".
for (const auto& result : results) {
- if (result.second == offline_pages::ItemActionStatus::STORE_ERROR)
+ if (result.second == offline_pages::ItemActionStatus::STORE_ERROR) {
return "Store failure, could not delete one or more requests";
+ }
}
return "Success";
@@ -225,8 +226,9 @@
AllowJavascript();
CHECK(!args.empty());
const bool should_record = args[0].GetBool();
- if (offline_page_model_)
+ if (offline_page_model_) {
offline_page_model_->GetLogger()->SetIsLogging(should_record);
+ }
}
void OfflineInternalsUIMessageHandler::HandleGetNetworkStatus(
@@ -288,8 +290,9 @@
AllowJavascript();
CHECK(!args.empty());
const bool should_record = args[0].GetBool();
- if (request_coordinator_)
+ if (request_coordinator_) {
request_coordinator_->GetLogger()->SetIsLogging(should_record);
+ }
}
void OfflineInternalsUIMessageHandler::HandleSetRecordPrefetchService(
@@ -299,9 +302,7 @@
}
void OfflineInternalsUIMessageHandler::HandleSetLimitlessPrefetchingEnabled(
- const base::Value::List& args) {
-
-}
+ const base::Value::List& args) {}
void OfflineInternalsUIMessageHandler::HandleGetLimitlessPrefetchingEnabled(
const base::Value::List& args) {
@@ -342,10 +343,12 @@
const base::Value& callback_id = args[0];
std::vector<std::string> logs;
- if (offline_page_model_)
+ if (offline_page_model_) {
offline_page_model_->GetLogger()->GetLogs(&logs);
- if (request_coordinator_)
+ }
+ if (request_coordinator_) {
request_coordinator_->GetLogger()->GetLogs(&logs);
+ }
std::sort(logs.begin(), logs.end());
base::Value::List result;
diff --git a/chrome/browser/ui/webui/omnibox/omnibox_page_handler.cc b/chrome/browser/ui/webui/omnibox/omnibox_page_handler.cc
index b032e93..4989341 100644
--- a/chrome/browser/ui/webui/omnibox/omnibox_page_handler.cc
+++ b/chrome/browser/ui/webui/omnibox/omnibox_page_handler.cc
@@ -358,8 +358,9 @@
page_->HandleNewAutocompleteQuery(type, base::UTF16ToUTF8(input.text()));
// Kick off ml-disabled autocompletion to show a before/after comparison on
// chrome://omnibox/ml.
- if (type == mojom::AutocompleteControllerType::kBrowser)
+ if (type == mojom::AutocompleteControllerType::kBrowser) {
ml_disabled_controller_->Start(input);
+ }
}
void OmniboxPageHandler::OnResultChanged(AutocompleteController* controller,
@@ -374,8 +375,9 @@
input_.text().substr(input_.parts().host.begin, input_.parts().host.len);
response->host = base::UTF16ToUTF8(host);
bool is_typed_host;
- if (!LookupIsTypedHost(host, &is_typed_host))
+ if (!LookupIsTypedHost(host, &is_typed_host)) {
is_typed_host = false;
+ }
response->is_typed_host = is_typed_host;
response->input_text = base::UTF16ToUTF8(input_.text());
@@ -387,9 +389,11 @@
mojo::ConvertTo<std::vector<mojom::AutocompleteMatchPtr>>(matches);
}
std::vector<scoped_refptr<AutocompleteProvider>> providers = {};
- for (const auto& provider : controller->providers())
- if (controller->ShouldRunProvider(provider.get()))
+ for (const auto& provider : controller->providers()) {
+ if (controller->ShouldRunProvider(provider.get())) {
providers.push_back(provider);
+ }
+ }
response->results_by_provider =
mojo::ConvertTo<std::vector<mojom::AutocompleteResultsForProviderPtr>>(
providers);
@@ -412,11 +416,13 @@
// Obtain a vector of all image urls required.
std::vector<std::string> image_urls;
- for (const auto& match : response->combined_results)
+ for (const auto& match : response->combined_results) {
image_urls.push_back(match->image);
+ }
for (const auto& results_by_provider : response->results_by_provider) {
- for (const auto& match : results_by_provider->results)
+ for (const auto& match : results_by_provider->results) {
image_urls.push_back(match->image);
+ }
}
auto type = GetAutocompleteControllerType(controller);
@@ -462,11 +468,13 @@
history::HistoryService* const history_service =
HistoryServiceFactory::GetForProfile(profile_,
ServiceAccessType::EXPLICIT_ACCESS);
- if (!history_service)
+ if (!history_service) {
return false;
+ }
history::URLDatabase* url_db = history_service->InMemoryDatabase();
- if (!url_db)
+ if (!url_db) {
return false;
+ }
*is_typed_host =
url_db->IsTypedHost(base::UTF16ToUTF8(host), /*scheme=*/nullptr);
return true;
@@ -490,21 +498,24 @@
// variable (or something else) and some providers will short-circuit
// important logic and return stale results. In short, we want the
// actual results to not depend on the state of the previous request.
- if (reset_autocomplete_controller)
+ if (reset_autocomplete_controller) {
controller_ = CreateController(false);
+ }
AutocompleteInput input(
base::UTF8ToUTF16(input_string), cursor_position,
static_cast<metrics::OmniboxEventProto::PageClassification>(
page_classification),
ChromeAutocompleteSchemeClassifier(profile_));
GURL current_url_gurl{current_url};
- if (current_url_gurl.is_valid())
+ if (current_url_gurl.is_valid()) {
input.set_current_url(current_url_gurl);
+ }
input.set_current_title(base::UTF8ToUTF16(current_url));
input.set_prevent_inline_autocomplete(prevent_inline_autocomplete);
input.set_prefer_keyword(prefer_keyword);
- if (prefer_keyword)
+ if (prefer_keyword) {
input.set_keyword_mode_entry_method(metrics::OmniboxEventProto::TAB);
+ }
input.set_focus_type(zero_suggest
? metrics::OmniboxFocusType::INTERACTION_FOCUS
: metrics::OmniboxFocusType::INTERACTION_DEFAULT);
@@ -553,8 +564,9 @@
// `HistoryEmbeddingsProvider` only supports 1 query at a time. Running it for
// the traditional-scoring controller used in the ML before/after comparisons
// would break history embeddings for the other, more important controllers.
- if (ml_disabled)
+ if (ml_disabled) {
providers &= ~AutocompleteProvider::TYPE_HISTORY_EMBEDDINGS;
+ }
auto controller = std::make_unique<AutocompleteController>(
std::make_unique<ChromeAutocompleteProviderClient>(profile_), providers,
@@ -568,10 +580,12 @@
mojom::AutocompleteControllerType
OmniboxPageHandler::GetAutocompleteControllerType(
AutocompleteController* controller) {
- if (controller == controller_.get())
+ if (controller == controller_.get()) {
return mojom::AutocompleteControllerType::kDebug;
- if (controller == ml_disabled_controller_.get())
+ }
+ if (controller == ml_disabled_controller_.get()) {
return mojom::AutocompleteControllerType::kMlDisabledDebug;
+ }
return mojom::AutocompleteControllerType::kBrowser;
}
diff --git a/chrome/browser/ui/webui/page_not_available_for_guest/page_not_available_for_guest_ui.cc b/chrome/browser/ui/webui/page_not_available_for_guest/page_not_available_for_guest_ui.cc
index 4cbcbdbb..af0494b 100644
--- a/chrome/browser/ui/webui/page_not_available_for_guest/page_not_available_for_guest_ui.cc
+++ b/chrome/browser/ui/webui/page_not_available_for_guest/page_not_available_for_guest_ui.cc
@@ -22,16 +22,17 @@
content::WebUIDataSource::CreateAndAdd(profile, host_name);
std::u16string page_title;
- if (host_name == chrome::kChromeUIBookmarksHost)
+ if (host_name == chrome::kChromeUIBookmarksHost) {
page_title = l10n_util::GetStringUTF16(IDS_BOOKMARK_MANAGER_TITLE);
- else if (host_name == chrome::kChromeUIHistoryHost)
+ } else if (host_name == chrome::kChromeUIHistoryHost) {
page_title = l10n_util::GetStringUTF16(IDS_HISTORY_TITLE);
- else if (host_name == chrome::kChromeUIExtensionsHost)
+ } else if (host_name == chrome::kChromeUIExtensionsHost) {
page_title = l10n_util::GetStringUTF16(IDS_EXTENSIONS_TOOLBAR_TITLE);
- else if (host_name == password_manager::kChromeUIPasswordManagerHost)
+ } else if (host_name == password_manager::kChromeUIPasswordManagerHost) {
page_title = l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_UI_TITLE);
- else
+ } else {
page_title = base::UTF8ToUTF16(host_name);
+ }
source->AddString("pageTitle", page_title);
std::u16string page_heading = l10n_util::GetStringFUTF16(
diff --git a/chrome/browser/ui/webui/password_manager/promo_card.cc b/chrome/browser/ui/webui/password_manager/promo_card.cc
index 570baef..958fbd0e 100644
--- a/chrome/browser/ui/webui/password_manager/promo_card.cc
+++ b/chrome/browser/ui/webui/password_manager/promo_card.cc
@@ -34,7 +34,6 @@
constexpr char kNumberOfTimesShownKey[] = "number_of_times_shown";
constexpr char kWasDismissedKey[] = "was_dismissed";
-
// Creates new pref entry for the promo card with a given id.
base::Value::Dict CreatePromoCardPrefEntry(const std::string& id) {
base::Value::Dict promo_card_pref_entry;
diff --git a/chrome/browser/ui/webui/policy_indicator_localized_strings_provider.cc b/chrome/browser/ui/webui/policy_indicator_localized_strings_provider.cc
index ee87624..bcabd3b 100644
--- a/chrome/browser/ui/webui/policy_indicator_localized_strings_provider.cc
+++ b/chrome/browser/ui/webui/policy_indicator_localized_strings_provider.cc
@@ -20,25 +20,27 @@
void AddLocalizedStrings(content::WebUIDataSource* html_source) {
int controlled_setting_policy_id = IDS_CONTROLLED_SETTING_POLICY;
#if BUILDFLAG(IS_CHROMEOS_ASH)
- if (ash::DemoSession::IsDeviceInDemoMode())
+ if (ash::DemoSession::IsDeviceInDemoMode()) {
controlled_setting_policy_id = IDS_CONTROLLED_SETTING_DEMO_SESSION;
+ }
#endif
webui::LocalizedString localized_strings[] = {
- {"controlledSettingPolicy", controlled_setting_policy_id},
- {"controlledSettingRecommendedMatches", IDS_CONTROLLED_SETTING_RECOMMENDED},
- {"controlledSettingRecommendedDiffers",
- IDS_CONTROLLED_SETTING_HAS_RECOMMENDATION},
- {"controlledSettingExtension", IDS_CONTROLLED_SETTING_EXTENSION},
- {"controlledSettingExtensionWithoutName",
- IDS_CONTROLLED_SETTING_EXTENSION_WITHOUT_NAME},
- {"controlledSettingChildRestriction",
- IDS_CONTROLLED_SETTING_CHILD_RESTRICTION},
- {"controlledSettingParent", IDS_CONTROLLED_SETTING_PARENT},
+ {"controlledSettingPolicy", controlled_setting_policy_id},
+ {"controlledSettingRecommendedMatches",
+ IDS_CONTROLLED_SETTING_RECOMMENDED},
+ {"controlledSettingRecommendedDiffers",
+ IDS_CONTROLLED_SETTING_HAS_RECOMMENDATION},
+ {"controlledSettingExtension", IDS_CONTROLLED_SETTING_EXTENSION},
+ {"controlledSettingExtensionWithoutName",
+ IDS_CONTROLLED_SETTING_EXTENSION_WITHOUT_NAME},
+ {"controlledSettingChildRestriction",
+ IDS_CONTROLLED_SETTING_CHILD_RESTRICTION},
+ {"controlledSettingParent", IDS_CONTROLLED_SETTING_PARENT},
#if BUILDFLAG(IS_CHROMEOS_ASH)
- {"controlledSettingShared", IDS_CONTROLLED_SETTING_SHARED},
- {"controlledSettingWithOwner", IDS_CONTROLLED_SETTING_WITH_OWNER},
- {"controlledSettingNoOwner", IDS_CONTROLLED_SETTING_NO_OWNER},
+ {"controlledSettingShared", IDS_CONTROLLED_SETTING_SHARED},
+ {"controlledSettingWithOwner", IDS_CONTROLLED_SETTING_WITH_OWNER},
+ {"controlledSettingNoOwner", IDS_CONTROLLED_SETTING_NO_OWNER},
#endif
};
html_source->AddLocalizedStrings(localized_strings);
diff --git a/chrome/browser/ui/webui/predictors/predictors_handler.cc b/chrome/browser/ui/webui/predictors/predictors_handler.cc
index f818eff..f0a351f3 100644
--- a/chrome/browser/ui/webui/predictors/predictors_handler.cc
+++ b/chrome/browser/ui/webui/predictors/predictors_handler.cc
@@ -29,7 +29,7 @@
predictors::LoadingPredictorFactory::GetForProfile(profile);
}
-PredictorsHandler::~PredictorsHandler() { }
+PredictorsHandler::~PredictorsHandler() {}
void PredictorsHandler::RegisterMessages() {
web_ui()->RegisterMessageCallback(
@@ -53,8 +53,7 @@
base::Value::List db;
for (AutocompleteActionPredictor::DBCacheMap::const_iterator it =
autocomplete_action_predictor_->db_cache_.begin();
- it != autocomplete_action_predictor_->db_cache_.end();
- ++it) {
+ it != autocomplete_action_predictor_->db_cache_.end(); ++it) {
db.Append(
base::Value::Dict()
.Set("user_text", it->first.user_text)
diff --git a/chrome/browser/ui/webui/predictors/predictors_handler.h b/chrome/browser/ui/webui/predictors/predictors_handler.h
index 80a5f48d..9c3d228c 100644
--- a/chrome/browser/ui/webui/predictors/predictors_handler.h
+++ b/chrome/browser/ui/webui/predictors/predictors_handler.h
@@ -12,7 +12,7 @@
namespace predictors {
class AutocompleteActionPredictor;
class LoadingPredictor;
-}
+} // namespace predictors
class Profile;
diff --git a/chrome/browser/ui/webui/print_preview/extension_printer_handler.cc b/chrome/browser/ui/webui/print_preview/extension_printer_handler.cc
index 8725d261..49d6100 100644
--- a/chrome/browser/ui/webui/print_preview/extension_printer_handler.cc
+++ b/chrome/browser/ui/webui/print_preview/extension_printer_handler.cc
@@ -65,8 +65,9 @@
base::ReadOnlySharedMemoryRegion pwg_region) {
auto data =
base::RefCountedSharedMemoryMapping::CreateFromWholeRegion(pwg_region);
- if (data)
+ if (data) {
job->document_bytes = data;
+ }
std::move(callback).Run(std::move(job));
}
@@ -94,8 +95,9 @@
const std::string& printer_id) {
std::vector<std::string> components = base::SplitString(
printer_id, ":", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
- if (components.size() != 3 || components[0] != kProvisionalUsbLabel)
+ if (components.size() != 3 || components[0] != kProvisionalUsbLabel) {
return std::nullopt;
+ }
return ProvisionalUsbPrinter{.extension_id = std::move(components[1]),
.device_guid = std::move(components[2])};
}
@@ -277,8 +279,9 @@
const gfx::Size& page_size,
std::unique_ptr<extensions::PrinterProviderPrintJob> job,
PrintJobCallback callback) {
- if (!pwg_raster_converter_)
+ if (!pwg_raster_converter_) {
pwg_raster_converter_ = PwgRasterConverter::CreateDefault();
+ }
PwgRasterSettings bitmap_settings =
PwgRasterConverter::GetBitmapSettings(printer_description, print_ticket);
@@ -321,13 +324,16 @@
PRINTER_LOG(EVENT) << "ExtensionPrinterHandler::WrapGetPrintersCallback(): "
<< "printers.size()=" << printers.size()
<< " done=" << done;
- if (!printers.empty())
+ if (!printers.empty()) {
callback.Run(std::move(printers));
+ }
- if (done)
+ if (done) {
pending_enumeration_count_--;
- if (pending_enumeration_count_ == 0)
+ }
+ if (pending_enumeration_count_ == 0) {
std::move(done_callback_).Run();
+ }
}
void ExtensionPrinterHandler::WrapGetCapabilityCallback(
@@ -369,8 +375,9 @@
for (const auto& extension : registry->enabled_extensions()) {
const UsbPrinterManifestData* manifest_data =
UsbPrinterManifestData::Get(extension.get());
- if (!manifest_data || !HasUsbPrinterProviderPermissions(extension.get()))
+ if (!manifest_data || !HasUsbPrinterProviderPermissions(extension.get())) {
continue;
+ }
const extensions::DevicePermissions* device_permissions =
permissions_manager->GetForExtension(extension->id());
@@ -406,10 +413,12 @@
DCHECK_GT(pending_enumeration_count_, 0);
pending_enumeration_count_--;
base::Value::List list = std::move(printer_list);
- if (!list.empty())
+ if (!list.empty()) {
callback.Run(std::move(list));
- if (pending_enumeration_count_ == 0)
+ }
+ if (pending_enumeration_count_ == 0) {
std::move(done_callback_).Run();
+ }
}
} // namespace printing
diff --git a/chrome/browser/ui/webui/print_preview/extension_printer_handler_unittest.cc b/chrome/browser/ui/webui/print_preview/extension_printer_handler_unittest.cc
index 67daf84..82972ba 100644
--- a/chrome/browser/ui/webui/print_preview/extension_printer_handler_unittest.cc
+++ b/chrome/browser/ui/webui/print_preview/extension_printer_handler_unittest.cc
@@ -257,10 +257,11 @@
base::Value::Dict capability) {
++call_count;
base::Value::Dict* capabilities = capability.FindDict(kSettingCapabilities);
- if (capabilities)
+ if (capabilities) {
capability_out = std::move(*capabilities);
- else
+ } else {
capability_out.clear();
+ }
}
// Used as a callback to StartPrint in tests.
@@ -421,16 +422,18 @@
const PrinterProviderPrintJob* GetNextPendingPrintJob() const {
EXPECT_GT(pending_print_count(), 0u);
- if (pending_print_count() == 0)
+ if (pending_print_count() == 0) {
return nullptr;
+ }
return &pending_print_requests_.front().job;
}
void TriggerNextPrintCallback(const std::string& result) {
ASSERT_GT(pending_print_count(), 0u);
base::Value result_value;
- if (result != kPrintRequestSuccess)
+ if (result != kPrintRequestSuccess) {
result_value = base::Value(result);
+ }
std::move(pending_print_requests_.front().callback).Run(result_value);
pending_print_requests_.pop();
}
diff --git a/chrome/browser/ui/webui/print_preview/local_printer_handler_default_unittest.cc b/chrome/browser/ui/webui/print_preview/local_printer_handler_default_unittest.cc
index 6fa6802..b1c5c6e 100644
--- a/chrome/browser/ui/webui/print_preview/local_printer_handler_default_unittest.cc
+++ b/chrome/browser/ui/webui/print_preview/local_printer_handler_default_unittest.cc
@@ -233,8 +233,9 @@
if (UseService()) {
#if BUILDFLAG(ENABLE_OOP_PRINTING)
sandboxed_print_backend_ = base::MakeRefCounted<TestPrintBackend>();
- if (SupportFallback())
+ if (SupportFallback()) {
unsandboxed_print_backend_ = base::MakeRefCounted<TestPrintBackend>();
+ }
#if BUILDFLAG(IS_WIN)
// To test OOP for Windows, the Print Backend service and Data Decoder
diff --git a/chrome/browser/ui/webui/print_preview/pdf_printer_handler.cc b/chrome/browser/ui/webui/print_preview/pdf_printer_handler.cc
index 0cd68be2a..f49b83c 100644
--- a/chrome/browser/ui/webui/print_preview/pdf_printer_handler.cc
+++ b/chrome/browser/ui/webui/print_preview/pdf_printer_handler.cc
@@ -205,8 +205,9 @@
}
}
#endif
- if (!pdf_file_saved_closure.is_null())
+ if (!pdf_file_saved_closure.is_null()) {
std::move(pdf_file_saved_closure).Run();
+ }
}
base::FilePath CreateDirectoryIfNotExists(const base::FilePath& path) {
@@ -218,8 +219,9 @@
base::FilePath SelectSaveDirectory(const base::FilePath& path,
const base::FilePath& default_path) {
- if (base::DirectoryExists(path))
+ if (base::DirectoryExists(path)) {
return path;
+ }
return CreateDirectoryIfNotExists(default_path);
}
@@ -248,8 +250,9 @@
sticky_settings_(sticky_settings) {}
PdfPrinterHandler::~PdfPrinterHandler() {
- if (select_file_dialog_.get())
+ if (select_file_dialog_.get()) {
select_file_dialog_->ListenerDestroyed();
+ }
}
void PdfPrinterHandler::Reset() {
@@ -367,8 +370,9 @@
base::FilePath::StringType ext = default_filename.Extension();
if (!ext.empty()) {
ext = ext.substr(1);
- if (ext == kPdfExtension)
+ if (ext == kPdfExtension) {
return default_filename;
+ }
}
return default_filename.AddExtension(kPdfExtension);
}
@@ -394,8 +398,9 @@
name = base::FilePath::FromUTF16Unsafe(
url_formatter::IDNToUnicode(url.host()));
}
- if (name.AsUTF8Unsafe() == url.host())
+ if (name.AsUTF8Unsafe() == url.host()) {
return name.AddExtension(kPdfExtension);
+ }
return name.ReplaceExtension(kPdfExtension);
}
@@ -476,8 +481,9 @@
print_to_pdf_path_.clear();
- if (print_callback_)
+ if (print_callback_) {
std::move(print_callback_).Run(base::Value());
+ }
}
void PdfPrinterHandler::OnGotUniqueFileName(const base::FilePath& path) {
@@ -487,8 +493,9 @@
void PdfPrinterHandler::OnDirectorySelected(const base::FilePath& filename,
const base::FilePath& directory) {
// Early return if the select file dialog is already active.
- if (select_file_dialog_)
+ if (select_file_dialog_) {
return;
+ }
base::FilePath path = directory.Append(filename);
diff --git a/chrome/browser/ui/webui/print_preview/pdf_printer_handler.h b/chrome/browser/ui/webui/print_preview/pdf_printer_handler.h
index 325cf8e..a6fbf7a0 100644
--- a/chrome/browser/ui/webui/print_preview/pdf_printer_handler.h
+++ b/chrome/browser/ui/webui/print_preview/pdf_printer_handler.h
@@ -18,7 +18,7 @@
namespace base {
class FilePath;
class RefCountedMemory;
-}
+} // namespace base
namespace content {
class WebContents;
diff --git a/chrome/browser/ui/webui/print_preview/pdf_printer_handler_unittest.cc b/chrome/browser/ui/webui/print_preview/pdf_printer_handler_unittest.cc
index 3fae2de..0e7d23ef 100644
--- a/chrome/browser/ui/webui/print_preview/pdf_printer_handler_unittest.cc
+++ b/chrome/browser/ui/webui/print_preview/pdf_printer_handler_unittest.cc
@@ -350,8 +350,9 @@
expected_capability.GetDict().FindListByDottedPath(kPaperOptionPath);
ASSERT_TRUE(expected_paper_options);
- for (const PrinterSemanticCapsAndDefaults::Paper& paper : kTestPapers)
+ for (const PrinterSemanticCapsAndDefaults::Paper& paper : kTestPapers) {
expected_paper_options->Append(GetValueFromCustomPaper(paper));
+ }
SetMacCustomPaperSizesForTesting(kTestPapers);
diff --git a/chrome/browser/ui/webui/print_preview/pdf_printer_handler_win_unittest.cc b/chrome/browser/ui/webui/print_preview/pdf_printer_handler_win_unittest.cc
index 605a287..18c73246 100644
--- a/chrome/browser/ui/webui/print_preview/pdf_printer_handler_win_unittest.cc
+++ b/chrome/browser/ui/webui/print_preview/pdf_printer_handler_win_unittest.cc
@@ -47,8 +47,7 @@
: PdfPrinterHandler(profile, contents, sticky_settings),
save_failed_(false) {}
- void FileSelected(const ui::SelectedFileInfo& file,
- int index) override {
+ void FileSelected(const ui::SelectedFileInfo& file, int index) override {
// Since we always cancel the dialog as soon as it is initialized, this
// should never be called.
NOTREACHED();
diff --git a/chrome/browser/ui/webui/print_preview/print_preview_handler.cc b/chrome/browser/ui/webui/print_preview/print_preview_handler.cc
index 7e6bf0f..594b32de 100644
--- a/chrome/browser/ui/webui/print_preview/print_preview_handler.cc
+++ b/chrome/browser/ui/webui/print_preview/print_preview_handler.cc
@@ -215,8 +215,9 @@
UserActionBuckets DetermineUserAction(const base::Value::Dict& settings) {
#if BUILDFLAG(IS_MAC)
- if (settings.contains(kSettingOpenPDFInPreview))
+ if (settings.contains(kSettingOpenPDFInPreview)) {
return UserActionBuckets::kOpenInMacPreview;
+ }
#endif
#if BUILDFLAG(IS_CHROMEOS)
@@ -238,8 +239,9 @@
NOTREACHED();
}
- if (settings.FindBool(kSettingShowSystemDialog).value_or(false))
+ if (settings.FindBool(kSettingShowSystemDialog).value_or(false)) {
return UserActionBuckets::kFallbackToAdvancedSettingsDialog;
+ }
return UserActionBuckets::kPrintToPrinter;
}
@@ -260,18 +262,22 @@
ptr->print_header_footer_default ==
crosapi::mojom::Policies::OptionalBool::kTrue);
}
- if (!header_footer_policy.empty())
+ if (!header_footer_policy.empty()) {
policies.Set(kHeaderFooter, std::move(header_footer_policy));
+ }
base::Value::Dict background_graphics_policy;
int value = static_cast<int>(ptr->allowed_background_graphics_modes);
- if (value)
+ if (value) {
background_graphics_policy.Set(kAllowedMode, value);
+ }
value = static_cast<int>(ptr->background_graphics_default);
- if (value)
+ if (value) {
background_graphics_policy.Set(kDefaultMode, value);
- if (!background_graphics_policy.empty())
+ }
+ if (!background_graphics_policy.empty()) {
policies.Set(kCssBackground, std::move(background_graphics_policy));
+ }
base::Value::Dict paper_size_policy;
const std::optional<gfx::Size>& default_paper_size = ptr->paper_size_default;
@@ -283,8 +289,9 @@
default_paper_size.value().height());
paper_size_policy.Set(kDefaultMode, std::move(default_paper_size_value));
}
- if (!paper_size_policy.empty())
+ if (!paper_size_policy.empty()) {
policies.Set(kMediaSize, std::move(paper_size_policy));
+ }
if (ptr->max_sheets_allowed_has_value) {
base::Value::Dict sheets_policy;
@@ -293,30 +300,40 @@
}
base::Value::Dict color_policy;
- if (ptr->allowed_color_modes)
+ if (ptr->allowed_color_modes) {
color_policy.Set(kAllowedMode, static_cast<int>(ptr->allowed_color_modes));
- if (ptr->default_color_mode != printing::mojom::ColorModeRestriction::kUnset)
+ }
+ if (ptr->default_color_mode !=
+ printing::mojom::ColorModeRestriction::kUnset) {
color_policy.Set(kDefaultMode, static_cast<int>(ptr->default_color_mode));
- if (!color_policy.empty())
+ }
+ if (!color_policy.empty()) {
policies.Set(kColor, std::move(color_policy));
+ }
base::Value::Dict duplex_policy;
- if (ptr->allowed_duplex_modes)
+ if (ptr->allowed_duplex_modes) {
duplex_policy.Set(kAllowedMode,
static_cast<int>(ptr->allowed_duplex_modes));
+ }
if (ptr->default_duplex_mode !=
- printing::mojom::DuplexModeRestriction::kUnset)
+ printing::mojom::DuplexModeRestriction::kUnset) {
duplex_policy.Set(kDefaultMode, static_cast<int>(ptr->default_duplex_mode));
- if (!duplex_policy.empty())
+ }
+ if (!duplex_policy.empty()) {
policies.Set(kDuplex, std::move(duplex_policy));
+ }
base::Value::Dict pin_policy;
- if (ptr->allowed_pin_modes != printing::mojom::PinModeRestriction::kUnset)
+ if (ptr->allowed_pin_modes != printing::mojom::PinModeRestriction::kUnset) {
pin_policy.Set(kAllowedMode, static_cast<int>(ptr->allowed_pin_modes));
- if (ptr->default_pin_mode != printing::mojom::PinModeRestriction::kUnset)
+ }
+ if (ptr->default_pin_mode != printing::mojom::PinModeRestriction::kUnset) {
pin_policy.Set(kDefaultMode, static_cast<int>(ptr->default_pin_mode));
- if (!pin_policy.empty())
+ }
+ if (!pin_policy.empty()) {
policies.Set(kPin, std::move(pin_policy));
+ }
base::Value::Dict print_as_image_for_pdf_default_policy;
if (ptr->default_print_pdf_as_image !=
@@ -347,8 +364,9 @@
prefs.GetBoolean(prefs::kPrintHeaderFooter));
}
}
- if (!header_footer_policy.empty())
+ if (!header_footer_policy.empty()) {
policies.Set(kHeaderFooter, std::move(header_footer_policy));
+ }
base::Value::Dict background_graphics_policy;
if (prefs.HasPrefPath(prefs::kPrintingAllowedBackgroundGraphicsModes)) {
@@ -361,8 +379,9 @@
kDefaultMode,
prefs.GetInteger(prefs::kPrintingBackgroundGraphicsDefault));
}
- if (!background_graphics_policy.empty())
+ if (!background_graphics_policy.empty()) {
policies.Set(kCssBackground, std::move(background_graphics_policy));
+ }
base::Value::Dict paper_size_policy;
std::optional<gfx::Size> default_paper_size = ParsePaperSizeDefault(prefs);
@@ -374,8 +393,9 @@
default_paper_size.value().height());
paper_size_policy.Set(kDefaultMode, std::move(default_paper_size_value));
}
- if (!paper_size_policy.empty())
+ if (!paper_size_policy.empty()) {
policies.Set(kMediaSize, std::move(paper_size_policy));
+ }
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
base::Value::Dict print_as_image_available_for_pdf_policy;
@@ -490,8 +510,9 @@
void PrintPreviewHandler::ReadPrinterTypeDenyListFromPrefs() {
#if BUILDFLAG(IS_CHROMEOS)
- if (!local_printer_)
+ if (!local_printer_) {
return;
+ }
local_printer_->GetPrinterTypeDenyList(
base::BindOnce(&PrintPreviewHandler::OnPrinterTypeDenyListReady,
@@ -499,8 +520,9 @@
return;
#else
PrefService* prefs = GetPrefs();
- if (!prefs->HasPrefPath(prefs::kPrinterTypeDenyList))
+ if (!prefs->HasPrefPath(prefs::kPrinterTypeDenyList)) {
return;
+ }
const base::Value::List& deny_list_from_prefs =
prefs->GetList(prefs::kPrinterTypeDenyList);
@@ -510,14 +532,15 @@
for (const base::Value& deny_list_value : deny_list_from_prefs) {
const std::string& deny_list_str = deny_list_value.GetString();
mojom::PrinterType printer_type;
- if (deny_list_str == "extension")
+ if (deny_list_str == "extension") {
printer_type = mojom::PrinterType::kExtension;
- else if (deny_list_str == "pdf")
+ } else if (deny_list_str == "pdf") {
printer_type = mojom::PrinterType::kPdf;
- else if (deny_list_str == "local")
+ } else if (deny_list_str == "local") {
printer_type = mojom::PrinterType::kLocal;
- else
+ } else {
continue;
+ }
deny_list.push_back(printer_type);
}
@@ -678,8 +701,9 @@
VLOG(1) << "Print preview request start";
- if (!print_render_frame_.is_bound())
+ if (!print_render_frame_.is_bound()) {
rfh->GetRemoteAssociatedInterfaces()->GetInterface(&print_render_frame_);
+ }
if (!print_preview_ui()->IsBound()) {
print_render_frame_->SetPrintPreviewUI(
@@ -720,8 +744,9 @@
const mojom::RequestPrintPreviewParams* request_params = GetRequestParams();
CHECK(request_params);
bool is_pdf = !request_params->is_modifiable;
- if (last_preview_settings_.has_value())
+ if (last_preview_settings_.has_value()) {
ReportPrintSettingsStats(settings, last_preview_settings_.value(), is_pdf);
+ }
{
PrintDocumentTypeBuckets doc_type =
is_pdf ? PrintDocumentTypeBuckets::kPdfDocument
@@ -806,8 +831,9 @@
void PrintPreviewHandler::HandleCancelPendingPrintRequest(
const base::Value::List& /*args*/) {
WebContents* initiator = GetInitiator();
- if (initiator)
+ if (initiator) {
ClearInitiatorDetails();
+ }
ShowPrintErrorDialogForGenericError();
}
@@ -815,10 +841,12 @@
std::string data_to_save;
PrintPreviewStickySettings* sticky_settings =
PrintPreviewStickySettings::GetInstance();
- if (args[0].is_string())
+ if (args[0].is_string()) {
data_to_save = args[0].GetString();
- if (!data_to_save.empty())
+ }
+ if (!data_to_save.empty()) {
sticky_settings->StoreAppState(data_to_save);
+ }
sticky_settings->SaveInPrefs(GetPrefs());
}
@@ -829,15 +857,17 @@
UserActionBuckets::kFallbackToAdvancedSettingsDialog);
WebContents* initiator = GetInitiator();
- if (!initiator)
+ if (!initiator) {
return;
+ }
auto weak_this = weak_factory_.GetWeakPtr();
auto* print_view_manager = PrintViewManager::FromWebContents(initiator);
print_view_manager->PrintForSystemDialogNow(base::BindOnce(
&PrintPreviewHandler::ClosePreviewDialog, weak_factory_.GetWeakPtr()));
- if (!weak_this)
+ if (!weak_this) {
return;
+ }
// Cancel the pending preview request if exists.
print_preview_ui()->OnCancelPendingPreviewRequest();
@@ -858,16 +888,18 @@
// On error, assume the units are SI.
// Since the only measurement units print preview's WebUI cares about are
// those for measuring distance, assume anything non-US is SI.
- if (errorCode > U_ZERO_ERROR || system != UMS_US)
+ if (errorCode > U_ZERO_ERROR || system != UMS_US) {
system = UMS_SI;
+ }
// Getting the number formatting based on the locale and writing to
// dictionary.
std::u16string number_format = base::FormatDouble(123456.78, 2);
size_t thousands_pos = number_format.find('3') + 1;
std::u16string thousands_delimiter = number_format.substr(thousands_pos, 1);
- if (number_format[thousands_pos] == '4')
+ if (number_format[thousands_pos] == '4') {
thousands_delimiter.clear();
+ }
size_t decimal_pos = number_format.find('6') + 1;
DCHECK_NE(number_format[decimal_pos], '7');
std::u16string decimal_delimiter = number_format.substr(decimal_pos, 1);
@@ -949,8 +981,9 @@
initial_settings.Set(kAppState, base::Value());
}
- if (!policies.empty())
+ if (!policies.empty()) {
initial_settings.Set(kPolicies, std::move(policies));
+ }
initial_settings.Set(
kPdfPrinterDisabled,
@@ -1021,20 +1054,23 @@
void PrintPreviewHandler::OnPrintPreviewReady(int preview_uid, int request_id) {
std::string callback_id = GetCallbackId(request_id);
- if (callback_id.empty())
+ if (callback_id.empty()) {
return;
+ }
ResolveJavascriptCallback(base::Value(callback_id), base::Value(preview_uid));
}
void PrintPreviewHandler::OnPrintPreviewFailed(int request_id) {
WebContents* initiator = GetInitiator();
- if (!initiator || initiator->IsBeingDestroyed())
+ if (!initiator || initiator->IsBeingDestroyed()) {
return; // Drop notification if fired during destruction sequence.
+ }
std::string callback_id = GetCallbackId(request_id);
- if (callback_id.empty())
+ if (callback_id.empty()) {
return;
+ }
if (!reported_failed_preview_) {
reported_failed_preview_ = true;
@@ -1050,8 +1086,9 @@
void PrintPreviewHandler::OnInvalidPrinterSettings(int request_id) {
std::string callback_id = GetCallbackId(request_id);
- if (callback_id.empty())
+ if (callback_id.empty()) {
return;
+ }
RejectJavascriptCallback(base::Value(callback_id),
base::Value("SETTINGS_INVALID"));
@@ -1061,8 +1098,9 @@
int copies,
mojom::DuplexMode duplex,
int request_id) {
- if (!ShouldReceiveRendererMessage(request_id))
+ if (!ShouldReceiveRendererMessage(request_id)) {
return;
+ }
FireWebUIListener("print-preset-options", base::Value(disable_scaling),
base::Value(copies), base::Value(static_cast<int>(duplex)));
@@ -1071,8 +1109,9 @@
void PrintPreviewHandler::SendPageCountReady(int page_count,
int fit_to_page_scaling,
int request_id) {
- if (!ShouldReceiveRendererMessage(request_id))
+ if (!ShouldReceiveRendererMessage(request_id)) {
return;
+ }
FireWebUIListener("page-count-ready", base::Value(page_count),
base::Value(request_id), base::Value(fit_to_page_scaling));
@@ -1083,8 +1122,9 @@
bool all_pages_have_custom_size,
bool all_pages_have_custom_orientation,
int request_id) {
- if (!ShouldReceiveRendererMessage(request_id))
+ if (!ShouldReceiveRendererMessage(request_id)) {
return;
+ }
FireWebUIListener("page-layout-ready", std::move(layout),
base::Value(all_pages_have_custom_size),
@@ -1098,11 +1138,13 @@
// gets called, the print preview may have failed. Since the failure message
// may have arrived first, check for this case and bail out instead of
// thinking this may be a bad IPC message.
- if (base::Contains(preview_failures_, preview_request_id))
+ if (base::Contains(preview_failures_, preview_request_id)) {
return;
+ }
- if (!ShouldReceiveRendererMessage(preview_request_id))
+ if (!ShouldReceiveRendererMessage(preview_request_id)) {
return;
+ }
FireWebUIListener("page-preview-ready", base::Value(page_index),
base::Value(preview_uid), base::Value(preview_request_id));
@@ -1110,8 +1152,9 @@
void PrintPreviewHandler::OnPrintPreviewCancelled(int request_id) {
std::string callback_id = GetCallbackId(request_id);
- if (callback_id.empty())
+ if (callback_id.empty()) {
return;
+ }
RejectJavascriptCallback(base::Value(callback_id), base::Value("CANCELLED"));
}
@@ -1123,8 +1166,9 @@
void PrintPreviewHandler::ClearInitiatorDetails() {
WebContents* initiator = GetInitiator();
- if (!initiator)
+ if (!initiator) {
return;
+ }
// We no longer require the initiator details. Remove those details associated
// with the preview dialog to allow the initiator to create another preview
@@ -1192,10 +1236,11 @@
void PrintPreviewHandler::OnPrintResult(const std::string& callback_id,
const base::Value& error) {
- if (error.is_none())
+ if (error.is_none()) {
ResolveJavascriptCallback(base::Value(callback_id), error);
- else
+ } else {
RejectJavascriptCallback(base::Value(callback_id), error);
+ }
// Remove the preview dialog from the background printing manager if it is
// being stored there. Since the PDF has been sent and the callback is
// resolved or rejected, it is no longer needed and can be destroyed.
diff --git a/chrome/browser/ui/webui/print_preview/print_preview_handler.h b/chrome/browser/ui/webui/print_preview/print_preview_handler.h
index ebb0dd7a..448fafa 100644
--- a/chrome/browser/ui/webui/print_preview/print_preview_handler.h
+++ b/chrome/browser/ui/webui/print_preview/print_preview_handler.h
@@ -263,8 +263,7 @@
// |callback_id|: The javascript callback to run.
// |error|: The returned print job error. Useful for reporting a specific
// error. None type implies no error.
- void OnPrintResult(const std::string& callback_id,
- const base::Value& error);
+ void OnPrintResult(const std::string& callback_id, const base::Value& error);
#if BUILDFLAG(ENTERPRISE_CONTENT_ANALYSIS)
// Called when enterprise policy returns a verdict.
diff --git a/chrome/browser/ui/webui/print_preview/print_preview_handler_chromeos.cc b/chrome/browser/ui/webui/print_preview/print_preview_handler_chromeos.cc
index 56754cd..ad5c7ebe 100644
--- a/chrome/browser/ui/webui/print_preview/print_preview_handler_chromeos.cc
+++ b/chrome/browser/ui/webui/print_preview/print_preview_handler_chromeos.cc
@@ -237,8 +237,9 @@
base::Value::Dict* printer = destination_info.FindDict(kPrinter);
if (printer) {
base::Value::Dict* policies_value = printer->FindDict(kSettingPolicies);
- if (policies_value)
+ if (policies_value) {
response.Set("policies", std::move(*policies_value));
+ }
}
ResolveJavascriptCallback(base::Value(callback_id), response);
}
@@ -290,10 +291,11 @@
void PrintPreviewHandlerChromeOS::HandleRequestPrinterStatusUpdateCompletion(
base::Value callback_id,
std::optional<base::Value::Dict> result) {
- if (result)
+ if (result) {
ResolveJavascriptCallback(callback_id, *result);
- else
+ } else {
ResolveJavascriptCallback(callback_id, base::Value());
+ }
}
void PrintPreviewHandlerChromeOS::HandleChoosePrintServers(
diff --git a/chrome/browser/ui/webui/print_preview/print_preview_handler_unittest.cc b/chrome/browser/ui/webui/print_preview/print_preview_handler_unittest.cc
index 35b7f0e2..f8e1b28 100644
--- a/chrome/browser/ui/webui/print_preview/print_preview_handler_unittest.cc
+++ b/chrome/browser/ui/webui/print_preview/print_preview_handler_unittest.cc
@@ -203,8 +203,9 @@
PrintSettingsBuckets::kTotal, PrintSettingsBuckets::kDefaultMedia,
};
- for (auto bucket : kPopulatedPrintSettingsBuckets)
+ for (auto bucket : kPopulatedPrintSettingsBuckets) {
histograms.ExpectBucketCount("PrintPreview.PrintSettings", bucket, 1);
+ }
// All other PrintPreview.PrintSettings buckets should be empty.
histograms.ExpectTotalCount("PrintPreview.PrintSettings",
@@ -238,8 +239,9 @@
void StartGetPrinters(AddedPrintersCallback added_printers_callback,
GetPrintersDoneCallback done_callback) override {
- if (!printers_.empty())
+ if (!printers_.empty()) {
added_printers_callback.Run(printers_.Clone());
+ }
std::move(done_callback).Run();
}
@@ -261,8 +263,9 @@
void SetPrinters(const std::vector<PrinterInfo>& printers) {
printers_.clear();
for (const auto& printer : printers) {
- if (printer.is_default)
+ if (printer.is_default) {
default_printer_ = printer.id;
+ }
printers_.Append(printer.basic_info.Clone());
printer_capabilities_[printer.id] = printer.capabilities.Clone();
}
@@ -604,8 +607,9 @@
const base::Value::Dict& settings,
const std::string& policy_name) {
const base::Value::Dict* policies = settings.FindDict("policies");
- if (!policies)
+ if (!policies) {
return nullptr;
+ }
return policies->FindDict(policy_name);
}
@@ -625,8 +629,9 @@
const base::Value* policy_value = policy ? policy->Find("value") : nullptr;
ASSERT_EQ(expected_policy_value.has_value(), !!policy_value);
- if (expected_policy_value.has_value())
+ if (expected_policy_value.has_value()) {
EXPECT_EQ(expected_policy_value.value(), *policy_value);
+ }
}
// Validates the initial settings allowed/default mode policies structure in
@@ -649,12 +654,14 @@
policy ? policy->Find("defaultMode") : nullptr;
ASSERT_EQ(expected_allowed_mode.has_value(), !!allowed_mode);
- if (expected_allowed_mode.has_value())
+ if (expected_allowed_mode.has_value()) {
EXPECT_EQ(expected_allowed_mode.value(), *allowed_mode);
+ }
ASSERT_EQ(expected_default_mode.has_value(), !!default_mode);
- if (expected_default_mode.has_value())
+ if (expected_default_mode.has_value()) {
EXPECT_EQ(expected_default_mode.value(), *default_mode);
+ }
}
// Simulates a 'getPrinters' Web UI message by constructing the arguments and
diff --git a/chrome/browser/ui/webui/print_preview/print_preview_metrics.cc b/chrome/browser/ui/webui/print_preview/print_preview_metrics.cc
index 39979d1..7ba9e28 100644
--- a/chrome/browser/ui/webui/print_preview/print_preview_metrics.cc
+++ b/chrome/browser/ui/webui/print_preview/print_preview_metrics.cc
@@ -78,14 +78,17 @@
: PrintSettingsBuckets::kPortrait);
}
- if (print_settings.FindInt(kSettingCopies).value_or(1) > 1)
+ if (print_settings.FindInt(kSettingCopies).value_or(1) > 1) {
ReportPrintSettingHistogram(PrintSettingsBuckets::kCopies);
+ }
- if (preview_settings.FindInt(kSettingPagesPerSheet).value_or(1) != 1)
+ if (preview_settings.FindInt(kSettingPagesPerSheet).value_or(1) != 1) {
ReportPrintSettingHistogram(PrintSettingsBuckets::kPagesPerSheet);
+ }
- if (print_settings.FindBool(kSettingCollate).value_or(false))
+ if (print_settings.FindBool(kSettingCollate).value_or(false)) {
ReportPrintSettingHistogram(PrintSettingsBuckets::kCollate);
+ }
std::optional<int> duplex_mode_opt =
print_settings.FindInt(kSettingDuplexMode);
@@ -120,11 +123,13 @@
}
}
- if (preview_settings.FindInt(kSettingMarginsType).value_or(0) != 0)
+ if (preview_settings.FindInt(kSettingMarginsType).value_or(0) != 0) {
ReportPrintSettingHistogram(PrintSettingsBuckets::kNonDefaultMargins);
+ }
- if (preview_settings.FindBool(kSettingHeaderFooterEnabled).value_or(false))
+ if (preview_settings.FindBool(kSettingHeaderFooterEnabled).value_or(false)) {
ReportPrintSettingHistogram(PrintSettingsBuckets::kHeadersAndFooters);
+ }
if (preview_settings.FindBool(kSettingShouldPrintBackgrounds)
.value_or(false)) {
@@ -136,8 +141,9 @@
ReportPrintSettingHistogram(PrintSettingsBuckets::kSelectionOnly);
}
- if (preview_settings.FindBool(kSettingRasterizePdf).value_or(false))
+ if (preview_settings.FindBool(kSettingRasterizePdf).value_or(false)) {
ReportPrintSettingHistogram(PrintSettingsBuckets::kPrintAsImage);
+ }
ScalingType scaling_type =
static_cast<ScalingType>(preview_settings.FindInt(kSettingScalingType)
@@ -147,10 +153,11 @@
}
if (is_pdf) {
- if (scaling_type == ScalingType::FIT_TO_PAGE)
+ if (scaling_type == ScalingType::FIT_TO_PAGE) {
ReportPrintSettingHistogram(PrintSettingsBuckets::kFitToPage);
- else if (scaling_type == ScalingType::FIT_TO_PAPER)
+ } else if (scaling_type == ScalingType::FIT_TO_PAPER) {
ReportPrintSettingHistogram(PrintSettingsBuckets::kFitToPaper);
+ }
}
int dpi_horizontal =
@@ -170,8 +177,9 @@
}
#if BUILDFLAG(IS_CHROMEOS_ASH)
- if (print_settings.FindString(kSettingPinValue))
+ if (print_settings.FindString(kSettingPinValue)) {
ReportPrintSettingHistogram(PrintSettingsBuckets::kPin);
+ }
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
}
diff --git a/chrome/browser/ui/webui/print_preview/print_preview_ui.cc b/chrome/browser/ui/webui/print_preview/print_preview_ui.cc
index 6ad43e88ba..334898d 100644
--- a/chrome/browser/ui/webui/print_preview/print_preview_ui.cc
+++ b/chrome/browser/ui/webui/print_preview/print_preview_ui.cc
@@ -122,8 +122,9 @@
void StopWorker(int document_cookie) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- if (document_cookie <= 0)
+ if (document_cookie <= 0) {
return;
+ }
scoped_refptr<PrintQueriesQueue> queue =
g_browser_process->print_job_manager()->queue();
std::unique_ptr<PrinterQuery> printer_query =
@@ -155,150 +156,155 @@
void AddPrintPreviewStrings(content::WebUIDataSource* source) {
static constexpr webui::LocalizedString kLocalizedStrings[] = {
- {"advancedSettingsDialogConfirm",
- IDS_PRINT_PREVIEW_ADVANCED_SETTINGS_DIALOG_CONFIRM},
- {"advancedSettingsDialogTitle",
- IDS_PRINT_PREVIEW_ADVANCED_SETTINGS_DIALOG_TITLE},
- {"advancedSettingsSearchBoxPlaceholder",
- IDS_PRINT_PREVIEW_ADVANCED_SETTINGS_SEARCH_BOX_PLACEHOLDER},
- {"borderlessLabel", IDS_PRINT_PREVIEW_BORDERLESS_LABEL},
- {"bottom", IDS_PRINT_PREVIEW_BOTTOM_MARGIN_LABEL},
- {"cancel", IDS_CANCEL},
- {"clearSearch", IDS_CLEAR_SEARCH},
- {"copiesInstruction", IDS_PRINT_PREVIEW_COPIES_INSTRUCTION},
- {"copiesLabel", IDS_PRINT_PREVIEW_COPIES_LABEL},
- {"couldNotPrint", IDS_PRINT_PREVIEW_COULD_NOT_PRINT},
- {"customMargins", IDS_PRINT_PREVIEW_CUSTOM_MARGINS},
- {"defaultMargins", IDS_PRINT_PREVIEW_DEFAULT_MARGINS},
- {"destinationLabel", IDS_PRINT_PREVIEW_DESTINATION_LABEL},
- {"destinationSearchTitle", IDS_PRINT_PREVIEW_DESTINATION_SEARCH_TITLE},
- {"dpiItemLabel", IDS_PRINT_PREVIEW_DPI_ITEM_LABEL},
- {"dpiLabel", IDS_PRINT_PREVIEW_DPI_LABEL},
- {"examplePageRangeText", IDS_PRINT_PREVIEW_EXAMPLE_PAGE_RANGE_TEXT},
- {"extensionDestinationIconTooltip",
- IDS_PRINT_PREVIEW_EXTENSION_DESTINATION_ICON_TOOLTIP},
- {"goBackButton", IDS_PRINT_PREVIEW_BUTTON_GO_BACK},
- {"invalidPrinterSettings", IDS_PRINT_PREVIEW_INVALID_PRINTER_SETTINGS},
- {"layoutLabel", IDS_PRINT_PREVIEW_LAYOUT_LABEL},
- {"left", IDS_PRINT_PREVIEW_LEFT_MARGIN_LABEL},
- {"loading", IDS_PRINT_PREVIEW_LOADING},
- {"manage", IDS_PRINT_PREVIEW_MANAGE},
+ {"advancedSettingsDialogConfirm",
+ IDS_PRINT_PREVIEW_ADVANCED_SETTINGS_DIALOG_CONFIRM},
+ {"advancedSettingsDialogTitle",
+ IDS_PRINT_PREVIEW_ADVANCED_SETTINGS_DIALOG_TITLE},
+ {"advancedSettingsSearchBoxPlaceholder",
+ IDS_PRINT_PREVIEW_ADVANCED_SETTINGS_SEARCH_BOX_PLACEHOLDER},
+ {"borderlessLabel", IDS_PRINT_PREVIEW_BORDERLESS_LABEL},
+ {"bottom", IDS_PRINT_PREVIEW_BOTTOM_MARGIN_LABEL},
+ {"cancel", IDS_CANCEL},
+ {"clearSearch", IDS_CLEAR_SEARCH},
+ {"copiesInstruction", IDS_PRINT_PREVIEW_COPIES_INSTRUCTION},
+ {"copiesLabel", IDS_PRINT_PREVIEW_COPIES_LABEL},
+ {"couldNotPrint", IDS_PRINT_PREVIEW_COULD_NOT_PRINT},
+ {"customMargins", IDS_PRINT_PREVIEW_CUSTOM_MARGINS},
+ {"defaultMargins", IDS_PRINT_PREVIEW_DEFAULT_MARGINS},
+ {"destinationLabel", IDS_PRINT_PREVIEW_DESTINATION_LABEL},
+ {"destinationSearchTitle", IDS_PRINT_PREVIEW_DESTINATION_SEARCH_TITLE},
+ {"dpiItemLabel", IDS_PRINT_PREVIEW_DPI_ITEM_LABEL},
+ {"dpiLabel", IDS_PRINT_PREVIEW_DPI_LABEL},
+ {"examplePageRangeText", IDS_PRINT_PREVIEW_EXAMPLE_PAGE_RANGE_TEXT},
+ {"extensionDestinationIconTooltip",
+ IDS_PRINT_PREVIEW_EXTENSION_DESTINATION_ICON_TOOLTIP},
+ {"goBackButton", IDS_PRINT_PREVIEW_BUTTON_GO_BACK},
+ {"invalidPrinterSettings", IDS_PRINT_PREVIEW_INVALID_PRINTER_SETTINGS},
+ {"layoutLabel", IDS_PRINT_PREVIEW_LAYOUT_LABEL},
+ {"left", IDS_PRINT_PREVIEW_LEFT_MARGIN_LABEL},
+ {"loading", IDS_PRINT_PREVIEW_LOADING},
+ {"manage", IDS_PRINT_PREVIEW_MANAGE},
#if BUILDFLAG(IS_CHROMEOS)
- {"managePrintersLabel", IDS_PRINT_PREVIEW_MANAGE_PRINTERS_LABEL},
+ {"managePrintersLabel", IDS_PRINT_PREVIEW_MANAGE_PRINTERS_LABEL},
#endif
- {"managedSettings", IDS_PRINT_PREVIEW_MANAGED_SETTINGS_TEXT},
- {"marginsLabel", IDS_PRINT_PREVIEW_MARGINS_LABEL},
- {"mediaSizeLabel", IDS_PRINT_PREVIEW_MEDIA_SIZE_LABEL},
- {"mediaTypeLabel", IDS_PRINT_PREVIEW_MEDIA_TYPE_LABEL},
- {"minimumMargins", IDS_PRINT_PREVIEW_MINIMUM_MARGINS},
- {"moreOptionsLabel", IDS_MORE_OPTIONS_LABEL},
- {"newShowAdvancedOptions", IDS_PRINT_PREVIEW_NEW_SHOW_ADVANCED_OPTIONS},
- {"noAdvancedSettingsMatchSearchHint",
- IDS_PRINT_PREVIEW_NO_ADVANCED_SETTINGS_MATCH_SEARCH_HINT},
- {"noDestinationsMessage", IDS_PRINT_PREVIEW_NO_DESTINATIONS_MESSAGE},
- {"noMargins", IDS_PRINT_PREVIEW_NO_MARGINS},
- {"nonIsotropicDpiItemLabel",
- IDS_PRINT_PREVIEW_NON_ISOTROPIC_DPI_ITEM_LABEL},
- {"optionAllPages", IDS_PRINT_PREVIEW_OPTION_ALL_PAGES},
- {"optionBackgroundColorsAndImages",
- IDS_PRINT_PREVIEW_OPTION_BACKGROUND_COLORS_AND_IMAGES},
- {"optionBw", IDS_PRINT_PREVIEW_OPTION_BW},
- {"optionCollate", IDS_PRINT_PREVIEW_OPTION_COLLATE},
- {"optionColor", IDS_PRINT_PREVIEW_OPTION_COLOR},
- {"optionCustomPages", IDS_PRINT_PREVIEW_OPTION_CUSTOM_PAGES},
- {"optionCustomScaling", IDS_PRINT_PREVIEW_OPTION_CUSTOM_SCALING},
- {"optionDefaultScaling", IDS_PRINT_PREVIEW_OPTION_DEFAULT_SCALING},
- {"optionEvenPages", IDS_PRINT_PREVIEW_OPTION_EVEN_PAGES},
- {"optionFitToPage", IDS_PRINT_PREVIEW_OPTION_FIT_TO_PAGE},
- {"optionFitToPaper", IDS_PRINT_PREVIEW_OPTION_FIT_TO_PAPER},
- {"optionHeaderFooter", IDS_PRINT_PREVIEW_OPTION_HEADER_FOOTER},
- {"optionLandscape", IDS_PRINT_PREVIEW_OPTION_LANDSCAPE},
- {"optionLongEdge", IDS_PRINT_PREVIEW_OPTION_LONG_EDGE},
- {"optionOddPages", IDS_PRINT_PREVIEW_OPTION_ODD_PAGES},
- {"optionPortrait", IDS_PRINT_PREVIEW_OPTION_PORTRAIT},
- {"optionRasterize", IDS_PRINT_PREVIEW_OPTION_RASTERIZE},
- {"optionSelectionOnly", IDS_PRINT_PREVIEW_OPTION_SELECTION_ONLY},
- {"optionShortEdge", IDS_PRINT_PREVIEW_OPTION_SHORT_EDGE},
- {"optionTwoSided", IDS_PRINT_PREVIEW_OPTION_TWO_SIDED},
- {"optionsLabel", IDS_PRINT_PREVIEW_OPTIONS_LABEL},
- {"pageDescription", IDS_PRINT_PREVIEW_DESCRIPTION},
- {"pageRangeLimitInstructionWithValue",
- IDS_PRINT_PREVIEW_PAGE_RANGE_LIMIT_INSTRUCTION_WITH_VALUE},
- {"pageRangeSyntaxInstruction",
- IDS_PRINT_PREVIEW_PAGE_RANGE_SYNTAX_INSTRUCTION},
- {"pagesLabel", IDS_PRINT_PREVIEW_PAGES_LABEL},
- {"pagesPerSheetLabel", IDS_PRINT_PREVIEW_PAGES_PER_SHEET_LABEL},
- {"previewFailed", IDS_PRINT_PREVIEW_FAILED},
- {"printOnBothSidesLabel", IDS_PRINT_PREVIEW_PRINT_ON_BOTH_SIDES_LABEL},
- {"printButton", IDS_PRINT_PREVIEW_PRINT_BUTTON},
- {"printDestinationsTitle", IDS_PRINT_PREVIEW_PRINT_DESTINATIONS_TITLE},
- {"printPagesLabel", IDS_PRINT_PREVIEW_PRINT_PAGES_LABEL},
+ {"managedSettings", IDS_PRINT_PREVIEW_MANAGED_SETTINGS_TEXT},
+ {"marginsLabel", IDS_PRINT_PREVIEW_MARGINS_LABEL},
+ {"mediaSizeLabel", IDS_PRINT_PREVIEW_MEDIA_SIZE_LABEL},
+ {"mediaTypeLabel", IDS_PRINT_PREVIEW_MEDIA_TYPE_LABEL},
+ {"minimumMargins", IDS_PRINT_PREVIEW_MINIMUM_MARGINS},
+ {"moreOptionsLabel", IDS_MORE_OPTIONS_LABEL},
+ {"newShowAdvancedOptions", IDS_PRINT_PREVIEW_NEW_SHOW_ADVANCED_OPTIONS},
+ {"noAdvancedSettingsMatchSearchHint",
+ IDS_PRINT_PREVIEW_NO_ADVANCED_SETTINGS_MATCH_SEARCH_HINT},
+ {"noDestinationsMessage", IDS_PRINT_PREVIEW_NO_DESTINATIONS_MESSAGE},
+ {"noMargins", IDS_PRINT_PREVIEW_NO_MARGINS},
+ {"nonIsotropicDpiItemLabel",
+ IDS_PRINT_PREVIEW_NON_ISOTROPIC_DPI_ITEM_LABEL},
+ {"optionAllPages", IDS_PRINT_PREVIEW_OPTION_ALL_PAGES},
+ {"optionBackgroundColorsAndImages",
+ IDS_PRINT_PREVIEW_OPTION_BACKGROUND_COLORS_AND_IMAGES},
+ {"optionBw", IDS_PRINT_PREVIEW_OPTION_BW},
+ {"optionCollate", IDS_PRINT_PREVIEW_OPTION_COLLATE},
+ {"optionColor", IDS_PRINT_PREVIEW_OPTION_COLOR},
+ {"optionCustomPages", IDS_PRINT_PREVIEW_OPTION_CUSTOM_PAGES},
+ {"optionCustomScaling", IDS_PRINT_PREVIEW_OPTION_CUSTOM_SCALING},
+ {"optionDefaultScaling", IDS_PRINT_PREVIEW_OPTION_DEFAULT_SCALING},
+ {"optionEvenPages", IDS_PRINT_PREVIEW_OPTION_EVEN_PAGES},
+ {"optionFitToPage", IDS_PRINT_PREVIEW_OPTION_FIT_TO_PAGE},
+ {"optionFitToPaper", IDS_PRINT_PREVIEW_OPTION_FIT_TO_PAPER},
+ {"optionHeaderFooter", IDS_PRINT_PREVIEW_OPTION_HEADER_FOOTER},
+ {"optionLandscape", IDS_PRINT_PREVIEW_OPTION_LANDSCAPE},
+ {"optionLongEdge", IDS_PRINT_PREVIEW_OPTION_LONG_EDGE},
+ {"optionOddPages", IDS_PRINT_PREVIEW_OPTION_ODD_PAGES},
+ {"optionPortrait", IDS_PRINT_PREVIEW_OPTION_PORTRAIT},
+ {"optionRasterize", IDS_PRINT_PREVIEW_OPTION_RASTERIZE},
+ {"optionSelectionOnly", IDS_PRINT_PREVIEW_OPTION_SELECTION_ONLY},
+ {"optionShortEdge", IDS_PRINT_PREVIEW_OPTION_SHORT_EDGE},
+ {"optionTwoSided", IDS_PRINT_PREVIEW_OPTION_TWO_SIDED},
+ {"optionsLabel", IDS_PRINT_PREVIEW_OPTIONS_LABEL},
+ {"pageDescription", IDS_PRINT_PREVIEW_DESCRIPTION},
+ {"pageRangeLimitInstructionWithValue",
+ IDS_PRINT_PREVIEW_PAGE_RANGE_LIMIT_INSTRUCTION_WITH_VALUE},
+ {"pageRangeSyntaxInstruction",
+ IDS_PRINT_PREVIEW_PAGE_RANGE_SYNTAX_INSTRUCTION},
+ {"pagesLabel", IDS_PRINT_PREVIEW_PAGES_LABEL},
+ {"pagesPerSheetLabel", IDS_PRINT_PREVIEW_PAGES_PER_SHEET_LABEL},
+ {"previewFailed", IDS_PRINT_PREVIEW_FAILED},
+ {"printOnBothSidesLabel", IDS_PRINT_PREVIEW_PRINT_ON_BOTH_SIDES_LABEL},
+ {"printButton", IDS_PRINT_PREVIEW_PRINT_BUTTON},
+ {"printDestinationsTitle", IDS_PRINT_PREVIEW_PRINT_DESTINATIONS_TITLE},
+ {"printPagesLabel", IDS_PRINT_PREVIEW_PRINT_PAGES_LABEL},
#if BUILDFLAG(IS_CHROMEOS)
- {"printerSetupInfoMessageDetailNoPrintersText",
- IDS_PRINT_PREVIEW_PRINTER_SETUP_INFO_MESSAGE_DETAIL_NO_PRINTERS_TEXT},
- {"printerSetupInfoMessageDetailPrinterOfflineText",
- IDS_PRINT_PREVIEW_PRINTER_SETUP_INFO_MESSAGE_DETAIL_PRINTER_OFFLINE_TEXT},
- {"printerSetupInfoMessageHeadingNoPrintersText",
- IDS_PRINT_PREVIEW_PRINTER_SETUP_INFO_MESSAGE_HEADING_NO_PRINTERS_TEXT},
- {"printerSetupInfoMessageHeadingPrinterOfflineText",
- IDS_PRINT_PREVIEW_PRINTER_SETUP_INFO_MESSAGE_HEADING_PRINTER_OFFLINE_TEXT},
- {"printToGoogleDrive", IDS_PRINT_PREVIEW_PRINT_TO_GOOGLE_DRIVE},
+ {"printerSetupInfoMessageDetailNoPrintersText",
+ IDS_PRINT_PREVIEW_PRINTER_SETUP_INFO_MESSAGE_DETAIL_NO_PRINTERS_TEXT},
+ {"printerSetupInfoMessageDetailPrinterOfflineText",
+ IDS_PRINT_PREVIEW_PRINTER_SETUP_INFO_MESSAGE_DETAIL_PRINTER_OFFLINE_TEXT},
+ {"printerSetupInfoMessageHeadingNoPrintersText",
+ IDS_PRINT_PREVIEW_PRINTER_SETUP_INFO_MESSAGE_HEADING_NO_PRINTERS_TEXT},
+ {"printerSetupInfoMessageHeadingPrinterOfflineText",
+ IDS_PRINT_PREVIEW_PRINTER_SETUP_INFO_MESSAGE_HEADING_PRINTER_OFFLINE_TEXT},
+ {"printToGoogleDrive", IDS_PRINT_PREVIEW_PRINT_TO_GOOGLE_DRIVE},
#endif
- {"printToPDF", IDS_PRINT_PREVIEW_PRINT_TO_PDF},
- {"printing", IDS_PRINT_PREVIEW_PRINTING},
+ {"printToPDF", IDS_PRINT_PREVIEW_PRINT_TO_PDF},
+ {"printing", IDS_PRINT_PREVIEW_PRINTING},
#if BUILDFLAG(IS_CHROMEOS)
- {"resolveExtensionUSBDialogTitle",
- IDS_PRINT_PREVIEW_RESOLVE_EXTENSION_USB_DIALOG_TITLE},
- {"resolveExtensionUSBErrorMessage",
- IDS_PRINT_PREVIEW_RESOLVE_EXTENSION_USB_ERROR_MESSAGE},
- {"resolveExtensionUSBPermissionMessage",
- IDS_PRINT_PREVIEW_RESOLVE_EXTENSION_USB_PERMISSION_MESSAGE},
+ {"resolveExtensionUSBDialogTitle",
+ IDS_PRINT_PREVIEW_RESOLVE_EXTENSION_USB_DIALOG_TITLE},
+ {"resolveExtensionUSBErrorMessage",
+ IDS_PRINT_PREVIEW_RESOLVE_EXTENSION_USB_ERROR_MESSAGE},
+ {"resolveExtensionUSBPermissionMessage",
+ IDS_PRINT_PREVIEW_RESOLVE_EXTENSION_USB_PERMISSION_MESSAGE},
#endif
- {"right", IDS_PRINT_PREVIEW_RIGHT_MARGIN_LABEL},
- {"saveButton", IDS_PRINT_PREVIEW_SAVE_BUTTON},
- {"saving", IDS_PRINT_PREVIEW_SAVING},
- {"scalingInstruction", IDS_PRINT_PREVIEW_SCALING_INSTRUCTION},
- {"scalingLabel", IDS_PRINT_PREVIEW_SCALING_LABEL},
- {"searchBoxPlaceholder", IDS_PRINT_PREVIEW_SEARCH_BOX_PLACEHOLDER},
- {"searchResultBubbleText", IDS_SEARCH_RESULT_BUBBLE_TEXT},
- {"searchResultsBubbleText", IDS_SEARCH_RESULTS_BUBBLE_TEXT},
- {"selectButton", IDS_PRINT_PREVIEW_BUTTON_SELECT},
- {"seeMore", IDS_PRINT_PREVIEW_SEE_MORE},
- {"seeMoreDestinationsLabel", IDS_PRINT_PREVIEW_SEE_MORE_DESTINATIONS_LABEL},
+ {"right", IDS_PRINT_PREVIEW_RIGHT_MARGIN_LABEL},
+ {"saveButton", IDS_PRINT_PREVIEW_SAVE_BUTTON},
+ {"saving", IDS_PRINT_PREVIEW_SAVING},
+ {"scalingInstruction", IDS_PRINT_PREVIEW_SCALING_INSTRUCTION},
+ {"scalingLabel", IDS_PRINT_PREVIEW_SCALING_LABEL},
+ {"searchBoxPlaceholder", IDS_PRINT_PREVIEW_SEARCH_BOX_PLACEHOLDER},
+ {"searchResultBubbleText", IDS_SEARCH_RESULT_BUBBLE_TEXT},
+ {"searchResultsBubbleText", IDS_SEARCH_RESULTS_BUBBLE_TEXT},
+ {"selectButton", IDS_PRINT_PREVIEW_BUTTON_SELECT},
+ {"seeMore", IDS_PRINT_PREVIEW_SEE_MORE},
+ {"seeMoreDestinationsLabel",
+ IDS_PRINT_PREVIEW_SEE_MORE_DESTINATIONS_LABEL},
#if BUILDFLAG(IS_CHROMEOS)
- {"serverSearchBoxPlaceholder",
- IDS_PRINT_PREVIEW_SERVER_SEARCH_BOX_PLACEHOLDER},
+ {"serverSearchBoxPlaceholder",
+ IDS_PRINT_PREVIEW_SERVER_SEARCH_BOX_PLACEHOLDER},
#endif
- {"title", IDS_PRINT_PREVIEW_TITLE},
- {"top", IDS_PRINT_PREVIEW_TOP_MARGIN_LABEL},
+ {"title", IDS_PRINT_PREVIEW_TITLE},
+ {"top", IDS_PRINT_PREVIEW_TOP_MARGIN_LABEL},
#if BUILDFLAG(IS_CHROMEOS)
- {"configuringFailedText", IDS_PRINT_CONFIGURING_FAILED_TEXT},
- {"configuringInProgressText", IDS_PRINT_CONFIGURING_IN_PROGRESS_TEXT},
- {"optionPin", IDS_PRINT_PREVIEW_OPTION_PIN},
- {"pinErrorMessage", IDS_PRINT_PREVIEW_PIN_ERROR_MESSAGE},
- {"pinPlaceholder", IDS_PRINT_PREVIEW_PIN_PLACEHOLDER},
- {"printerEulaURL", IDS_PRINT_PREVIEW_EULA_URL},
- {"printerStatusDeviceError", IDS_PRINT_PREVIEW_PRINTER_STATUS_DEVICE_ERROR},
- {"printerStatusDoorOpen", IDS_PRINT_PREVIEW_PRINTER_STATUS_DOOR_OPEN},
- {"printerStatusLowOnInk", IDS_PRINT_PREVIEW_PRINTER_STATUS_LOW_ON_INK},
- {"printerStatusLowOnPaper", IDS_PRINT_PREVIEW_PRINTER_STATUS_LOW_ON_PAPER},
- {"printerStatusOutOfInk", IDS_PRINT_PREVIEW_PRINTER_STATUS_OUT_OF_INK},
- {"printerStatusOutOfPaper", IDS_PRINT_PREVIEW_PRINTER_STATUS_OUT_OF_PAPER},
- {"printerStatusOutputAlmostFull",
- IDS_PRINT_PREVIEW_PRINTER_STATUS_OUPUT_ALMOST_FULL},
- {"printerStatusOutputFull", IDS_PRINT_PREVIEW_PRINTER_STATUS_OUPUT_FULL},
- {"printerStatusPaperJam", IDS_PRINT_PREVIEW_PRINTER_STATUS_PAPER_JAM},
- {"printerStatusPaused", IDS_PRINT_PREVIEW_PRINTER_STATUS_PAUSED},
- {"printerStatusPrinterQueueFull",
- IDS_PRINT_PREVIEW_PRINTER_STATUS_PRINTER_QUEUE_FULL},
- {"printerStatusPrinterUnreachable",
- IDS_PRINT_PREVIEW_PRINTER_STATUS_PRINTER_UNREACHABLE},
- {"printerStatusStopped", IDS_PRINT_PREVIEW_PRINTER_STATUS_STOPPED},
- {"printerStatusTrayMissing", IDS_PRINT_PREVIEW_PRINTER_STATUS_TRAY_MISSING},
+ {"configuringFailedText", IDS_PRINT_CONFIGURING_FAILED_TEXT},
+ {"configuringInProgressText", IDS_PRINT_CONFIGURING_IN_PROGRESS_TEXT},
+ {"optionPin", IDS_PRINT_PREVIEW_OPTION_PIN},
+ {"pinErrorMessage", IDS_PRINT_PREVIEW_PIN_ERROR_MESSAGE},
+ {"pinPlaceholder", IDS_PRINT_PREVIEW_PIN_PLACEHOLDER},
+ {"printerEulaURL", IDS_PRINT_PREVIEW_EULA_URL},
+ {"printerStatusDeviceError",
+ IDS_PRINT_PREVIEW_PRINTER_STATUS_DEVICE_ERROR},
+ {"printerStatusDoorOpen", IDS_PRINT_PREVIEW_PRINTER_STATUS_DOOR_OPEN},
+ {"printerStatusLowOnInk", IDS_PRINT_PREVIEW_PRINTER_STATUS_LOW_ON_INK},
+ {"printerStatusLowOnPaper",
+ IDS_PRINT_PREVIEW_PRINTER_STATUS_LOW_ON_PAPER},
+ {"printerStatusOutOfInk", IDS_PRINT_PREVIEW_PRINTER_STATUS_OUT_OF_INK},
+ {"printerStatusOutOfPaper",
+ IDS_PRINT_PREVIEW_PRINTER_STATUS_OUT_OF_PAPER},
+ {"printerStatusOutputAlmostFull",
+ IDS_PRINT_PREVIEW_PRINTER_STATUS_OUPUT_ALMOST_FULL},
+ {"printerStatusOutputFull", IDS_PRINT_PREVIEW_PRINTER_STATUS_OUPUT_FULL},
+ {"printerStatusPaperJam", IDS_PRINT_PREVIEW_PRINTER_STATUS_PAPER_JAM},
+ {"printerStatusPaused", IDS_PRINT_PREVIEW_PRINTER_STATUS_PAUSED},
+ {"printerStatusPrinterQueueFull",
+ IDS_PRINT_PREVIEW_PRINTER_STATUS_PRINTER_QUEUE_FULL},
+ {"printerStatusPrinterUnreachable",
+ IDS_PRINT_PREVIEW_PRINTER_STATUS_PRINTER_UNREACHABLE},
+ {"printerStatusStopped", IDS_PRINT_PREVIEW_PRINTER_STATUS_STOPPED},
+ {"printerStatusTrayMissing",
+ IDS_PRINT_PREVIEW_PRINTER_STATUS_TRAY_MISSING},
#endif
#if BUILDFLAG(IS_MAC)
- {"openPdfInPreviewOption", IDS_PRINT_PREVIEW_OPEN_PDF_IN_PREVIEW_APP},
- {"openingPDFInPreview", IDS_PRINT_PREVIEW_OPENING_PDF_IN_PREVIEW_APP},
+ {"openPdfInPreviewOption", IDS_PRINT_PREVIEW_OPEN_PDF_IN_PREVIEW_APP},
+ {"openingPDFInPreview", IDS_PRINT_PREVIEW_OPENING_PDF_IN_PREVIEW_APP},
#endif
};
source->AddLocalizedStrings(kLocalizedStrings);
@@ -478,8 +484,9 @@
void PrintPreviewUI::ClearPreviewUIId() {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- if (!id_)
+ if (!id_) {
return;
+ }
receiver_.reset();
PrintPreviewDataService::GetInstance()->RemoveEntry(*id_);
@@ -509,19 +516,22 @@
uint32_t page_index,
int request_id,
scoped_refptr<base::RefCountedMemory> data_bytes) {
- if (!data_bytes || !data_bytes->size())
+ if (!data_bytes || !data_bytes->size()) {
return;
+ }
// Don't bother notifying the UI if this request has been cancelled already.
- if (ShouldCancelRequest(id_, request_id))
+ if (ShouldCancelRequest(id_, request_id)) {
return;
+ }
DCHECK_NE(page_index, kInvalidPageIndex);
SetPrintPreviewDataForIndex(base::checked_cast<int>(page_index),
std::move(data_bytes));
- if (g_test_delegate)
+ if (g_test_delegate) {
g_test_delegate->DidRenderPreviewPage(web_ui()->GetWebContents());
+ }
handler_->SendPagePreviewReady(base::checked_cast<int>(page_index), *id_,
request_id);
}
@@ -529,12 +539,14 @@
void PrintPreviewUI::NotifyUIPreviewDocumentReady(
int request_id,
scoped_refptr<base::RefCountedMemory> data_bytes) {
- if (!data_bytes || !data_bytes->size())
+ if (!data_bytes || !data_bytes->size()) {
return;
+ }
// Don't bother notifying the UI if this request has been cancelled already.
- if (ShouldCancelRequest(id_, request_id))
+ if (ShouldCancelRequest(id_, request_id)) {
return;
+ }
if (!initial_preview_start_time_.is_null()) {
base::TimeDelta display_time =
@@ -586,8 +598,9 @@
base::ReadOnlySharedMemoryRegion region) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- if (ShouldCancelRequest(id_, request_id))
+ if (ShouldCancelRequest(id_, request_id)) {
return;
+ }
if (status != mojom::PrintCompositor::Status::kSuccess) {
DLOG(ERROR) << "Compositing pdf failed with error " << status;
@@ -602,8 +615,9 @@
} else {
AddPdfPageForNupConversion(std::move(region));
uint32_t current_page_index = GetPageToNupConvertIndex(page_index);
- if (current_page_index == kInvalidPageIndex)
+ if (current_page_index == kInvalidPageIndex) {
return;
+ }
if (((current_page_index + 1) % pages_per_sheet_) == 0 ||
LastPageComposited(page_index)) {
@@ -615,12 +629,14 @@
gfx::Rect printable_rect =
PageSetup::GetSymmetricalPrintableArea(page_size(), printable_area());
- if (printable_rect.IsEmpty())
+ if (printable_rect.IsEmpty()) {
return;
+ }
WebContents* web_contents = GetInitiator(web_ui());
- if (!web_contents)
+ if (!web_contents) {
return;
+ }
auto* client = PdfNupConverterClient::FromWebContents(web_contents);
DCHECK(client);
@@ -661,8 +677,9 @@
base::ReadOnlySharedMemoryRegion region) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- if (ShouldCancelRequest(id_, request_id))
+ if (ShouldCancelRequest(id_, request_id)) {
return;
+ }
if (status != mojom::PrintCompositor::Status::kSuccess) {
DLOG(ERROR) << "Completion of document to pdf failed with error " << status;
@@ -676,16 +693,18 @@
base::RefCountedSharedMemoryMapping::CreateFromWholeRegion(region));
} else {
WebContents* web_contents = GetInitiator(web_ui());
- if (!web_contents)
+ if (!web_contents) {
return;
+ }
auto* client = PdfNupConverterClient::FromWebContents(web_contents);
DCHECK(client);
gfx::Rect printable_rect =
PageSetup::GetSymmetricalPrintableArea(page_size_, printable_area_);
- if (printable_rect.IsEmpty())
+ if (printable_rect.IsEmpty()) {
return;
+ }
client->DoNupPdfDocumentConvert(
document_cookie, pages_per_sheet_, page_size_, printable_rect,
@@ -703,11 +722,13 @@
mojom::PrintCompositor::Status status) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- if (ShouldCancelRequest(id_, request_id))
+ if (ShouldCancelRequest(id_, request_id)) {
return;
+ }
- if (status != mojom::PrintCompositor::Status::kSuccess)
+ if (status != mojom::PrintCompositor::Status::kSuccess) {
OnPrintPreviewFailed(request_id);
+ }
}
void PrintPreviewUI::OnNupPdfDocumentConvertDone(
@@ -730,8 +751,9 @@
}
bool PrintPreviewUI::LastPageComposited(uint32_t page_index) const {
- if (pages_to_render_.empty())
+ if (pages_to_render_.empty()) {
return false;
+ }
return page_index == pages_to_render_.back();
}
@@ -761,8 +783,9 @@
int request_id) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- if (!preview_ui_id)
+ if (!preview_ui_id) {
return true;
+ }
auto& map = GetPrintPreviewRequestIdMap();
auto it = map.find(*preview_ui_id);
@@ -777,8 +800,9 @@
WebContents* preview_dialog = web_ui()->GetWebContents();
BackgroundPrintingManager* background_printing_manager =
g_browser_process->background_printing_manager();
- if (background_printing_manager->HasPrintPreviewDialog(preview_dialog))
+ if (background_printing_manager->HasPrintPreviewDialog(preview_dialog)) {
return;
+ }
OnClosePrintPreviewDialog();
}
@@ -841,8 +865,9 @@
page_size_ = ToFlooredSize(params->page_size);
ClearAllPreviewData();
- if (g_test_delegate)
+ if (g_test_delegate) {
g_test_delegate->DidGetPreviewPageCount(params->page_count);
+ }
handler_->SendPageCountReady(base::checked_cast<int>(params->page_count),
params->fit_to_page_scaling, request_id);
}
@@ -886,8 +911,9 @@
}
bool PrintPreviewUI::OnPendingPreviewPage(uint32_t page_index) {
- if (pages_to_render_index_ >= pages_to_render_.size())
+ if (pages_to_render_index_ >= pages_to_render_.size()) {
return false;
+ }
bool matched = page_index == pages_to_render_[pages_to_render_index_];
++pages_to_render_index_;
@@ -911,12 +937,14 @@
WebContents* preview_dialog = web_ui()->GetWebContents();
BackgroundPrintingManager* background_printing_manager =
g_browser_process->background_printing_manager();
- if (background_printing_manager->HasPrintPreviewDialog(preview_dialog))
+ if (background_printing_manager->HasPrintPreviewDialog(preview_dialog)) {
return;
+ }
ConstrainedWebDialogDelegate* delegate = GetConstrainedDelegate();
- if (!delegate)
+ if (!delegate) {
return;
+ }
std::unique_ptr<content::WebContents> preview_contents =
delegate->ReleaseWebContents();
DCHECK_EQ(preview_dialog, preview_contents.get());
@@ -926,12 +954,14 @@
}
void PrintPreviewUI::OnClosePrintPreviewDialog() {
- if (dialog_closed_)
+ if (dialog_closed_) {
return;
+ }
dialog_closed_ = true;
ConstrainedWebDialogDelegate* delegate = GetConstrainedDelegate();
- if (!delegate)
+ if (!delegate) {
return;
+ }
delegate->GetWebDialogDelegate()->OnDialogClosed(std::string());
delegate->OnDialogCloseFromWebUI();
}
@@ -939,8 +969,9 @@
void PrintPreviewUI::SetOptionsFromDocument(
const mojom::OptionsFromDocumentParamsPtr params,
int32_t request_id) {
- if (ShouldCancelRequest(id_, request_id))
+ if (ShouldCancelRequest(id_, request_id)) {
return;
+ }
handler_->SendPrintPresetOptions(params->is_scaling_disabled, params->copies,
params->duplex, request_id);
}
@@ -955,22 +986,25 @@
}
WebContents* web_contents = GetInitiator(web_ui());
- if (!web_contents)
+ if (!web_contents) {
return;
+ }
// For case of print preview, page metafile is used to composite into
// the document PDF at same time. Need to indicate that this scenario
// is at play for the compositor.
auto* client = PrintCompositeClient::FromWebContents(web_contents);
DCHECK(client);
- if (client->GetIsDocumentConcurrentlyComposited(document_cookie))
+ if (client->GetIsDocumentConcurrentlyComposited(document_cookie)) {
return;
+ }
content::RenderFrameHost* render_frame_host =
PrintViewManager::FromWebContents(web_contents)->print_preview_rfh();
// |render_frame_host| could be null when the print preview dialog is closed.
- if (!render_frame_host)
+ if (!render_frame_host) {
return;
+ }
PRINTER_LOG(EVENT) << "Compositing for document type "
<< GetCompositorDocumentType();
@@ -998,12 +1032,14 @@
if (ShouldUseCompositor()) {
// Don't bother compositing if this request has been cancelled already.
- if (ShouldCancelRequest(id_, request_id))
+ if (ShouldCancelRequest(id_, request_id)) {
return;
+ }
WebContents* web_contents = GetInitiator(web_ui());
- if (!web_contents)
+ if (!web_contents) {
return;
+ }
auto* client = PrintCompositeClient::FromWebContents(web_contents);
DCHECK(client);
@@ -1012,8 +1048,9 @@
PrintViewManager::FromWebContents(web_contents)->print_preview_rfh();
// |render_frame_host| could be null when the print preview dialog is
// closed.
- if (!render_frame_host)
+ if (!render_frame_host) {
return;
+ }
// Use utility process to convert Skia metafile to PDF or XPS.
client->CompositePage(
@@ -1046,8 +1083,9 @@
// the individual pages, so |metafile| should be invalid.
// When it is inactive, the print document is composed from |metafile|.
// So if this comparison succeeds, that means the renderer sent bad data.
- if (composite_document_using_individual_pages == metafile.IsValid())
+ if (composite_document_using_individual_pages == metafile.IsValid()) {
return;
+ }
if (params->expected_pages_count == 0) {
receiver_.ReportBadMessage(kInvalidPageCountForMetafileReadyForPrinting);
@@ -1056,16 +1094,18 @@
if (composite_document_using_individual_pages) {
// Don't bother compositing if this request has been cancelled already.
- if (ShouldCancelRequest(id_, request_id))
+ if (ShouldCancelRequest(id_, request_id)) {
return;
+ }
auto callback = base::BindOnce(&PrintPreviewUI::OnCompositeToPdfDone,
weak_ptr_factory_.GetWeakPtr(),
params->document_cookie, request_id);
WebContents* web_contents = GetInitiator(web_ui());
- if (!web_contents)
+ if (!web_contents) {
return;
+ }
// Page metafile is used to composite into the document at same time.
// Need to provide particulars of how many pages are required before
@@ -1087,8 +1127,9 @@
void PrintPreviewUI::PrintPreviewFailed(int32_t document_cookie,
int32_t request_id) {
StopWorker(document_cookie);
- if (ShouldCancelRequest(id_, request_id))
+ if (ShouldCancelRequest(id_, request_id)) {
return;
+ }
OnPrintPreviewFailed(request_id);
}
@@ -1096,16 +1137,18 @@
int32_t request_id) {
// Always need to stop the worker.
StopWorker(document_cookie);
- if (ShouldCancelRequest(id_, request_id))
+ if (ShouldCancelRequest(id_, request_id)) {
return;
+ }
handler_->OnPrintPreviewCancelled(request_id);
}
void PrintPreviewUI::PrinterSettingsInvalid(int32_t document_cookie,
int32_t request_id) {
StopWorker(document_cookie);
- if (ShouldCancelRequest(id_, request_id))
+ if (ShouldCancelRequest(id_, request_id)) {
return;
+ }
handler_->OnInvalidPrinterSettings(request_id);
}
diff --git a/chrome/browser/ui/webui/print_preview/print_preview_utils.cc b/chrome/browser/ui/webui/print_preview/print_preview_utils.cc
index 3a04a15..e2bb0ca 100644
--- a/chrome/browser/ui/webui/print_preview/print_preview_utils.cc
+++ b/chrome/browser/ui/webui/print_preview/print_preview_utils.cc
@@ -60,8 +60,9 @@
printer_info.Set(kSettingPrinterDescription, printer.printer_description);
base::Value::Dict options;
- for (const auto& opt_it : printer.options)
+ for (const auto& opt_it : printer.options) {
options.SetByDottedPath(opt_it.first, opt_it.second);
+ }
#if BUILDFLAG(IS_CHROMEOS_ASH)
printer_info.Set(
@@ -93,30 +94,37 @@
}
bool DpiCapabilityInvalid(const base::Value& val) {
- if (!val.is_dict())
+ if (!val.is_dict()) {
return true;
+ }
const auto& dict = val.GetDict();
std::optional<int> horizontal_dpi = dict.FindInt(kHorizontalDpi);
- if (horizontal_dpi.value_or(0) <= 0)
+ if (horizontal_dpi.value_or(0) <= 0) {
return true;
+ }
std::optional<int> vertical_dpi = dict.FindInt(kVerticalDpi);
- if (vertical_dpi.value_or(0) <= 0)
+ if (vertical_dpi.value_or(0) <= 0) {
return true;
+ }
return false;
}
bool VendorCapabilityInvalid(const base::Value& val) {
- if (!val.is_dict())
+ if (!val.is_dict()) {
return true;
+ }
const auto& dict = val.GetDict();
const std::string* option_type = dict.FindString(kTypeKey);
- if (!option_type)
+ if (!option_type) {
return true;
- if (*option_type != kSelectString)
+ }
+ if (*option_type != kSelectString) {
return false;
+ }
const base::Value::Dict* select_cap = dict.FindDict(kSelectCapKey);
- if (!select_cap)
+ if (!select_cap) {
return true;
+ }
const base::Value::List* options_list = select_cap->FindList(kOptionKey);
if (!options_list || options_list->empty() ||
GetFilteredList(*options_list, ValueIsNull).empty()) {
@@ -133,18 +141,21 @@
base::Value::Dict ValidateCddForPrintPreview(base::Value::Dict cdd) {
base::Value::Dict* caps = cdd.FindDict(kPrinter);
- if (!caps)
+ if (!caps) {
return cdd;
+ }
base::Value::Dict out_caps;
for (auto capability : *caps) {
const auto& key = capability.first;
base::Value& value = capability.second;
base::Value::List* list_value = nullptr;
- if (value.is_list())
+ if (value.is_list()) {
list_value = &value.GetList();
- if (value.is_dict())
+ }
+ if (value.is_dict()) {
list_value = value.GetDict().FindList(kOptionKey);
+ }
if (!list_value) {
out_caps.Set(key, std::move(value));
@@ -160,25 +171,29 @@
} else {
list_value->EraseIf(ValueIsNull);
}
- if (list_value->empty()) // leave out empty lists.
+ if (list_value->empty()) { // leave out empty lists.
continue;
+ }
if (is_vendor_capability) {
// Need to also filter the individual capability lists.
for (auto& vendor_option : *list_value) {
- if (!vendor_option.is_dict())
+ if (!vendor_option.is_dict()) {
continue;
+ }
auto& vendor_dict = vendor_option.GetDict();
const std::string* type = vendor_dict.FindString(kTypeKey);
- if (!type || *type != kSelectString)
+ if (!type || *type != kSelectString) {
continue;
+ }
auto* select_cap_dict = vendor_dict.FindDict(kSelectCapKey);
if (select_cap_dict) {
auto* option_list = select_cap_dict->FindList(kOptionKey);
- if (option_list)
+ if (option_list) {
option_list->EraseIf(ValueIsNull);
+ }
}
}
}
@@ -187,8 +202,9 @@
option_dict.Set(kOptionKey, std::move(*list_value));
std::optional<bool> reset_to_default =
value.GetDict().FindBool(kResetToDefaultKey);
- if (reset_to_default.has_value())
+ if (reset_to_default.has_value()) {
option_dict.Set(kResetToDefaultKey, reset_to_default.value());
+ }
out_caps.Set(key, std::move(option_dict));
} else {
out_caps.Set(key, std::move(*list_value));
@@ -200,8 +216,9 @@
base::Value::Dict UpdateCddWithDpiIfMissing(base::Value::Dict cdd) {
base::Value::Dict* printer = cdd.FindDict(kPrinter);
- if (!printer)
+ if (!printer) {
return cdd;
+ }
if (!printer->FindDict(kDpiCapabilityKey)) {
base::Value::Dict default_dpi;
@@ -255,8 +272,9 @@
VLOG(1) << "Enumerate printers finished, found " << printers.size()
<< " printers";
- if (!printers.empty())
+ if (!printers.empty()) {
callback.Run(std::move(printers));
+ }
std::move(done_callback).Run();
}
diff --git a/chrome/browser/ui/webui/print_preview/print_preview_utils_unittest.cc b/chrome/browser/ui/webui/print_preview/print_preview_utils_unittest.cc
index ddc133f5..f198a2c 100644
--- a/chrome/browser/ui/webui/print_preview/print_preview_utils_unittest.cc
+++ b/chrome/browser/ui/webui/print_preview/print_preview_utils_unittest.cc
@@ -64,8 +64,9 @@
base::Value::Dict option;
option.Set(kDisplayName, base::NumberToString(i));
option.Set(kValue, i);
- if (i == 1)
+ if (i == 1) {
option.Set(kIsDefault, true);
+ }
pages_per_sheet.Append(std::move(option));
}
base::Value::Dict pages_per_sheet_option;
@@ -107,8 +108,9 @@
size_t index) {
base::Value::List* vendor_capabilities_list =
printer.FindList(kVendorCapability);
- if (!vendor_capabilities_list || index >= vendor_capabilities_list->size())
+ if (!vendor_capabilities_list || index >= vendor_capabilities_list->size()) {
return nullptr;
+ }
auto& ret = (*vendor_capabilities_list)[index];
return ret.is_dict() ? &ret.GetDict() : nullptr;
@@ -381,8 +383,9 @@
base::Value::Dict option;
option.Set(kDisplayName, base::NumberToString(i));
option.Set(kValue, i);
- if (i == 1)
+ if (i == 1) {
option.Set(kIsDefault, true);
+ }
pages_per_sheet.Append(std::move(option));
}
vendor_dict->Set(kOptionKey, std::move(pages_per_sheet));
diff --git a/chrome/browser/ui/webui/privacy_sandbox/privacy_sandbox_dialog_handler.cc b/chrome/browser/ui/webui/privacy_sandbox/privacy_sandbox_dialog_handler.cc
index 94479418e..55f68c4 100644
--- a/chrome/browser/ui/webui/privacy_sandbox/privacy_sandbox_dialog_handler.cc
+++ b/chrome/browser/ui/webui/privacy_sandbox/privacy_sandbox_dialog_handler.cc
@@ -114,8 +114,9 @@
}
void PrivacySandboxDialogHandler::OnJavascriptDisallowed() {
- if (did_user_make_decision_)
+ if (did_user_make_decision_) {
return;
+ }
// If user hasn't made a decision, notify the service.
if (IsConsent(prompt_type_)) {
@@ -135,8 +136,9 @@
void PrivacySandboxDialogHandler::HandlePromptActionOccurred(
const base::Value::List& args) {
- if (!IsJavascriptAllowed())
+ if (!IsJavascriptAllowed()) {
return;
+ }
CHECK_EQ(1U, args.size());
auto action =
diff --git a/chrome/browser/ui/webui/privacy_sandbox/privacy_sandbox_internals_handler.cc b/chrome/browser/ui/webui/privacy_sandbox/privacy_sandbox_internals_handler.cc
index 367f181..89182183 100644
--- a/chrome/browser/ui/webui/privacy_sandbox/privacy_sandbox_internals_handler.cc
+++ b/chrome/browser/ui/webui/privacy_sandbox/privacy_sandbox_internals_handler.cc
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/ui/webui/privacy_sandbox/privacy_sandbox_internals_handler.h"
+
#include "base/logging.h"
#include "chrome/browser/content_settings/cookie_settings_factory.h"
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
diff --git a/chrome/browser/ui/webui/privacy_sandbox/related_website_sets/related_website_sets_handler.cc b/chrome/browser/ui/webui/privacy_sandbox/related_website_sets/related_website_sets_handler.cc
index 776e896..27b9935 100644
--- a/chrome/browser/ui/webui/privacy_sandbox/related_website_sets/related_website_sets_handler.cc
+++ b/chrome/browser/ui/webui/privacy_sandbox/related_website_sets/related_website_sets_handler.cc
@@ -20,8 +20,7 @@
namespace {
constexpr char kNoServiceError[] = "Service error";
-constexpr char kServiceNotReadyError[] =
- "Backend error, service not ready";
+constexpr char kServiceNotReadyError[] = "Backend error, service not ready";
SiteType GetSiteType(const net::SiteType type) {
switch (type) {
diff --git a/chrome/browser/ui/webui/profile_helper.cc b/chrome/browser/ui/webui/profile_helper.cc
index 775b5f8..ea1a668 100644
--- a/chrome/browser/ui/webui/profile_helper.cc
+++ b/chrome/browser/ui/webui/profile_helper.cc
@@ -53,8 +53,9 @@
void DeleteProfileAtPath(base::FilePath file_path,
ProfileMetrics::ProfileDelete deletion_source) {
- if (!profiles::IsMultipleProfilesEnabled())
+ if (!profiles::IsMultipleProfilesEnabled()) {
return;
+ }
g_browser_process->profile_manager()
->GetDeleteProfileHelper()
.MaybeScheduleProfileForDeletion(
diff --git a/chrome/browser/ui/webui/profile_helper.h b/chrome/browser/ui/webui/profile_helper.h
index 7ce44f59..9767cb0 100644
--- a/chrome/browser/ui/webui/profile_helper.h
+++ b/chrome/browser/ui/webui/profile_helper.h
@@ -23,6 +23,4 @@
} // namespace webui
-
-
#endif // CHROME_BROWSER_UI_WEBUI_PROFILE_HELPER_H_
diff --git a/chrome/browser/ui/webui/profile_helper_browsertest.cc b/chrome/browser/ui/webui/profile_helper_browsertest.cc
index 45c6de0..b0592d54 100644
--- a/chrome/browser/ui/webui/profile_helper_browsertest.cc
+++ b/chrome/browser/ui/webui/profile_helper_browsertest.cc
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "chrome/browser/ui/webui/profile_helper.h"
+
#include "base/containers/contains.h"
#include "base/files/file_util.h"
#include "base/functional/bind.h"
@@ -22,7 +24,6 @@
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_list_observer.h"
-#include "chrome/browser/ui/webui/profile_helper.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/profile_deletion_observer.h"
#include "chrome/test/base/ui_test_utils.h"
@@ -57,14 +58,13 @@
BrowserList::RemoveObserver(this);
}
- void Wait() {
- loop_.Run();
- }
+ void Wait() { loop_.Run(); }
protected:
void OnBrowserSetLastActive(Browser* browser) override {
- if (browser->profile() == profile_)
+ if (browser->profile() == profile_) {
loop_.Quit();
+ }
}
private:
diff --git a/chrome/browser/ui/webui/profile_info_watcher.cc b/chrome/browser/ui/webui/profile_info_watcher.cc
index 83de27b..4cd24e7 100644
--- a/chrome/browser/ui/webui/profile_info_watcher.cc
+++ b/chrome/browser/ui/webui/profile_info_watcher.cc
@@ -23,8 +23,9 @@
ProfileManager* profile_manager = g_browser_process->profile_manager();
// The profile_manager might be NULL in testing environments.
- if (profile_manager)
+ if (profile_manager) {
profile_manager->GetProfileAttributesStorage().AddObserver(this);
+ }
signin_allowed_pref_.Init(
prefs::kSigninAllowed, profile_->GetPrefs(),
@@ -35,8 +36,9 @@
ProfileInfoWatcher::~ProfileInfoWatcher() {
ProfileManager* profile_manager = g_browser_process->profile_manager();
// The profile_manager might be NULL in testing environments.
- if (profile_manager)
+ if (profile_manager) {
profile_manager->GetProfileAttributesStorage().RemoveObserver(this);
+ }
}
void ProfileInfoWatcher::OnProfileAuthInfoChanged(
@@ -60,6 +62,7 @@
}
void ProfileInfoWatcher::RunCallback() {
- if (GetIdentityManager())
+ if (GetIdentityManager()) {
callback_.Run();
+ }
}
diff --git a/chrome/browser/ui/webui/reset_password/reset_password_ui.cc b/chrome/browser/ui/webui/reset_password/reset_password_ui.cc
index 6b25ee6..e17039a 100644
--- a/chrome/browser/ui/webui/reset_password/reset_password_ui.cc
+++ b/chrome/browser/ui/webui/reset_password/reset_password_ui.cc
@@ -90,8 +90,9 @@
PasswordType GetPasswordType(content::WebContents* web_contents) {
content::NavigationEntry* nav_entry =
web_contents->GetController().GetPendingEntry();
- if (!nav_entry || !nav_entry->GetHasPostData() || !nav_entry->GetPostData())
+ if (!nav_entry || !nav_entry->GetHasPostData() || !nav_entry->GetPostData()) {
return PasswordType::PASSWORD_TYPE_UNKNOWN;
+ }
auto& post_data = nav_entry->GetPostData()->elements()->at(0);
if (post_data.type() == network::DataElement::Tag::kBytes) {
int post_data_int = -1;
@@ -108,8 +109,9 @@
// Properly format host name based on text direction.
std::u16string GetFormattedHostName(const std::string host_name) {
std::u16string host = url_formatter::IDNToUnicode(host_name);
- if (base::i18n::IsRTL())
+ if (base::i18n::IsRTL()) {
base::i18n::WrapStringWithLTRFormatting(&host);
+ }
return host;
}
diff --git a/chrome/browser/ui/webui/sandbox/sandbox_handler.cc b/chrome/browser/ui/webui/sandbox/sandbox_handler.cc
index cbe3f8b..d1fa270 100644
--- a/chrome/browser/ui/webui/sandbox/sandbox_handler.cc
+++ b/chrome/browser/ui/webui/sandbox/sandbox_handler.cc
@@ -33,8 +33,9 @@
for (BrowserChildProcessHostIterator itr; !itr.Done(); ++itr) {
const ChildProcessData& process_data = itr.GetData();
// Only add processes that have already started, i.e. with valid handles.
- if (!process_data.GetProcess().IsValid())
+ if (!process_data.GetProcess().IsValid()) {
continue;
+ }
base::Value::Dict proc;
proc.Set("processId",
base::strict_cast<double>(process_data.GetProcess().Pid()));
@@ -59,8 +60,9 @@
!it.IsAtEnd(); it.Advance()) {
RenderProcessHost* host = it.GetCurrentValue();
// Skip processes that might not have started yet.
- if (!host->GetProcess().IsValid())
+ if (!host->GetProcess().IsValid()) {
continue;
+ }
base::Value::Dict proc;
proc.Set("processId", base::strict_cast<double>(host->GetProcess().Pid()));
diff --git a/chrome/browser/ui/webui/sanitized_image_source.cc b/chrome/browser/ui/webui/sanitized_image_source.cc
index d5a2120..f621b73 100644
--- a/chrome/browser/ui/webui/sanitized_image_source.cc
+++ b/chrome/browser/ui/webui/sanitized_image_source.cc
@@ -77,8 +77,9 @@
};
for (const char* const suffix : kGooglePhotosHostSuffixes) {
- if (base::EndsWith(url.host_piece(), suffix))
+ if (base::EndsWith(url.host_piece(), suffix)) {
return true;
+ }
}
return false;
}
diff --git a/chrome/browser/ui/webui/search_engine_choice/search_engine_choice_ui.cc b/chrome/browser/ui/webui/search_engine_choice/search_engine_choice_ui.cc
index 80a0f4d..daa962e 100644
--- a/chrome/browser/ui/webui/search_engine_choice/search_engine_choice_ui.cc
+++ b/chrome/browser/ui/webui/search_engine_choice/search_engine_choice_ui.cc
@@ -71,7 +71,6 @@
SearchEngineChoiceUI::SearchEngineChoiceUI(content::WebUI* web_ui)
: ui::MojoWebUIController(web_ui, true),
profile_(CHECK_DEREF(Profile::FromWebUI(web_ui))) {
-
content::WebUIDataSource* source = content::WebUIDataSource::CreateAndAdd(
web_ui->GetWebContents()->GetBrowserContext(),
chrome::kChromeUISearchEngineChoiceHost);
diff --git a/chrome/browser/ui/webui/segmentation_internals/segmentation_internals_page_handler_impl.cc b/chrome/browser/ui/webui/segmentation_internals/segmentation_internals_page_handler_impl.cc
index 2acba1b..253bfe7 100644
--- a/chrome/browser/ui/webui/segmentation_internals/segmentation_internals_page_handler_impl.cc
+++ b/chrome/browser/ui/webui/segmentation_internals/segmentation_internals_page_handler_impl.cc
@@ -19,39 +19,45 @@
: receiver_(this, std::move(receiver)),
page_(std::move(page)),
service_proxy_(segmentation_service->GetServiceProxy()) {
- if (service_proxy_)
+ if (service_proxy_) {
service_proxy_->AddObserver(this);
+ }
}
SegmentationInternalsPageHandlerImpl::~SegmentationInternalsPageHandlerImpl() {
- if (service_proxy_)
+ if (service_proxy_) {
service_proxy_->RemoveObserver(this);
+ }
}
void SegmentationInternalsPageHandlerImpl::GetServiceStatus() {
- if (!service_proxy_)
+ if (!service_proxy_) {
return;
+ }
service_proxy_->GetServiceStatus();
}
void SegmentationInternalsPageHandlerImpl::ExecuteModel(int segment_id) {
- if (!service_proxy_)
+ if (!service_proxy_) {
return;
+ }
service_proxy_->ExecuteModel(static_cast<SegmentId>(segment_id));
}
void SegmentationInternalsPageHandlerImpl::OverwriteResult(int segment_id,
float result) {
- if (!service_proxy_)
+ if (!service_proxy_) {
return;
+ }
service_proxy_->OverwriteResult(static_cast<SegmentId>(segment_id), result);
}
void SegmentationInternalsPageHandlerImpl::SetSelected(
const std::string& segmentation_key,
int segment_id) {
- if (!service_proxy_)
+ if (!service_proxy_) {
return;
+ }
service_proxy_->SetSelectedSegment(segmentation_key,
static_cast<SegmentId>(segment_id));
diff --git a/chrome/browser/ui/webui/settings/about_handler.cc b/chrome/browser/ui/webui/settings/about_handler.cc
index 841116f..6567243 100644
--- a/chrome/browser/ui/webui/settings/about_handler.cc
+++ b/chrome/browser/ui/webui/settings/about_handler.cc
@@ -133,8 +133,9 @@
// On a managed machine we delegate this setting to the affiliated users
// only if the policy value is true.
ash::CrosSettings::Get()->GetBoolean(ash::kReleaseChannelDelegated, &value);
- if (!value)
+ if (!value) {
return false;
+ }
// Get the currently logged-in user and check if it is affiliated.
const user_manager::User* user =
@@ -186,8 +187,9 @@
}
// Try the fallback region code if no directory was found.
- if (region_path.empty() && region != kDefaultRegionCode)
+ if (region_path.empty() && region != kDefaultRegionCode) {
region_path = GetRegulatoryLabelDirForRegion(kDefaultRegionCode);
+ }
return region_path;
}
@@ -202,8 +204,9 @@
.AppendASCII(kRegulatoryLabelTextFilename);
std::string contents;
- if (base::ReadFileToString(text_path, &contents))
+ if (base::ReadFileToString(text_path, &contents)) {
return contents;
+ }
return std::string();
}
@@ -915,17 +918,19 @@
state == VersionUpdater::PROMOTE_ENABLED;
std::u16string text;
- if (actionable)
+ if (actionable) {
text = l10n_util::GetStringUTF16(IDS_ABOUT_CHROME_AUTOUPDATE_ALL);
- else if (state == VersionUpdater::PROMOTED)
+ } else if (state == VersionUpdater::PROMOTED) {
text = l10n_util::GetStringUTF16(IDS_ABOUT_CHROME_AUTOUPDATE_ALL_IS_ON);
+ }
base::Value::Dict promo_state;
promo_state.Set("hidden", hidden);
promo_state.Set("disabled", disabled);
promo_state.Set("actionable", actionable);
- if (!text.empty())
+ if (!text.empty()) {
promo_state.Set("text", text);
+ }
FireWebUIListener("promotion-state-changed", promo_state);
}
diff --git a/chrome/browser/ui/webui/settings/accessibility_main_handler.h b/chrome/browser/ui/webui/settings/accessibility_main_handler.h
index 314ddd3..2041b51 100644
--- a/chrome/browser/ui/webui/settings/accessibility_main_handler.h
+++ b/chrome/browser/ui/webui/settings/accessibility_main_handler.h
@@ -15,7 +15,6 @@
#include "chrome/browser/ash/accessibility/accessibility_manager.h"
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
-
namespace settings {
// Settings handler for the main accessibility settings page,
diff --git a/chrome/browser/ui/webui/settings/browser_lifetime_handler.cc b/chrome/browser/ui/webui/settings/browser_lifetime_handler.cc
index ef33299c..2fbec7e 100644
--- a/chrome/browser/ui/webui/settings/browser_lifetime_handler.cc
+++ b/chrome/browser/ui/webui/settings/browser_lifetime_handler.cc
@@ -127,8 +127,9 @@
!user_manager::UserManager::Get()->IsLoggedInAsGuest() &&
!user_manager::UserManager::Get()->IsLoggedInAsChildUser();
- if (!allow_powerwash)
+ if (!allow_powerwash) {
return;
+ }
PrefService* prefs = g_browser_process->local_state();
prefs->SetBoolean(prefs::kFactoryResetRequested, true);
diff --git a/chrome/browser/ui/webui/settings/captions_handler.cc b/chrome/browser/ui/webui/settings/captions_handler.cc
index 38644bfc..efaf0003 100644
--- a/chrome/browser/ui/webui/settings/captions_handler.cc
+++ b/chrome/browser/ui/webui/settings/captions_handler.cc
@@ -66,8 +66,9 @@
}
CaptionsHandler::~CaptionsHandler() {
- if (soda_available_)
+ if (soda_available_) {
speech::SodaInstaller::GetInstance()->RemoveObserver(this);
+ }
}
void CaptionsHandler::RegisterMessages() {
@@ -98,13 +99,15 @@
}
void CaptionsHandler::OnJavascriptAllowed() {
- if (soda_available_)
+ if (soda_available_) {
speech::SodaInstaller::GetInstance()->AddObserver(this);
+ }
}
void CaptionsHandler::OnJavascriptDisallowed() {
- if (soda_available_)
+ if (soda_available_) {
speech::SodaInstaller::GetInstance()->RemoveObserver(this);
+ }
}
void CaptionsHandler::HandleLiveCaptionSectionReady(
@@ -243,8 +246,9 @@
// early. We do not check for a matching language if multi-language is
// enabled because we show all of the languages' download status in the UI,
// even ones that are not currently selected.
- if (!prefs::IsLanguageCodeForLiveCaption(language_code, prefs_))
+ if (!prefs::IsLanguageCodeForLiveCaption(language_code, prefs_)) {
return;
+ }
speech::SodaInstaller::GetInstance()->RemoveObserver(this);
}
diff --git a/chrome/browser/ui/webui/settings/custom_home_pages_table_model.cc b/chrome/browser/ui/webui/settings/custom_home_pages_table_model.cc
index 427458bf..7d28517a 100644
--- a/chrome/browser/ui/webui/settings/custom_home_pages_table_model.cc
+++ b/chrome/browser/ui/webui/settings/custom_home_pages_table_model.cc
@@ -71,8 +71,9 @@
void CustomHomePagesTableModel::Add(size_t index, const GURL& url) {
AddWithoutNotification(index, url);
LoadTitle(&(entries_[index]));
- if (observer_)
+ if (observer_) {
observer_->OnItemsAdded(index, 1);
+ }
}
void CustomHomePagesTableModel::RemoveWithoutNotification(size_t index) {
@@ -89,32 +90,36 @@
void CustomHomePagesTableModel::Remove(size_t index) {
RemoveWithoutNotification(index);
- if (observer_)
+ if (observer_) {
observer_->OnItemsRemoved(index, 1);
+ }
}
void CustomHomePagesTableModel::SetToCurrentlyOpenPages(
content::WebContents* ignore_contents) {
// Remove the current entries.
- while (RowCount())
+ while (RowCount()) {
RemoveWithoutNotification(0);
+ }
// Add tabs from appropriate browser windows.
size_t add_index = 0;
for (Browser* browser : *BrowserList::GetInstance()) {
- if (!ShouldIncludeBrowser(browser))
+ if (!ShouldIncludeBrowser(browser)) {
continue;
+ }
- for (int tab_index = 0;
- tab_index < browser->tab_strip_model()->count();
+ for (int tab_index = 0; tab_index < browser->tab_strip_model()->count();
++tab_index) {
content::WebContents* contents =
browser->tab_strip_model()->GetWebContentsAt(tab_index);
- if (contents == ignore_contents)
+ if (contents == ignore_contents) {
continue;
+ }
const GURL url = contents->GetURL();
- if (!url.is_empty() && !url.SchemeIs(content::kChromeDevToolsScheme))
+ if (!url.is_empty() && !url.SchemeIs(content::kChromeDevToolsScheme)) {
AddWithoutNotification(add_index++, url);
+ }
}
}
LoadAllTitles();
@@ -122,8 +127,9 @@
std::vector<GURL> CustomHomePagesTableModel::GetURLs() {
std::vector<GURL> urls(entries_.size());
- for (size_t i = 0; i < entries_.size(); ++i)
+ for (size_t i = 0; i < entries_.size(); ++i) {
urls[i] = entries_[i].url;
+ }
return urls;
}
@@ -151,8 +157,9 @@
bool CustomHomePagesTableModel::ShouldIncludeBrowser(Browser* browser) {
// Do not include incognito browsers.
- if (browser->profile() != profile_)
+ if (browser->profile() != profile_) {
return false;
+ }
#if BUILDFLAG(IS_CHROMEOS_ASH)
// Do not include the Settings window.
if (chrome::SettingsWindowManager::GetInstance()->IsSettingsBrowser(
@@ -193,8 +200,9 @@
&task_tracker_);
}
}
- if (entries_.empty())
+ if (entries_.empty()) {
observer_->OnModelChanged();
+ }
}
void CustomHomePagesTableModel::OnGotOneOfManyTitles(
@@ -202,8 +210,9 @@
history::QueryURLResult result) {
OnGotTitle(entry_url, false, std::move(result));
DCHECK_GE(num_outstanding_title_lookups_, 1);
- if (--num_outstanding_title_lookups_ == 0 && observer_)
+ if (--num_outstanding_title_lookups_ == 0 && observer_) {
observer_->OnModelChanged();
+ }
}
void CustomHomePagesTableModel::OnGotTitle(const GURL& entry_url,
@@ -225,8 +234,9 @@
entry->task_id = base::CancelableTaskTracker::kBadTaskId;
if (result.success && !result.row.title().empty()) {
entry->title = result.row.title();
- if (observer_ && observable)
+ if (observer_ && observable) {
observer_->OnItemsChanged(entry_index, 1);
+ }
}
}
diff --git a/chrome/browser/ui/webui/settings/downloads_handler.cc b/chrome/browser/ui/webui/settings/downloads_handler.cc
index 6ab9624d..f8503957 100644
--- a/chrome/browser/ui/webui/settings/downloads_handler.cc
+++ b/chrome/browser/ui/webui/settings/downloads_handler.cc
@@ -34,8 +34,9 @@
DownloadsHandler::~DownloadsHandler() {
// There may be pending file dialogs, we need to tell them that we've gone
// away so they don't try and call back to us.
- if (select_folder_dialog_)
+ if (select_folder_dialog_) {
select_folder_dialog_->ListenerDestroyed();
+ }
}
void DownloadsHandler::RegisterMessages() {
@@ -94,8 +95,9 @@
void DownloadsHandler::HandleSelectDownloadLocation(
const base::Value::List& args) {
// Early return if the select folder dialog is already active.
- if (select_folder_dialog_)
+ if (select_folder_dialog_) {
return;
+ }
PrefService* pref_service = profile_->GetPrefs();
select_folder_dialog_ = ui::SelectFileDialog::Create(
diff --git a/chrome/browser/ui/webui/settings/font_handler.cc b/chrome/browser/ui/webui/settings/font_handler.cc
index 91f6715..21ecda5 100644
--- a/chrome/browser/ui/webui/settings/font_handler.cc
+++ b/chrome/browser/ui/webui/settings/font_handler.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/ui/webui/settings/font_handler.h"
#include <stddef.h>
+
#include <string>
#include <utility>
#include <vector>
diff --git a/chrome/browser/ui/webui/settings/hats_handler.cc b/chrome/browser/ui/webui/settings/hats_handler.cc
index f5dce54..a17af3f 100644
--- a/chrome/browser/ui/webui/settings/hats_handler.cc
+++ b/chrome/browser/ui/webui/settings/hats_handler.cc
@@ -231,8 +231,9 @@
// The HaTS service may not be available for the profile, for example if it
// is a guest profile.
- if (!hats_service)
+ if (!hats_service) {
return;
+ }
std::string trigger = "";
int timeout_ms = 0;
@@ -290,8 +291,9 @@
void HatsHandler::InformSentimentService(TrustSafetyInteraction interaction) {
auto* sentiment_service = TrustSafetySentimentServiceFactory::GetForProfile(
Profile::FromWebUI(web_ui()));
- if (!sentiment_service)
+ if (!sentiment_service) {
return;
+ }
if (interaction == TrustSafetyInteraction::USED_PRIVACY_CARD) {
sentiment_service->InteractedWithPrivacySettings(
diff --git a/chrome/browser/ui/webui/settings/hats_handler_unittest.cc b/chrome/browser/ui/webui/settings/hats_handler_unittest.cc
index 0767267..d023a04 100644
--- a/chrome/browser/ui/webui/settings/hats_handler_unittest.cc
+++ b/chrome/browser/ui/webui/settings/hats_handler_unittest.cc
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "build/build_config.h"
#include "chrome/browser/ui/webui/settings/hats_handler.h"
#include <memory>
@@ -11,6 +10,7 @@
#include "base/memory/raw_ptr.h"
#include "base/values.h"
#include "build/branding_buildflags.h"
+#include "build/build_config.h"
#include "chrome/browser/privacy_sandbox/privacy_sandbox_settings_factory.h"
#include "chrome/browser/ui/hats/hats_service.h"
#include "chrome/browser/ui/hats/hats_service_factory.h"
diff --git a/chrome/browser/ui/webui/settings/import_data_handler.cc b/chrome/browser/ui/webui/settings/import_data_handler.cc
index d4b2e0b0..cecce41 100644
--- a/chrome/browser/ui/webui/settings/import_data_handler.cc
+++ b/chrome/browser/ui/webui/settings/import_data_handler.cc
@@ -46,11 +46,13 @@
ImportDataHandler::~ImportDataHandler() {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
- if (importer_host_)
+ if (importer_host_) {
importer_host_->set_observer(nullptr);
+ }
- if (select_file_dialog_.get())
+ if (select_file_dialog_.get()) {
select_file_dialog_->ListenerDestroyed();
+ }
}
void ImportDataHandler::RegisterMessages() {
@@ -88,12 +90,14 @@
uint16_t imported_items) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
- if (!imported_items)
+ if (!imported_items) {
return;
+ }
// If another import is already ongoing, let it finish silently.
- if (importer_host_)
+ if (importer_host_) {
importer_host_->set_observer(nullptr);
+ }
FireWebUIListener("import-data-status-changed",
base::Value(kImportStatusInProgress));
@@ -175,8 +179,9 @@
const base::Value::List& args) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
- if (select_file_dialog_)
+ if (select_file_dialog_) {
return;
+ }
DCHECK(args.empty());
select_file_dialog_ = ui::SelectFileDialog::Create(
diff --git a/chrome/browser/ui/webui/settings/metrics_reporting_handler.cc b/chrome/browser/ui/webui/settings/metrics_reporting_handler.cc
index 6a927f1c..1e786cc 100644
--- a/chrome/browser/ui/webui/settings/metrics_reporting_handler.cc
+++ b/chrome/browser/ui/webui/settings/metrics_reporting_handler.cc
@@ -7,14 +7,13 @@
#if BUILDFLAG(GOOGLE_CHROME_BRANDING) && !BUILDFLAG(IS_CHROMEOS_ASH)
-#include "chrome/browser/ui/webui/settings/metrics_reporting_handler.h"
-
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/values.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/metrics/chrome_metrics_service_accessor.h"
#include "chrome/browser/metrics/metrics_reporting_state.h"
+#include "chrome/browser/ui/webui/settings/metrics_reporting_handler.h"
#include "components/metrics/metrics_pref_names.h"
#include "components/prefs/pref_service.h"
#include "content/public/browser/web_ui.h"
diff --git a/chrome/browser/ui/webui/settings/metrics_reporting_handler_unittest.cc b/chrome/browser/ui/webui/settings/metrics_reporting_handler_unittest.cc
index eadb8d4..09ba82f 100644
--- a/chrome/browser/ui/webui/settings/metrics_reporting_handler_unittest.cc
+++ b/chrome/browser/ui/webui/settings/metrics_reporting_handler_unittest.cc
@@ -7,10 +7,9 @@
#if BUILDFLAG(GOOGLE_CHROME_BRANDING) && !BUILDFLAG(IS_CHROMEOS_ASH)
-#include "chrome/browser/ui/webui/settings/metrics_reporting_handler.h"
-
#include "base/run_loop.h"
#include "base/values.h"
+#include "chrome/browser/ui/webui/settings/metrics_reporting_handler.h"
#include "chrome/test/base/scoped_testing_local_state.h"
#include "chrome/test/base/testing_browser_process.h"
#include "components/metrics/metrics_pref_names.h"
@@ -24,8 +23,8 @@
class TestingMetricsReportingHandler : public MetricsReportingHandler {
public:
- using MetricsReportingHandler::set_web_ui;
using MetricsReportingHandler::HandleGetMetricsReporting;
+ using MetricsReportingHandler::set_web_ui;
};
class MetricsReportingHandlerTest : public testing::Test {
diff --git a/chrome/browser/ui/webui/settings/performance_handler.h b/chrome/browser/ui/webui/settings/performance_handler.h
index 94456cb..619550c 100644
--- a/chrome/browser/ui/webui/settings/performance_handler.h
+++ b/chrome/browser/ui/webui/settings/performance_handler.h
@@ -39,7 +39,8 @@
void OnDeviceHasBatteryChanged(bool device_has_battery) override;
/**
- * Returns a list of currently opened tabs' urls in order of most recently used.
+ * Returns a list of currently opened tabs' urls in order of most recently
+ * used.
*/
base::Value GetCurrentOpenSites();
void HandleGetCurrentOpenSites(const base::Value::List& args);
diff --git a/chrome/browser/ui/webui/settings/performance_handler_unittest.cc b/chrome/browser/ui/webui/settings/performance_handler_unittest.cc
index 36e2100..1d9acf3 100644
--- a/chrome/browser/ui/webui/settings/performance_handler_unittest.cc
+++ b/chrome/browser/ui/webui/settings/performance_handler_unittest.cc
@@ -24,7 +24,8 @@
PerformanceHandlerTest() = default;
void SetUp() override {
- web_contents_ = content::WebContentsTester::CreateTestWebContents(profile(), nullptr);
+ web_contents_ =
+ content::WebContentsTester::CreateTestWebContents(profile(), nullptr);
web_ui_ = std::make_unique<content::TestWebUI>();
web_ui_->set_web_contents(web_contents_.get());
handler_ = std::make_unique<PerformanceHandler>();
diff --git a/chrome/browser/ui/webui/settings/privacy_sandbox_handler.cc b/chrome/browser/ui/webui/settings/privacy_sandbox_handler.cc
index 53008b97..5873391 100644
--- a/chrome/browser/ui/webui/settings/privacy_sandbox_handler.cc
+++ b/chrome/browser/ui/webui/settings/privacy_sandbox_handler.cc
@@ -125,12 +125,14 @@
const base::Value::List& args) {
AllowJavascript();
base::Value::List top_topics_list;
- for (const auto& topic : GetPrivacySandboxService()->GetCurrentTopTopics())
+ for (const auto& topic : GetPrivacySandboxService()->GetCurrentTopTopics()) {
top_topics_list.Append(ConvertTopicToValue(topic));
+ }
base::Value::List blocked_topics_list;
- for (const auto& topic : GetPrivacySandboxService()->GetBlockedTopics())
+ for (const auto& topic : GetPrivacySandboxService()->GetBlockedTopics()) {
blocked_topics_list.Append(ConvertTopicToValue(topic));
+ }
base::Value::Dict topics_state;
topics_state.Set(kTopTopics, std::move(top_topics_list));
@@ -152,14 +154,16 @@
// Combine |joining_sites| with the blocked FLEDGE sites information. The
// latter is available synchronously.
base::Value::List joining_sites_list;
- for (const auto& site : joining_sites)
+ for (const auto& site : joining_sites) {
joining_sites_list.Append(site);
+ }
const auto blocked_sites =
GetPrivacySandboxService()->GetBlockedFledgeJoiningTopFramesForDisplay();
base::Value::List blocked_sites_list;
- for (const auto& site : blocked_sites)
+ for (const auto& site : blocked_sites) {
blocked_sites_list.Append(site);
+ }
base::Value::Dict fledge_state;
fledge_state.Set(kJoiningSites, std::move(joining_sites_list));
diff --git a/chrome/browser/ui/webui/settings/privacy_sandbox_handler_unittest.cc b/chrome/browser/ui/webui/settings/privacy_sandbox_handler_unittest.cc
index e02edb525..bc557b1 100644
--- a/chrome/browser/ui/webui/settings/privacy_sandbox_handler_unittest.cc
+++ b/chrome/browser/ui/webui/settings/privacy_sandbox_handler_unittest.cc
@@ -289,9 +289,7 @@
: public PrivacySandboxMessageHandlerTest,
public testing::WithParamInterface<std::pair<bool, bool>> {
public:
- void SetUp() override {
- PrivacySandboxMessageHandlerTest::SetUp();
- }
+ void SetUp() override { PrivacySandboxMessageHandlerTest::SetUp(); }
private:
base::test::ScopedFeatureList feature_list_;
diff --git a/chrome/browser/ui/webui/settings/protocol_handlers_handler.cc b/chrome/browser/ui/webui/settings/protocol_handlers_handler.cc
index 3c1abbe..06e8a80 100644
--- a/chrome/browser/ui/webui/settings/protocol_handlers_handler.cc
+++ b/chrome/browser/ui/webui/settings/protocol_handlers_handler.cc
@@ -46,8 +46,9 @@
handler_value.Set("protocol", handler.protocol());
handler_value.Set("spec", handler.url().spec());
handler_value.Set("host", handler.url().host());
- if (registry)
+ if (registry) {
handler_value.Set("is_default", registry->IsDefault(handler));
+ }
if (handler.web_app_id().has_value()) {
const auto& web_app_id = handler.web_app_id().value();
@@ -226,10 +227,11 @@
bool enabled = true;
CHECK(args[0].is_bool());
enabled = args[0].GetBool();
- if (enabled)
+ if (enabled) {
GetProtocolHandlerRegistry()->Enable();
- else
+ } else {
GetProtocolHandlerRegistry()->Disable();
+ }
}
void ProtocolHandlersHandler::HandleSetDefault(const base::Value::List& args) {
@@ -241,8 +243,9 @@
custom_handlers::ProtocolHandler ProtocolHandlersHandler::ParseHandlerFromArgs(
const base::Value::List& args) const {
bool ok = args.size() >= 2u && args[0].is_string() && args[1].is_string();
- if (!ok)
+ if (!ok) {
return custom_handlers::ProtocolHandler::EmptyProtocolHandler();
+ }
std::string protocol = args[0].GetString();
std::string url = args[1].GetString();
return custom_handlers::ProtocolHandler::CreateProtocolHandler(protocol,
@@ -273,8 +276,9 @@
}
void ProtocolHandlersHandler::UpdateAllAllowedLaunchProtocols() {
- if (!web_app_provider_)
+ if (!web_app_provider_) {
return;
+ }
base::flat_set<std::string> protocols(
web_app_provider_->registrar_unsafe().GetAllAllowedLaunchProtocols());
@@ -294,8 +298,9 @@
}
void ProtocolHandlersHandler::UpdateAllDisallowedLaunchProtocols() {
- if (!web_app_provider_)
+ if (!web_app_provider_) {
return;
+ }
base::flat_set<std::string> protocols(
web_app_provider_->registrar_unsafe().GetAllDisallowedLaunchProtocols());
@@ -342,8 +347,9 @@
const std::string* protocol = args[0].GetIfString();
const std::string* url = args[1].GetIfString();
const std::string* app_id = args[2].GetIfString();
- if (!protocol || !url || !app_id)
+ if (!protocol || !url || !app_id) {
return custom_handlers::ProtocolHandler::EmptyProtocolHandler();
+ }
return custom_handlers::ProtocolHandler::CreateWebAppProtocolHandler(
*protocol, GURL(*url), *app_id);
}
diff --git a/chrome/browser/ui/webui/settings/recent_site_settings_helper.cc b/chrome/browser/ui/webui/settings/recent_site_settings_helper.cc
index f8fb48a..7001012 100644
--- a/chrome/browser/ui/webui/settings/recent_site_settings_helper.cc
+++ b/chrome/browser/ui/webui/settings/recent_site_settings_helper.cc
@@ -41,8 +41,9 @@
base::Time GetMostRecentTimestamp(const RecentSitePermissions& x) {
auto most_recent = base::Time();
for (const auto& setting : x.settings) {
- if (setting.timestamp > most_recent)
+ if (setting.timestamp > most_recent) {
most_recent = setting.timestamp;
+ }
}
return most_recent;
}
diff --git a/chrome/browser/ui/webui/settings/reset_settings_handler.cc b/chrome/browser/ui/webui/settings/reset_settings_handler.cc
index 84e4579..e6b52229 100644
--- a/chrome/browser/ui/webui/settings/reset_settings_handler.cc
+++ b/chrome/browser/ui/webui/settings/reset_settings_handler.cc
@@ -52,8 +52,9 @@
static const char kOriginUserClick[] = "userclick";
static const char kOriginTriggeredReset[] = "triggeredreset";
- if (request_origin == kOriginUserClick)
+ if (request_origin == kOriginUserClick) {
return reset_report::ChromeResetReport::RESET_REQUEST_ORIGIN_USER_CLICK;
+ }
if (request_origin == kOriginTriggeredReset) {
return reset_report::ChromeResetReport::
RESET_REQUEST_ORIGIN_TRIGGERED_RESET;
@@ -83,8 +84,9 @@
const base::Time reset_time = chrome_prefs::GetResetTime(profile);
// If there is no reset time, do not show the banner.
- if (reset_time.is_null())
+ if (reset_time.is_null()) {
return false;
+ }
// Otherwise, only show the banner if it has been less than |kBannerShowTime|
// since reset.
@@ -199,8 +201,9 @@
void ResetSettingsHandler::OnHideResetProfileDialog(
const base::Value::List& args) {
- if (!GetResetter()->IsActive())
+ if (!GetResetter()->IsActive()) {
setting_snapshot_.reset();
+ }
}
void ResetSettingsHandler::OnHideResetProfileBanner(
@@ -222,8 +225,9 @@
}
ProfileResetter* ResetSettingsHandler::GetResetter() {
- if (!resetter_)
+ if (!resetter_) {
resetter_ = std::make_unique<ProfileResetter>(profile_);
+ }
return resetter_.get();
}
diff --git a/chrome/browser/ui/webui/settings/reset_settings_handler_unittest.cc b/chrome/browser/ui/webui/settings/reset_settings_handler_unittest.cc
index 6e85556..ca000f9d 100644
--- a/chrome/browser/ui/webui/settings/reset_settings_handler_unittest.cc
+++ b/chrome/browser/ui/webui/settings/reset_settings_handler_unittest.cc
@@ -22,10 +22,8 @@
class TestingResetSettingsHandler : public ResetSettingsHandler {
public:
- TestingResetSettingsHandler(
- TestingProfile* profile, content::WebUI* web_ui)
- : ResetSettingsHandler(profile),
- resetter_(profile) {
+ TestingResetSettingsHandler(TestingProfile* profile, content::WebUI* web_ui)
+ : ResetSettingsHandler(profile), resetter_(profile) {
set_web_ui(web_ui);
}
@@ -73,8 +71,7 @@
// Check that the delegate ProfileResetter was called.
EXPECT_EQ(1u, handler()->Resets());
// Check that Javascript side is notified after resetting is done.
- EXPECT_EQ("cr.webUIResponse",
- web_ui()->call_data()[0]->function_name());
+ EXPECT_EQ("cr.webUIResponse", web_ui()->call_data()[0]->function_name());
const std::string* callback_id =
web_ui()->call_data()[0]->arg1()->GetIfString();
EXPECT_NE(nullptr, callback_id);
diff --git a/chrome/browser/ui/webui/settings/search_engines_handler.cc b/chrome/browser/ui/webui/settings/search_engines_handler.cc
index 0f90f92..e9eb7cf 100644
--- a/chrome/browser/ui/webui/settings/search_engines_handler.cc
+++ b/chrome/browser/ui/webui/settings/search_engines_handler.cc
@@ -229,8 +229,9 @@
dict.Set("urlLocked", ((template_url->prepopulate_id() > 0) ||
(template_url->starter_pack_id() > 0)));
GURL icon_url = template_url->favicon_url();
- if (icon_url.is_valid())
+ if (icon_url.is_valid()) {
dict.Set("iconURL", icon_url.spec());
+ }
// The icons that are used for search engines in the EEA region are bundled
// with Chrome. We use the favicon service for countries outside the EEA
@@ -402,10 +403,11 @@
const std::u16string& keyword,
const std::string& url) {
DCHECK(!url.empty());
- if (template_url)
+ if (template_url) {
list_controller_.ModifyTemplateURL(template_url, title, keyword, url);
- else
+ } else {
list_controller_.AddTemplateURL(title, keyword, url);
+ }
edit_controller_.reset();
}
@@ -423,8 +425,9 @@
bool SearchEnginesHandler::CheckFieldValidity(const std::string& field_name,
const std::string& field_value) {
- if (!edit_controller_.get())
+ if (!edit_controller_.get()) {
return false;
+ }
bool is_valid = false;
if (field_name.compare(kSearchEngineField) == 0) {
@@ -442,16 +445,18 @@
void SearchEnginesHandler::HandleSearchEngineEditCancelled(
const base::Value::List& args) {
- if (!edit_controller_.get())
+ if (!edit_controller_.get()) {
return;
+ }
edit_controller_->CleanUpCancelledAdd();
edit_controller_.reset();
}
void SearchEnginesHandler::HandleSearchEngineEditCompleted(
const base::Value::List& args) {
- if (!edit_controller_.get())
+ if (!edit_controller_.get()) {
return;
+ }
CHECK_EQ(3U, args.size());
const std::string& search_engine = args[0].GetString();
diff --git a/chrome/browser/ui/webui/settings/settings_clear_browsing_data_handler.cc b/chrome/browser/ui/webui/settings/settings_clear_browsing_data_handler.cc
index f42554d..4c24c98 100644
--- a/chrome/browser/ui/webui/settings/settings_clear_browsing_data_handler.cc
+++ b/chrome/browser/ui/webui/settings/settings_clear_browsing_data_handler.cc
@@ -78,7 +78,7 @@
browsing_data::prefs::kDeleteCacheBasic,
};
-} // namespace
+} // namespace
namespace settings {
@@ -113,8 +113,9 @@
}
void ClearBrowsingDataHandler::OnJavascriptAllowed() {
- if (sync_service_)
+ if (sync_service_) {
sync_service_observation_.Observe(sync_service_.get());
+ }
dse_service_observation_.Observe(
TemplateURLServiceFactory::GetForProfile(profile_));
@@ -178,12 +179,14 @@
switch (*data_type) {
case BrowsingDataType::HISTORY:
- if (prefs->GetBoolean(prefs::kAllowDeletingBrowserHistory))
+ if (prefs->GetBoolean(prefs::kAllowDeletingBrowserHistory)) {
remove_mask |= chrome_browsing_data_remover::DATA_TYPE_HISTORY;
+ }
break;
case BrowsingDataType::DOWNLOADS:
- if (prefs->GetBoolean(prefs::kAllowDeletingBrowserHistory))
+ if (prefs->GetBoolean(prefs::kAllowDeletingBrowserHistory)) {
remove_mask |= content::BrowsingDataRemover::DATA_TYPE_DOWNLOADS;
+ }
break;
case BrowsingDataType::CACHE:
remove_mask |= content::BrowsingDataRemover::DATA_TYPE_CACHE;
diff --git a/chrome/browser/ui/webui/settings/settings_clear_browsing_data_handler_unittest.cc b/chrome/browser/ui/webui/settings/settings_clear_browsing_data_handler_unittest.cc
index 9b2746b..64c45e6 100644
--- a/chrome/browser/ui/webui/settings/settings_clear_browsing_data_handler_unittest.cc
+++ b/chrome/browser/ui/webui/settings/settings_clear_browsing_data_handler_unittest.cc
@@ -184,8 +184,9 @@
continue;
}
const std::string* event = data.arg1()->GetIfString();
- if (!event || *event != "update-sync-state")
+ if (!event || *event != "update-sync-state") {
continue;
+ }
const base::Value::Dict* arg2_dict = data.arg2()->GetIfDict();
if (!arg2_dict) {
continue;
@@ -217,8 +218,9 @@
data.prepopulate_id = prepopulate_id;
TemplateURL* url =
template_url_service->Add(std::make_unique<TemplateURL>(data));
- if (set_default)
+ if (set_default) {
template_url_service->SetUserSelectedDefaultSearchProvider(url);
+ }
return url;
}
diff --git a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
index 26873b0..0d930158 100644
--- a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
+++ b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
@@ -253,7 +253,7 @@
user_manager::UserManager::Get()->IsLoggedInAsGuest() ||
user_manager::UserManager::Get()->IsLoggedInAsManagedGuestSession());
#else
- profile->IsGuestSession());
+ profile->IsGuestSession());
#endif
html_source->AddBoolean("isChildAccount", profile->IsChild());
diff --git a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.h b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.h
index d6eb555..c0b4f03 100644
--- a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.h
+++ b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.h
@@ -10,7 +10,7 @@
namespace content {
class WebUIDataSource;
class WebContents;
-}
+} // namespace content
namespace settings {
diff --git a/chrome/browser/ui/webui/settings/settings_manage_profile_handler.cc b/chrome/browser/ui/webui/settings/settings_manage_profile_handler.cc
index 4dea1e04f..7766dc8 100644
--- a/chrome/browser/ui/webui/settings/settings_manage_profile_handler.cc
+++ b/chrome/browser/ui/webui/settings/settings_manage_profile_handler.cc
@@ -100,8 +100,9 @@
void ManageProfileHandler::OnProfileHighResAvatarLoaded(
const base::FilePath& profile_path) {
- if (profile_path != profile_->GetPath())
+ if (profile_path != profile_->GetPath()) {
return;
+ }
// GAIA image is loaded asynchronously.
FireWebUIListener(
@@ -111,8 +112,9 @@
void ManageProfileHandler::OnProfileAvatarChanged(
const base::FilePath& profile_path) {
- if (profile_path != profile_->GetPath())
+ if (profile_path != profile_->GetPath()) {
return;
+ }
// This is necessary to send the potentially updated GAIA photo.
FireWebUIListener(
@@ -206,8 +208,8 @@
weak_factory_.GetWeakPtr(), callback_id));
}
-void ManageProfileHandler::OnHasProfileShortcuts(
- const std::string& callback_id, bool has_shortcuts) {
+void ManageProfileHandler::OnHasProfileShortcuts(const std::string& callback_id,
+ bool has_shortcuts) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
ResolveJavascriptCallback(
base::Value(callback_id),
@@ -229,7 +231,7 @@
const base::Value::List& args) {
DCHECK(ProfileShortcutManager::IsFeatureEnabled());
ProfileShortcutManager* shortcut_manager =
- g_browser_process->profile_manager()->profile_shortcut_manager();
+ g_browser_process->profile_manager()->profile_shortcut_manager();
DCHECK(shortcut_manager);
shortcut_manager->RemoveProfileShortcuts(profile_->GetPath());
diff --git a/chrome/browser/ui/webui/settings/settings_manage_profile_handler_unittest.cc b/chrome/browser/ui/webui/settings/settings_manage_profile_handler_unittest.cc
index da13558..cce4a8e 100644
--- a/chrome/browser/ui/webui/settings/settings_manage_profile_handler_unittest.cc
+++ b/chrome/browser/ui/webui/settings/settings_manage_profile_handler_unittest.cc
@@ -30,8 +30,8 @@
explicit TestManageProfileHandler(Profile* profile)
: ManageProfileHandler(profile) {}
- using ManageProfileHandler::set_web_ui;
using ManageProfileHandler::AllowJavascript;
+ using ManageProfileHandler::set_web_ui;
};
} // namespace
diff --git a/chrome/browser/ui/webui/settings/settings_media_devices_selection_handler.cc b/chrome/browser/ui/webui/settings/settings_media_devices_selection_handler.cc
index ad95f68..7c41fea 100644
--- a/chrome/browser/ui/webui/settings/settings_media_devices_selection_handler.cc
+++ b/chrome/browser/ui/webui/settings/settings_media_devices_selection_handler.cc
@@ -235,8 +235,9 @@
}
#endif
- if (facing_info.empty())
+ if (facing_info.empty()) {
return device.descriptor.display_name();
+ }
return device.descriptor.display_name() + " " + facing_info;
}
diff --git a/chrome/browser/ui/webui/settings/settings_media_devices_selection_handler_unittest.cc b/chrome/browser/ui/webui/settings/settings_media_devices_selection_handler_unittest.cc
index c361a2a..45321ec6 100644
--- a/chrome/browser/ui/webui/settings/settings_media_devices_selection_handler_unittest.cc
+++ b/chrome/browser/ui/webui/settings/settings_media_devices_selection_handler_unittest.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "chrome/browser/ui/webui/settings/settings_media_devices_selection_handler.h"
+
#include "base/test/test_future.h"
#include "chrome/test/base/testing_profile.h"
#include "components/media_effects/test/fake_audio_service.h"
diff --git a/chrome/browser/ui/webui/settings/settings_secure_dns_handler_browsertest.cc b/chrome/browser/ui/webui/settings/settings_secure_dns_handler_browsertest.cc
index 21826e0..dac26d0 100644
--- a/chrome/browser/ui/webui/settings/settings_secure_dns_handler_browsertest.cc
+++ b/chrome/browser/ui/webui/settings/settings_secure_dns_handler_browsertest.cc
@@ -180,25 +180,29 @@
}
const base::Value::Dict* dict = data->arg2()->GetIfDict();
- if (!dict)
+ if (!dict) {
return false;
+ }
// Get the secure DNS mode.
const std::string* secure_dns_mode = dict->FindString("mode");
- if (!secure_dns_mode)
+ if (!secure_dns_mode) {
return false;
+ }
*out_secure_dns_mode = *secure_dns_mode;
// Get the DoH config string.
const std::string* doh_config = dict->FindString("config");
- if (!doh_config)
+ if (!doh_config) {
return false;
+ }
*out_doh_config = *doh_config;
// Get the forced management description.
std::optional<int> management_mode = dict->FindInt("managementMode");
- if (!management_mode.has_value())
+ if (!management_mode.has_value()) {
return false;
+ }
*out_management_mode = *management_mode;
return true;
@@ -221,18 +225,21 @@
continue;
}
const base::Value::Dict* dict = data->arg2()->GetIfDict();
- if (!dict)
+ if (!dict) {
return false;
+ }
std::optional<bool> doh_with_identifiers_active =
dict->FindBool("dohWithIdentifiersActive");
- if (!doh_with_identifiers_active)
+ if (!doh_with_identifiers_active) {
return false;
+ }
*out_doh_with_identifiers_active = *doh_with_identifiers_active;
const std::string* doh_config_for_display =
dict->FindString("configForDisplay");
- if (!doh_config_for_display)
+ if (!doh_config_for_display) {
return false;
+ }
*out_doh_config_for_display = *doh_config_for_display;
return true;
diff --git a/chrome/browser/ui/webui/settings/settings_startup_pages_handler.cc b/chrome/browser/ui/webui/settings/settings_startup_pages_handler.cc
index b90434b..e099baef 100644
--- a/chrome/browser/ui/webui/settings/settings_startup_pages_handler.cc
+++ b/chrome/browser/ui/webui/settings/settings_startup_pages_handler.cc
@@ -20,14 +20,14 @@
namespace settings {
StartupPagesHandler::StartupPagesHandler(content::WebUI* webui)
- : startup_custom_pages_table_model_(Profile::FromWebUI(webui)) {
-}
+ : startup_custom_pages_table_model_(Profile::FromWebUI(webui)) {}
StartupPagesHandler::~StartupPagesHandler() = default;
void StartupPagesHandler::RegisterMessages() {
- if (Profile::FromWebUI(web_ui())->IsOffTheRecord())
+ if (Profile::FromWebUI(web_ui())->IsOffTheRecord()) {
return;
+ }
web_ui()->RegisterMessageCallback(
"addStartupPage",
@@ -59,8 +59,9 @@
SessionStartupPref pref = SessionStartupPref::GetStartupPref(prefService);
startup_custom_pages_table_model_.SetURLs(pref.urls);
- if (pref.urls.empty())
+ if (pref.urls.empty()) {
pref.type = SessionStartupPref::DEFAULT;
+ }
pref_change_registrar_.Init(prefService);
pref_change_registrar_.Add(
@@ -189,8 +190,9 @@
SessionStartupPref pref = SessionStartupPref::GetStartupPref(prefs);
pref.urls = startup_custom_pages_table_model_.GetURLs();
- if (pref.urls.empty())
+ if (pref.urls.empty()) {
pref.type = SessionStartupPref::DEFAULT;
+ }
SessionStartupPref::SetStartupPref(prefs, pref);
}
diff --git a/chrome/browser/ui/webui/settings/settings_ui_browsertest.cc b/chrome/browser/ui/webui/settings/settings_ui_browsertest.cc
index 24b7710..48f5f16 100644
--- a/chrome/browser/ui/webui/settings/settings_ui_browsertest.cc
+++ b/chrome/browser/ui/webui/settings/settings_ui_browsertest.cc
@@ -2,13 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "chrome/browser/ui/webui/settings/settings_ui.h"
+
#include <string>
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/hats/hats_service_factory.h"
#include "chrome/browser/ui/hats/mock_hats_service.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
-#include "chrome/browser/ui/webui/settings/settings_ui.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
diff --git a/chrome/browser/ui/webui/settings/settings_utils.cc b/chrome/browser/ui/webui/settings/settings_utils.cc
index 5b1e436..1a1c22a 100644
--- a/chrome/browser/ui/webui/settings/settings_utils.cc
+++ b/chrome/browser/ui/webui/settings/settings_utils.cc
@@ -17,8 +17,9 @@
GURL* fixed_url) {
GURL url = url_formatter::FixupURL(url_string, std::string());
bool valid = url.is_valid() && !extensions::ExtensionTabUtil::IsKillURL(url);
- if (valid && fixed_url)
+ if (valid && fixed_url) {
fixed_url->Swap(&url);
+ }
return valid;
}
diff --git a/chrome/browser/ui/webui/settings/settings_utils_linux.cc b/chrome/browser/ui/webui/settings/settings_utils_linux.cc
index 3561ae86..a416e01 100644
--- a/chrome/browser/ui/webui/settings/settings_utils_linux.cc
+++ b/chrome/browser/ui/webui/settings/settings_utils_linux.cc
@@ -46,8 +46,8 @@
const char* const kKDE6ProxyConfigCommand[] = {"kcmshell6", "kcm_proxy"};
// In Deepin OS, we might need to run dde-control-center instead.
-const char* const kDeepinProxyConfigCommand[] = {"dde-control-center",
- "-m", "network"};
+const char* const kDeepinProxyConfigCommand[] = {"dde-control-center", "-m",
+ "network"};
// The URL for Linux proxy configuration help when not running under a
// supported desktop environment.
@@ -57,12 +57,14 @@
void ShowLinuxProxyConfigUrl(base::WeakPtr<content::WebContents> web_contents,
bool launched) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
- if (launched)
+ if (launched) {
return;
+ }
std::unique_ptr<base::Environment> env(base::Environment::Create());
const char* name = base::nix::GetDesktopEnvironmentName(env.get());
- if (name)
+ if (name) {
LOG(ERROR) << "Could not find " << name << " network settings in $PATH";
+ }
OpenURLParams params(GURL(kLinuxProxyConfigUrl), Referrer(),
WindowOpenDisposition::NEW_FOREGROUND_TAB,
ui::PAGE_TRANSITION_LINK, false);
@@ -82,8 +84,9 @@
// success, so we search $PATH first to predict whether the exec is
// expected to succeed.
std::unique_ptr<base::Environment> env(base::Environment::Create());
- if (!base::ExecutableExistsInPath(env.get(), command[0]))
+ if (!base::ExecutableExistsInPath(env.get(), command[0])) {
return false;
+ }
std::vector<std::string> argv;
for (const char* arg : command) {
diff --git a/chrome/browser/ui/webui/settings/settings_utils_mac.mm b/chrome/browser/ui/webui/settings/settings_utils_mac.mm
index 96204b8e..b1748d4 100644
--- a/chrome/browser/ui/webui/settings/settings_utils_mac.mm
+++ b/chrome/browser/ui/webui/settings/settings_utils_mac.mm
@@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#import <Cocoa/Cocoa.h>
-
#include "chrome/browser/ui/webui/settings/settings_utils.h"
+#import <Cocoa/Cocoa.h>
+
#include "base/apple/foundation_util.h"
#include "base/apple/osstatus_logging.h"
#include "base/functional/callback_helpers.h"
diff --git a/chrome/browser/ui/webui/settings/shared_settings_localized_strings_provider.cc b/chrome/browser/ui/webui/settings/shared_settings_localized_strings_provider.cc
index cbd1b990..2a94500 100644
--- a/chrome/browser/ui/webui/settings/shared_settings_localized_strings_provider.cc
+++ b/chrome/browser/ui/webui/settings/shared_settings_localized_strings_provider.cc
@@ -177,39 +177,41 @@
void AddSharedSyncPageStrings(content::WebUIDataSource* html_source) {
static constexpr webui::LocalizedString kLocalizedStrings[] = {
- {"syncDisabledByAdministrator", IDS_SIGNED_IN_WITH_SYNC_DISABLED_BY_POLICY},
- {"passphrasePlaceholder", IDS_SETTINGS_PASSPHRASE_PLACEHOLDER},
- {"existingPassphraseTitle", IDS_SETTINGS_EXISTING_PASSPHRASE_TITLE},
- {"submitPassphraseButton", IDS_SETTINGS_SUBMIT_PASSPHRASE},
- {"encryptWithGoogleCredentialsLabel",
- IDS_SETTINGS_ENCRYPT_WITH_GOOGLE_CREDENTIALS_LABEL},
- {"encryptionOptionsTitle", IDS_SETTINGS_ENCRYPTION_OPTIONS},
- {"mismatchedPassphraseError", IDS_SETTINGS_MISMATCHED_PASSPHRASE_ERROR},
- {"emptyPassphraseError", IDS_SETTINGS_EMPTY_PASSPHRASE_ERROR},
- {"incorrectPassphraseError", IDS_SETTINGS_INCORRECT_PASSPHRASE_ERROR},
- {"syncPageTitle", IDS_SETTINGS_SYNC_SYNC_AND_NON_PERSONALIZED_SERVICES},
- {"passphraseConfirmationPlaceholder",
- IDS_SETTINGS_PASSPHRASE_CONFIRMATION_PLACEHOLDER},
- {"syncLoading", IDS_SETTINGS_SYNC_LOADING},
- {"syncDataEncryptedText", IDS_SETTINGS_SYNC_DATA_ENCRYPTED_TEXT},
- {"sync", IDS_SETTINGS_SYNC},
- {"manageSyncedDataTitle",
- IDS_SETTINGS_NEW_MANAGE_SYNCED_DATA_TITLE_UNIFIED_CONSENT},
+ {"syncDisabledByAdministrator",
+ IDS_SIGNED_IN_WITH_SYNC_DISABLED_BY_POLICY},
+ {"passphrasePlaceholder", IDS_SETTINGS_PASSPHRASE_PLACEHOLDER},
+ {"existingPassphraseTitle", IDS_SETTINGS_EXISTING_PASSPHRASE_TITLE},
+ {"submitPassphraseButton", IDS_SETTINGS_SUBMIT_PASSPHRASE},
+ {"encryptWithGoogleCredentialsLabel",
+ IDS_SETTINGS_ENCRYPT_WITH_GOOGLE_CREDENTIALS_LABEL},
+ {"encryptionOptionsTitle", IDS_SETTINGS_ENCRYPTION_OPTIONS},
+ {"mismatchedPassphraseError", IDS_SETTINGS_MISMATCHED_PASSPHRASE_ERROR},
+ {"emptyPassphraseError", IDS_SETTINGS_EMPTY_PASSPHRASE_ERROR},
+ {"incorrectPassphraseError", IDS_SETTINGS_INCORRECT_PASSPHRASE_ERROR},
+ {"syncPageTitle", IDS_SETTINGS_SYNC_SYNC_AND_NON_PERSONALIZED_SERVICES},
+ {"passphraseConfirmationPlaceholder",
+ IDS_SETTINGS_PASSPHRASE_CONFIRMATION_PLACEHOLDER},
+ {"syncLoading", IDS_SETTINGS_SYNC_LOADING},
+ {"syncDataEncryptedText", IDS_SETTINGS_SYNC_DATA_ENCRYPTED_TEXT},
+ {"sync", IDS_SETTINGS_SYNC},
+ {"manageSyncedDataTitle",
+ IDS_SETTINGS_NEW_MANAGE_SYNCED_DATA_TITLE_UNIFIED_CONSENT},
#if BUILDFLAG(IS_CHROMEOS_ASH)
- {"manageSyncedDataSubtitle",
- IDS_SETTINGS_NEW_MANAGE_SYNCED_DATA_SUBTITLE_UNIFIED_CONSENT},
+ {"manageSyncedDataSubtitle",
+ IDS_SETTINGS_NEW_MANAGE_SYNCED_DATA_SUBTITLE_UNIFIED_CONSENT},
#endif
- {"manageBrowserSyncedDataTitle",
- IDS_SETTINGS_NEW_MANAGE_BROWSER_SYNCED_DATA_TITLE},
- {"syncAdvancedDevicePageTitle",
- IDS_SETTINGS_NEW_SYNC_ADVANCED_DEVICE_PAGE_TITLE},
- {"syncAdvancedBrowserPageTitle",
- IDS_SETTINGS_NEW_SYNC_ADVANCED_BROWSER_PAGE_TITLE},
- {"enterPassphraseLabel", IDS_SYNC_ENTER_PASSPHRASE_BODY},
- {"enterPassphraseLabelWithDate", IDS_SYNC_ENTER_PASSPHRASE_BODY_WITH_DATE},
- {"existingPassphraseLabelWithDate",
- IDS_SYNC_FULL_ENCRYPTION_BODY_CUSTOM_WITH_DATE},
- {"existingPassphraseLabel", IDS_SYNC_FULL_ENCRYPTION_BODY_CUSTOM},
+ {"manageBrowserSyncedDataTitle",
+ IDS_SETTINGS_NEW_MANAGE_BROWSER_SYNCED_DATA_TITLE},
+ {"syncAdvancedDevicePageTitle",
+ IDS_SETTINGS_NEW_SYNC_ADVANCED_DEVICE_PAGE_TITLE},
+ {"syncAdvancedBrowserPageTitle",
+ IDS_SETTINGS_NEW_SYNC_ADVANCED_BROWSER_PAGE_TITLE},
+ {"enterPassphraseLabel", IDS_SYNC_ENTER_PASSPHRASE_BODY},
+ {"enterPassphraseLabelWithDate",
+ IDS_SYNC_ENTER_PASSPHRASE_BODY_WITH_DATE},
+ {"existingPassphraseLabelWithDate",
+ IDS_SYNC_FULL_ENCRYPTION_BODY_CUSTOM_WITH_DATE},
+ {"existingPassphraseLabel", IDS_SYNC_FULL_ENCRYPTION_BODY_CUSTOM},
};
html_source->AddLocalizedStrings(kLocalizedStrings);
diff --git a/chrome/browser/ui/webui/settings/site_settings_handler.cc b/chrome/browser/ui/webui/settings/site_settings_handler.cc
index 914b910..8609c20 100644
--- a/chrome/browser/ui/webui/settings/site_settings_handler.cc
+++ b/chrome/browser/ui/webui/settings/site_settings_handler.cc
@@ -237,16 +237,18 @@
GURL launch_url =
extensions::AppLaunchInfo::GetLaunchWebURL(extension->get());
// Skip adding the launch URL if it is part of the web extent.
- if (web_extent.MatchesURL(launch_url))
+ if (web_extent.MatchesURL(launch_url)) {
continue;
+ }
site_settings::AddExceptionForHostedApp(launch_url.spec(),
*extension->get(), exceptions);
}
}
base::flat_set<url::Origin> GetInstalledAppOrigins(Profile* profile) {
- if (!apps::AppServiceProxyFactory::IsAppServiceAvailableForProfile(profile))
+ if (!apps::AppServiceProxyFactory::IsAppServiceAvailableForProfile(profile)) {
return base::flat_set<url::Origin>();
+ }
std::vector<url::Origin> origins;
apps::AppServiceProxyFactory::GetForProfile(profile)
@@ -536,8 +538,9 @@
origin_object.Set(kNumCookies, 0);
bool is_installed = installed_origins.contains(origin);
- if (is_installed)
+ if (is_installed) {
has_installed_pwa = true;
+ }
origin_object.Set(kIsInstalled, is_installed);
origin_object.Set(kHasPermissionSettings,
@@ -822,8 +825,9 @@
auto* primary_otr_profile =
profile_->GetPrimaryOTRProfile(/*create_if_needed=*/true);
// Avoid duplicate observation.
- if (primary_otr_profile != profile_)
+ if (primary_otr_profile != profile_) {
ObserveSourcesForProfile(primary_otr_profile);
+ }
}
// Listen for zoom changes in the default StoragePartition and the primary
@@ -930,8 +934,9 @@
const ContentSettingsPattern& primary_pattern,
const ContentSettingsPattern& secondary_pattern,
ContentSettingsType content_type) {
- if (!site_settings::HasRegisteredGroupName(content_type))
+ if (!site_settings::HasRegisteredGroupName(content_type)) {
return;
+ }
if (primary_pattern.MatchesAllHosts() &&
secondary_pattern.MatchesAllHosts()) {
@@ -967,8 +972,9 @@
}
void SiteSettingsHandler::OnProfileWillBeDestroyed(Profile* profile) {
- if (profile->IsOffTheRecord())
+ if (profile->IsOffTheRecord()) {
FireWebUIListener("onIncognitoStatusChanged", base::Value(false));
+ }
StopObservingSourcesForProfile(profile);
}
@@ -1030,8 +1036,9 @@
const base::Value::List& args) {
CHECK_EQ(1U, args.size());
auto origin = url::Origin::Create(GURL(args[0].GetString()));
- if (origin.opaque())
+ if (origin.opaque()) {
return;
+ }
AllowJavascript();
// TODO(crbug.com/40240175) - Permission info loading before storage info
@@ -1103,8 +1110,9 @@
#if BUILDFLAG(IS_CHROMEOS_ASH)
// ChromeOS special case: in Guest mode, settings are opened in Incognito
// mode so we need the original profile to actually modify settings.
- if (user_manager::UserManager::Get()->IsLoggedInAsGuest())
+ if (user_manager::UserManager::Get()->IsLoggedInAsGuest()) {
profile = profile->GetOriginalProfile();
+ }
#endif
HostContentSettingsMap* map =
HostContentSettingsMapFactory::GetForProfile(profile);
@@ -1474,8 +1482,9 @@
std::string type;
DCHECK(type_val.is_string());
const std::string* maybe_type = type_val.GetIfString();
- if (maybe_type)
+ if (maybe_type) {
type = *maybe_type;
+ }
ContentSettingsType content_type =
site_settings::ContentSettingsTypeFromGroupName(type);
CHECK(content_type != ContentSettingsType::DEFAULT)
@@ -1643,8 +1652,9 @@
std::string value = args[2].GetString();
const GURL origin(origin_string);
- if (!origin.is_valid())
+ if (!origin.is_valid()) {
return;
+ }
ContentSetting setting;
CHECK(content_settings::ContentSettingFromString(value, &setting));
@@ -1807,8 +1817,9 @@
Profile* profile = nullptr;
if (incognito) {
- if (!profile_->HasPrimaryOTRProfile())
+ if (!profile_->HasPrimaryOTRProfile()) {
return;
+ }
profile = profile_->GetPrimaryOTRProfile(/*create_if_needed=*/true);
} else {
profile = profile_;
@@ -1896,8 +1907,9 @@
Profile* target_profile = nullptr;
if (incognito) {
- if (!profile_->HasPrimaryOTRProfile())
+ if (!profile_->HasPrimaryOTRProfile()) {
return;
+ }
target_profile = profile_->GetPrimaryOTRProfile(/*create_if_needed=*/true);
} else {
target_profile = profile_;
@@ -2042,8 +2054,9 @@
}
void SiteSettingsHandler::SendZoomLevels() {
- if (!IsJavascriptAllowed())
+ if (!IsJavascriptAllowed()) {
return;
+ }
base::Value::List zoom_levels_exceptions;
@@ -2173,8 +2186,9 @@
}
void SiteSettingsHandler::SendBlockAutoplayStatus() {
- if (!IsJavascriptAllowed())
+ if (!IsJavascriptAllowed()) {
return;
+ }
base::Value::Dict status;
@@ -2197,8 +2211,9 @@
const base::Value::List& args) {
AllowJavascript();
- if (!UnifiedAutoplayConfig::IsBlockAutoplayUserModifiable(profile_))
+ if (!UnifiedAutoplayConfig::IsBlockAutoplayUserModifiable(profile_)) {
return;
+ }
CHECK_EQ(1U, args.size());
CHECK(args[0].is_bool());
@@ -2230,13 +2245,16 @@
}
void SiteSettingsHandler::ServicePendingRequests() {
- if (!IsJavascriptAllowed())
+ if (!IsJavascriptAllowed()) {
return;
+ }
- if (send_sites_list_)
+ if (send_sites_list_) {
OnStorageFetched();
- if (update_site_details_)
+ }
+ if (update_site_details_) {
OnGetUsageInfo();
+ }
send_sites_list_ = false;
update_site_details_ = false;
@@ -2244,27 +2262,32 @@
void SiteSettingsHandler::ObserveSourcesForProfile(Profile* profile) {
auto* map = HostContentSettingsMapFactory::GetForProfile(profile);
- if (!observations_.IsObservingSource(map))
+ if (!observations_.IsObservingSource(map)) {
observations_.AddObservation(map);
+ }
auto* usb_context = UsbChooserContextFactory::GetForProfile(profile);
- if (!chooser_observations_.IsObservingSource(usb_context))
+ if (!chooser_observations_.IsObservingSource(usb_context)) {
chooser_observations_.AddObservation(usb_context);
+ }
auto* serial_context = SerialChooserContextFactory::GetForProfile(profile);
- if (!chooser_observations_.IsObservingSource(serial_context))
+ if (!chooser_observations_.IsObservingSource(serial_context)) {
chooser_observations_.AddObservation(serial_context);
+ }
auto* hid_context = HidChooserContextFactory::GetForProfile(profile);
- if (!chooser_observations_.IsObservingSource(hid_context))
+ if (!chooser_observations_.IsObservingSource(hid_context)) {
chooser_observations_.AddObservation(hid_context);
+ }
if (base::FeatureList::IsEnabled(
features::kWebBluetoothNewPermissionsBackend)) {
auto* bluetooth_context =
BluetoothChooserContextFactory::GetForProfile(profile);
- if (!chooser_observations_.IsObservingSource(bluetooth_context))
+ if (!chooser_observations_.IsObservingSource(bluetooth_context)) {
chooser_observations_.AddObservation(bluetooth_context);
+ }
}
if (base::FeatureList::IsEnabled(
@@ -2292,27 +2315,32 @@
void SiteSettingsHandler::StopObservingSourcesForProfile(Profile* profile) {
auto* map = HostContentSettingsMapFactory::GetForProfile(profile);
- if (observations_.IsObservingSource(map))
+ if (observations_.IsObservingSource(map)) {
observations_.RemoveObservation(map);
+ }
auto* usb_context = UsbChooserContextFactory::GetForProfile(profile);
- if (chooser_observations_.IsObservingSource(usb_context))
+ if (chooser_observations_.IsObservingSource(usb_context)) {
chooser_observations_.RemoveObservation(usb_context);
+ }
auto* serial_context = SerialChooserContextFactory::GetForProfile(profile);
- if (chooser_observations_.IsObservingSource(serial_context))
+ if (chooser_observations_.IsObservingSource(serial_context)) {
chooser_observations_.RemoveObservation(serial_context);
+ }
auto* hid_context = HidChooserContextFactory::GetForProfile(profile);
- if (chooser_observations_.IsObservingSource(hid_context))
+ if (chooser_observations_.IsObservingSource(hid_context)) {
chooser_observations_.RemoveObservation(hid_context);
+ }
if (base::FeatureList::IsEnabled(
features::kWebBluetoothNewPermissionsBackend)) {
auto* bluetooth_context =
BluetoothChooserContextFactory::GetForProfile(profile);
- if (chooser_observations_.IsObservingSource(bluetooth_context))
+ if (chooser_observations_.IsObservingSource(bluetooth_context)) {
chooser_observations_.RemoveObservation(bluetooth_context);
+ }
}
if (base::FeatureList::IsEnabled(
@@ -2333,8 +2361,9 @@
AllSitesMap* all_sites_map,
std::map<url::Origin, int64_t>* origin_size_map) {
for (const auto& entry : *browsing_data_model_) {
- if (entry.data_details->storage_size == 0)
+ if (entry.data_details->storage_size == 0) {
continue;
+ }
url::Origin origin =
BrowsingDataModel::GetOriginForDataKey(entry.data_key.get());
@@ -2542,8 +2571,9 @@
auto filter_builder = content::BrowsingDataFilterBuilder::Create(
content::BrowsingDataFilterBuilder::Mode::kDelete);
- for (const auto& origin : origins)
+ for (const auto& origin : origins) {
filter_builder->AddOrigin(origin);
+ }
CdmDocumentServiceImpl::ClearCdmData(
profile_, base::Time::Min(), base::Time::Max(),
diff --git a/chrome/browser/ui/webui/settings/site_settings_handler_unittest.cc b/chrome/browser/ui/webui/settings/site_settings_handler_unittest.cc
index dd818bd..28d45ef0 100644
--- a/chrome/browser/ui/webui/settings/site_settings_handler_unittest.cc
+++ b/chrome/browser/ui/webui/settings/site_settings_handler_unittest.cc
@@ -392,8 +392,9 @@
void TearDown() override {
if (profile_) {
auto* partition = profile_->GetDefaultStoragePartition();
- if (partition)
+ if (partition) {
partition->WaitForDeletionTasksForTesting();
+ }
}
}
@@ -1803,9 +1804,10 @@
// permissions are correctly transformed for usage by JS.
const GURL url1("https://example.com");
const GURL url2("http://example.com");
- for (int i = 0; i < 3; ++i)
+ for (int i = 0; i < 3; ++i) {
auto_blocker->RecordDismissAndEmbargo(
url1, ContentSettingsType::NOTIFICATIONS, false);
+ }
clock.Advance(base::Hours(2));
clock.Advance(base::Hours(1));
@@ -1818,9 +1820,10 @@
permissions::PermissionDecisionAutoBlocker* incognito_auto_blocker =
PermissionDecisionAutoBlockerFactory::GetForProfile(incognito_profile());
incognito_auto_blocker->SetClockForTesting(&clock);
- for (int i = 0; i < 3; ++i)
+ for (int i = 0; i < 3; ++i) {
incognito_auto_blocker->RecordDismissAndEmbargo(
url1, ContentSettingsType::NOTIFICATIONS, false);
+ }
handler()->HandleGetRecentSitePermissions(get_recent_permissions_args);
{
@@ -2407,7 +2410,7 @@
RemovesTrackingProtectionExceptionsWhenFeatureIsOff) {
constexpr char kOrigin[] = "https://www.test.com:443";
base::Value::List set_args;
- set_args.Append("*"); // Primary pattern.
+ set_args.Append("*"); // Primary pattern.
set_args.Append(kOrigin); // Secondary pattern.
set_args.Append(kTrackingProtection);
set_args.Append(
@@ -3190,8 +3193,9 @@
GURL* tab_url) {
content::WebContents* web_contents =
browser->tab_strip_model()->GetWebContentsAt(tab_index);
- if (tab_url)
+ if (tab_url) {
*tab_url = web_contents->GetLastCommittedURL();
+ }
return infobars::ContentInfoBarManager::FromWebContents(web_contents);
}
@@ -3470,8 +3474,9 @@
});
WebUIAllowlist* allowlist = WebUIAllowlist::GetOrCreate(profile());
- for (const url::Origin& origin : kWebUIOrigins)
+ for (const url::Origin& origin : kWebUIOrigins) {
allowlist->RegisterAutoGrantedPermission(origin, content_settings_type);
+ }
// Verify the auto-granted permissions are registered, and they are indeed
// provided by WebUIAllowlist.
@@ -3559,8 +3564,9 @@
};
WebUIAllowlist* allowlist = WebUIAllowlist::GetOrCreate(profile());
- for (const url::Origin& origin : kWebUIOrigins)
+ for (const url::Origin& origin : kWebUIOrigins) {
allowlist->RegisterAutoGrantedPermission(origin, content_settings_type);
+ }
for (const url::Origin& origin : kWebUIOrigins) {
base::Value::List get_origin_permissions_args;
@@ -4518,16 +4524,19 @@
bool ChooserExceptionContainsSiteException(const base::Value::Dict& exception,
std::string_view origin) {
const base::Value::List* sites = exception.FindList(site_settings::kSites);
- if (!sites)
+ if (!sites) {
return false;
+ }
for (const auto& site : *sites) {
const std::string* exception_origin =
site.GetDict().FindString(site_settings::kOrigin);
- if (!exception_origin)
+ if (!exception_origin) {
continue;
- if (*exception_origin == origin)
+ }
+ if (*exception_origin == origin) {
return true;
+ }
}
return false;
}
@@ -4542,8 +4551,9 @@
for (const auto& exception : exceptions) {
const std::string* exception_display_name =
exception.GetDict().FindString(site_settings::kDisplayName);
- if (!exception_display_name)
+ if (!exception_display_name) {
continue;
+ }
if (*exception_display_name == display_name) {
return ChooserExceptionContainsSiteException(exception.GetDict(),
diff --git a/chrome/browser/ui/webui/settings/system_handler.cc b/chrome/browser/ui/webui/settings/system_handler.cc
index ebef62c..672e7c6 100644
--- a/chrome/browser/ui/webui/settings/system_handler.cc
+++ b/chrome/browser/ui/webui/settings/system_handler.cc
@@ -23,7 +23,8 @@
// static
void SystemHandler::AddLoadTimeData(content::WebUIDataSource* data_source) {
- data_source->AddBoolean("hardwareAccelerationEnabledAtStartup",
+ data_source->AddBoolean(
+ "hardwareAccelerationEnabledAtStartup",
g_browser_process->gpu_mode_manager()->initial_gpu_mode_pref());
}
diff --git a/chrome/browser/ui/webui/side_panel/bookmarks/bookmarks_page_handler.cc b/chrome/browser/ui/webui/side_panel/bookmarks/bookmarks_page_handler.cc
index 3b6933ae..b1532e56 100644
--- a/chrome/browser/ui/webui/side_panel/bookmarks/bookmarks_page_handler.cc
+++ b/chrome/browser/ui/webui/side_panel/bookmarks/bookmarks_page_handler.cc
@@ -191,8 +191,9 @@
void BookmarksPageHandler::BookmarkCurrentTabInFolder(int64_t folder_id) {
Browser* browser = chrome::FindLastActive();
- if (!browser)
+ if (!browser) {
return;
+ }
chrome::BookmarkCurrentTabInFolder(browser, folder_id);
}
@@ -264,23 +265,26 @@
ui::mojom::ClickModifiersPtr click_modifiers,
side_panel::mojom::ActionSource source) {
Browser* browser = chrome::FindLastActive();
- if (!browser)
+ if (!browser) {
return;
+ }
bookmarks::BookmarkModel* bookmark_model =
BookmarkModelFactory::GetForBrowserContext(browser->profile());
const bookmarks::BookmarkNode* bookmark_node =
bookmarks::GetBookmarkNodeByID(bookmark_model, node_id);
- if (!bookmark_node)
+ if (!bookmark_node) {
return;
+ }
WindowOpenDisposition open_location = ui::DispositionFromClick(
click_modifiers->middle_button, click_modifiers->alt_key,
click_modifiers->ctrl_key, click_modifiers->meta_key,
click_modifiers->shift_key);
chrome::OpenAllIfAllowed(browser, {bookmark_node}, open_location, false);
- if (source == side_panel::mojom::ActionSource::kPriceTracking)
+ if (source == side_panel::mojom::ActionSource::kPriceTracking) {
return;
+ }
base::RecordAction(base::UserMetricsAction("SidePanel.Bookmarks.Navigation"));
RecordBookmarkLaunch(
parent_folder_depth > 0 ? BookmarkLaunchLocation::kSidePanelSubfolder
@@ -320,8 +324,9 @@
const gfx::Point& point,
side_panel::mojom::ActionSource source) {
int64_t id;
- if (!base::StringToInt64(id_string, &id))
+ if (!base::StringToInt64(id_string, &id)) {
return;
+ }
auto embedder =
bookmarks_ui_ ? bookmarks_ui_->embedder() : reading_list_ui_->embedder();
diff --git a/chrome/browser/ui/webui/side_panel/bookmarks/bookmarks_page_handler_unittest.cc b/chrome/browser/ui/webui/side_panel/bookmarks/bookmarks_page_handler_unittest.cc
index 5eb8184..de8f94c 100644
--- a/chrome/browser/ui/webui/side_panel/bookmarks/bookmarks_page_handler_unittest.cc
+++ b/chrome/browser/ui/webui/side_panel/bookmarks/bookmarks_page_handler_unittest.cc
@@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include <memory>
-
#include "chrome/browser/ui/webui/side_panel/bookmarks/bookmarks_page_handler.h"
+#include <memory>
+
#include "chrome/browser/ui/webui/bookmarks/bookmark_prefs.h"
#include "chrome/test/base/browser_with_test_window_test.h"
#include "components/bookmarks/common/bookmark_pref_names.h"
diff --git a/chrome/browser/ui/webui/side_panel/bookmarks/bookmarks_side_panel_ui.h b/chrome/browser/ui/webui/side_panel/bookmarks/bookmarks_side_panel_ui.h
index 642dc98..bc4efb4 100644
--- a/chrome/browser/ui/webui/side_panel/bookmarks/bookmarks_side_panel_ui.h
+++ b/chrome/browser/ui/webui/side_panel/bookmarks/bookmarks_side_panel_ui.h
@@ -27,7 +27,7 @@
class ShoppingListContextMenuController;
class ShoppingServiceHandler;
class PriceTrackingHandler;
-}
+} // namespace commerce
namespace ui {
class ColorChangeHandler;
diff --git a/chrome/browser/ui/webui/side_panel/customize_chrome/customize_chrome_page_handler_unittest.cc b/chrome/browser/ui/webui/side_panel/customize_chrome/customize_chrome_page_handler_unittest.cc
index 9c77f4e..d43d02b4 100644
--- a/chrome/browser/ui/webui/side_panel/customize_chrome/customize_chrome_page_handler_unittest.cc
+++ b/chrome/browser/ui/webui/side_panel/customize_chrome/customize_chrome_page_handler_unittest.cc
@@ -336,7 +336,7 @@
base::MockRepeatingCallback<void(const GURL& gurl)> mock_open_url_callback_;
std::unique_ptr<CustomizeChromePageHandler> handler_;
raw_ptr<NtpCustomBackgroundServiceObserver>
- ntp_custom_background_service_observer_;
+ ntp_custom_background_service_observer_;
raw_ptr<NtpBackgroundServiceObserver> ntp_background_service_observer_;
};
diff --git a/chrome/browser/ui/webui/side_panel/reading_list/reading_list_page_handler.cc b/chrome/browser/ui/webui/side_panel/reading_list/reading_list_page_handler.cc
index 546dd13a..75af271 100644
--- a/chrome/browser/ui/webui/side_panel/reading_list/reading_list_page_handler.cc
+++ b/chrome/browser/ui/webui/side_panel/reading_list/reading_list_page_handler.cc
@@ -178,8 +178,9 @@
bool mark_as_read,
ui::mojom::ClickModifiersPtr click_modifiers) {
Browser* browser = chrome::FindLastActive();
- if (!browser)
+ if (!browser) {
return;
+ }
// Open in active tab if the user is on the NTP.
WindowOpenDisposition open_location = ui::DispositionFromClick(
@@ -215,8 +216,9 @@
void ReadingListPageHandler::MarkCurrentTabAsRead() {
Browser* browser = chrome::FindLastActive();
- if (!browser)
+ if (!browser) {
return;
+ }
chrome::MarkCurrentTabAsReadInReadLater(browser);
base::RecordAction(base::UserMetricsAction("DesktopReadingList.MarkAsRead"));
@@ -224,8 +226,9 @@
void ReadingListPageHandler::AddCurrentTab() {
Browser* browser = chrome::FindLastActive();
- if (!browser)
+ if (!browser) {
return;
+ }
chrome::MoveCurrentTabToReadLater(browser);
reading_list_model_->MarkAllSeen();
@@ -244,10 +247,11 @@
int32_t y) {
auto embedder = reading_list_ui_->embedder();
Browser* browser = chrome::FindLastActive();
- if (embedder)
+ if (embedder) {
embedder->ShowContextMenu(gfx::Point(x, y),
std::make_unique<ReadLaterItemContextMenu>(
browser, reading_list_model_, url));
+ }
}
void ReadingListPageHandler::UpdateCurrentPageActionButtonState() {
@@ -263,15 +267,17 @@
void ReadingListPageHandler::CloseUI() {
auto embedder = reading_list_ui_->embedder();
- if (embedder)
+ if (embedder) {
embedder->CloseUI();
+ }
}
void ReadingListPageHandler::ReadingListModelCompletedBatchUpdates(
const ReadingListModel* model) {
DCHECK(model == reading_list_model_);
- if (web_contents_->GetVisibility() == content::Visibility::HIDDEN)
+ if (web_contents_->GetVisibility() == content::Visibility::HIDDEN) {
return;
+ }
page_->ItemsChanged(CreateReadLaterEntriesByStatusData());
UpdateCurrentPageActionButton();
reading_list_model_->MarkAllSeen();
@@ -299,8 +305,9 @@
}
const std::optional<GURL> ReadingListPageHandler::GetActiveTabURL() {
- if (active_tab_url_)
+ if (active_tab_url_) {
return active_tab_url_.value();
+ }
Browser* browser = chrome::FindLastActive();
if (browser) {
return chrome::GetURLToBookmark(
@@ -310,8 +317,9 @@
}
void ReadingListPageHandler::SetActiveTabURL(const GURL& url) {
- if (active_tab_url_ && active_tab_url_.value() == url)
+ if (active_tab_url_ && active_tab_url_.value() == url) {
return;
+ }
active_tab_url_ = url;
UpdateCurrentPageActionButton();
@@ -364,8 +372,9 @@
std::string ReadingListPageHandler::GetTimeSinceLastUpdate(
int64_t last_update_time) {
const int64_t now = TimeToUS(clock_->Now());
- if (last_update_time > now)
+ if (last_update_time > now) {
return std::string();
+ }
const base::TimeDelta elapsed_time =
base::Microseconds(now - last_update_time);
return base::UTF16ToUTF8(
@@ -375,12 +384,14 @@
void ReadingListPageHandler::UpdateCurrentPageActionButton() {
if (web_contents_->GetVisibility() == content::Visibility::HIDDEN ||
- Profile::FromWebUI(web_ui_)->IsGuestSession())
+ Profile::FromWebUI(web_ui_)->IsGuestSession()) {
return;
+ }
const std::optional<GURL> url = GetActiveTabURL();
- if (!url.has_value())
+ if (!url.has_value()) {
return;
+ }
reading_list::mojom::CurrentPageActionButtonState new_state;
if (!reading_list_model_->IsUrlSupported(url.value())) {
diff --git a/chrome/browser/ui/webui/side_panel/reading_list/reading_list_ui.cc b/chrome/browser/ui/webui/side_panel/reading_list/reading_list_ui.cc
index 1c69f372..d026cd0 100644
--- a/chrome/browser/ui/webui/side_panel/reading_list/reading_list_ui.cc
+++ b/chrome/browser/ui/webui/side_panel/reading_list/reading_list_ui.cc
@@ -58,8 +58,9 @@
{"unreadHeader", IDS_READ_LATER_MENU_UNREAD_HEADER},
{"cancelA11yLabel", IDS_CANCEL},
};
- for (const auto& str : kLocalizedStrings)
+ for (const auto& str : kLocalizedStrings) {
webui::AddLocalizedString(source, str.name, str.id);
+ }
source->AddBoolean("useRipples", views::PlatformStyle::kUseRipples);
@@ -105,8 +106,9 @@
void ReadingListUI::BindInterface(
mojo::PendingReceiver<help_bubble::mojom::HelpBubbleHandlerFactory>
pending_receiver) {
- if (help_bubble_handler_factory_receiver_.is_bound())
+ if (help_bubble_handler_factory_receiver_.is_bound()) {
help_bubble_handler_factory_receiver_.reset();
+ }
help_bubble_handler_factory_receiver_.Bind(std::move(pending_receiver));
}
@@ -122,6 +124,7 @@
}
void ReadingListUI::SetActiveTabURL(const GURL& url) {
- if (page_handler_)
+ if (page_handler_) {
page_handler_->SetActiveTabURL(url);
+ }
}
diff --git a/chrome/browser/ui/webui/signin/ash/inline_login_dialog.cc b/chrome/browser/ui/webui/signin/ash/inline_login_dialog.cc
index 5c2b2cb..5616c43 100644
--- a/chrome/browser/ui/webui/signin/ash/inline_login_dialog.cc
+++ b/chrome/browser/ui/webui/signin/ash/inline_login_dialog.cc
@@ -112,8 +112,9 @@
void WebContentsDestroyed() override { ResetDelegate(); }
void ResetDelegate() {
- if (!web_contents())
+ if (!web_contents()) {
return;
+ }
web_modal::WebContentsModalDialogManager::FromWebContents(web_contents())
->SetDelegate(nullptr);
}
@@ -176,8 +177,9 @@
}
InlineLoginDialog::~InlineLoginDialog() {
- for (auto& observer : modal_dialog_host_observer_list_)
+ for (auto& observer : modal_dialog_host_observer_list_) {
observer.OnHostDestroying();
+ }
if (!close_dialog_closure_.is_null()) {
std::move(close_dialog_closure_).Run();
@@ -229,8 +231,9 @@
// The args value will be available from JS via
// chrome.getVariableValue('dialogArguments').
std::string InlineLoginDialog::GetDialogArgs() const {
- if (!add_account_options_)
+ if (!add_account_options_) {
return std::string();
+ }
std::string json;
base::JSONWriter::Write(
@@ -262,8 +265,9 @@
// get displayed on the lock screen. In this case it is safe to ignore it,
// since in this case user will get it again after a request to Google
// properties.
- if (session_manager::SessionManager::Get()->IsUserSessionBlocked())
+ if (session_manager::SessionManager::Get()->IsUserSessionBlocked()) {
return;
+ }
if (dialog) {
dialog->dialog_window()->Focus();
diff --git a/chrome/browser/ui/webui/signin/ash/inline_login_handler_impl.cc b/chrome/browser/ui/webui/signin/ash/inline_login_handler_impl.cc
index d1013a1c..46455af 100644
--- a/chrome/browser/ui/webui/signin/ash/inline_login_handler_impl.cc
+++ b/chrome/browser/ui/webui/signin/ash/inline_login_handler_impl.cc
@@ -472,15 +472,17 @@
auto* identity_manager =
IdentityManagerFactory::GetForProfile(Profile::FromWebUI(web_ui()));
for (const auto& account : accounts) {
- if (account.key.account_type() != account_manager::AccountType::kGaia)
+ if (account.key.account_type() != account_manager::AccountType::kGaia) {
continue;
+ }
if (!arc_accounts.contains(account)) {
AccountInfo maybe_account_info =
identity_manager->FindExtendedAccountInfoByGaiaId(
GaiaId(account.key.id()));
- if (maybe_account_info.IsEmpty())
+ if (maybe_account_info.IsEmpty()) {
continue;
+ }
result.Append(GaiaAccountToValue(account, maybe_account_info));
}
diff --git a/chrome/browser/ui/webui/signin/ash/signin_helper.cc b/chrome/browser/ui/webui/signin/ash/signin_helper.cc
index 223996b..70b0cc5 100644
--- a/chrome/browser/ui/webui/signin/ash/signin_helper.cc
+++ b/chrome/browser/ui/webui/signin/ash/signin_helper.cc
@@ -47,8 +47,9 @@
void SigninHelper::ArcHelper::OnAccountAdded(
const account_manager::Account& account) {
// Don't change ARC availability after reauthentication.
- if (!is_account_addition_)
+ if (!is_account_addition_) {
return;
+ }
account_apps_availability_->SetIsAccountAvailableInArc(account,
is_available_in_arc_);
diff --git a/chrome/browser/ui/webui/signin/ash/user_cloud_signin_restriction_policy_fetcher.cc b/chrome/browser/ui/webui/signin/ash/user_cloud_signin_restriction_policy_fetcher.cc
index 7adb8df..7ac1aa95 100644
--- a/chrome/browser/ui/webui/signin/ash/user_cloud_signin_restriction_policy_fetcher.cc
+++ b/chrome/browser/ui/webui/signin/ash/user_cloud_signin_restriction_policy_fetcher.cc
@@ -272,8 +272,9 @@
GoogleServiceAuthError error = GoogleServiceAuthError::AuthErrorNone();
std::optional<int> response_code;
- if (url_loader->ResponseInfo() && url_loader->ResponseInfo()->headers)
+ if (url_loader->ResponseInfo() && url_loader->ResponseInfo()->headers) {
response_code = url_loader->ResponseInfo()->headers->response_code();
+ }
// Check for network or HTTP errors.
if (url_loader->NetError() != net::OK || !response_body) {
diff --git a/chrome/browser/ui/webui/signin/batch_upload_handler.cc b/chrome/browser/ui/webui/signin/batch_upload_handler.cc
index a238b09d..79b8aee 100644
--- a/chrome/browser/ui/webui/signin/batch_upload_handler.cc
+++ b/chrome/browser/ui/webui/signin/batch_upload_handler.cc
@@ -96,8 +96,7 @@
return favicon_url;
}
- if (absl::holds_alternative<syncer::LocalDataItemModel::FolderIcon>(
- icon)) {
+ if (absl::holds_alternative<syncer::LocalDataItemModel::FolderIcon>(icon)) {
return GURL(kFolderIconUrl);
}
diff --git a/chrome/browser/ui/webui/signin/dice_web_signin_intercept_handler.cc b/chrome/browser/ui/webui/signin/dice_web_signin_intercept_handler.cc
index 9dea7290..fdb59f7 100644
--- a/chrome/browser/ui/webui/signin/dice_web_signin_intercept_handler.cc
+++ b/chrome/browser/ui/webui/signin/dice_web_signin_intercept_handler.cc
@@ -144,8 +144,9 @@
void DiceWebSigninInterceptHandler::OnExtendedAccountInfoUpdated(
const AccountInfo& info) {
- if (!info.IsValid())
+ if (!info.IsValid()) {
return;
+ }
bool should_fire_event = false;
if (info.account_id == intercepted_account().account_id) {
@@ -200,10 +201,12 @@
// If there is no extended info for the primary account, populate with
// reasonable defaults.
- if (primary_account().hosted_domain.empty())
+ if (primary_account().hosted_domain.empty()) {
bubble_parameters_.primary_account.hosted_domain = kNoHostedDomainFound;
- if (primary_account().given_name.empty())
+ }
+ if (primary_account().given_name.empty()) {
bubble_parameters_.primary_account.given_name = primary_account().email;
+ }
DCHECK(!args.empty());
const base::Value& callback_id = args[0];
@@ -505,8 +508,9 @@
std::string manager_domain = intercepted_account().IsManaged()
? intercepted_account().hosted_domain
: std::string();
- if (manager_domain.empty())
+ if (manager_domain.empty()) {
manager_domain = chrome::GetDeviceManagerIdentity().value_or(std::string());
+ }
if (manager_domain.empty()) {
return l10n_util::GetStringFUTF8(
diff --git a/chrome/browser/ui/webui/signin/inline_login_handler.cc b/chrome/browser/ui/webui/signin/inline_login_handler.cc
index cfa827b..bcdc314 100644
--- a/chrome/browser/ui/webui/signin/inline_login_handler.cc
+++ b/chrome/browser/ui/webui/signin/inline_login_handler.cc
@@ -95,9 +95,8 @@
// present and its value is zero, this means we don't want to keep the
// the data.
std::string value;
- if (!net::GetValueForKeyInQuery(current_url,
- signin::kSignInPromoQueryKeyForceKeepData,
- &value) ||
+ if (!net::GetValueForKeyInQuery(
+ current_url, signin::kSignInPromoQueryKeyForceKeepData, &value) ||
value == "0") {
partition->ClearData(
content::StoragePartition::REMOVE_DATA_MASK_ALL,
@@ -143,11 +142,13 @@
default_email = profile->GetPrefs()->GetString(
prefs::kGoogleServicesLastSyncingUsername);
} else {
- if (!net::GetValueForKeyInQuery(current_url, "email", &default_email))
+ if (!net::GetValueForKeyInQuery(current_url, "email", &default_email)) {
default_email.clear();
+ }
}
- if (!default_email.empty())
+ if (!default_email.empty()) {
params.Set("email", default_email);
+ }
// The legacy full-tab Chrome sign-in page is no longer used as it was relying
// on exchanging cookies for refresh tokens and that endpoint is no longer
@@ -193,8 +194,9 @@
params.gaia_id = GaiaId(CHECK_DEREF(dict.FindString("gaiaId")));
for (const auto& cookie_with_access_result : cookies) {
- if (cookie_with_access_result.cookie.Name() == "oauth_code")
+ if (cookie_with_access_result.cookie.Name() == "oauth_code") {
params.auth_code = cookie_with_access_result.cookie.Value();
+ }
}
params.skip_for_now = dict.FindBool("skipForNow").value_or(false);
@@ -245,6 +247,7 @@
}
void InlineLoginHandler::CloseDialogFromJavascript() {
- if (IsJavascriptAllowed())
+ if (IsJavascriptAllowed()) {
FireWebUIListener("close-dialog");
+ }
}
diff --git a/chrome/browser/ui/webui/signin/inline_login_handler_impl.cc b/chrome/browser/ui/webui/signin/inline_login_handler_impl.cc
index 8498976c..27b187e 100644
--- a/chrome/browser/ui/webui/signin/inline_login_handler_impl.cc
+++ b/chrome/browser/ui/webui/signin/inline_login_handler_impl.cc
@@ -167,8 +167,9 @@
return credential_provider::kUiecEMailMissmatch;
}
- if (email_domains_parameter.empty())
+ if (email_domains_parameter.empty()) {
return credential_provider::kUiecSuccess;
+ }
std::vector<std::string> all_email_domains =
GetEmailDomainsFromParameter(email_domains_parameter);
@@ -182,21 +183,25 @@
#endif
void SetProfileLocked(const base::FilePath profile_path, bool locked) {
- if (profile_path.empty())
+ if (profile_path.empty()) {
return;
+ }
ProfileManager* profile_manager = g_browser_process->profile_manager();
- if (!profile_manager)
+ if (!profile_manager) {
return;
+ }
ProfileAttributesEntry* entry =
profile_manager->GetProfileAttributesStorage()
.GetProfileAttributesWithPath(profile_path);
- if (!entry)
+ if (!entry) {
return;
+ }
- if (signin_util::IsForceSigninEnabled())
+ if (signin_util::IsForceSigninEnabled()) {
entry->LockForceSigninProfile(locked);
+ }
}
void UnlockProfileAndHideLoginUI(const base::FilePath profile_path,
@@ -498,8 +503,9 @@
// make sure the webui is aware.
content::WebContents* contents = web_ui()->GetWebContents();
const GURL& current_url = contents->GetLastCommittedURL();
- if (HasFromProfilePickerURLParameter(current_url))
+ if (HasFromProfilePickerURLParameter(current_url)) {
params.Set("dontResizeNonEmbeddedPages", true);
+ }
HandlerSigninReason reason = GetHandlerSigninReason(current_url);
@@ -515,15 +521,17 @@
&email_domains)) {
std::vector<std::string> all_email_domains =
GetEmailDomainsFromParameter(email_domains);
- if (all_email_domains.size() == 1)
+ if (all_email_domains.size() == 1) {
params.Set("emailDomain", all_email_domains[0]);
+ }
}
std::string show_tos;
if (net::GetValueForKeyInQuery(
current_url, credential_provider::kShowTosSwitch, &show_tos)) {
- if (!show_tos.empty())
+ if (!show_tos.empty()) {
params.Set("showTos", show_tos);
+ }
}
// Prevent opening a new window if the embedded page fails to load.
@@ -588,8 +596,9 @@
}
// This value exists only for webview sign in.
- if (params.trusted_found)
+ if (params.trusted_found) {
confirm_untrusted_signin_ = !params.trusted_value;
+ }
DCHECK(!params.email.empty());
DCHECK(!params.gaia_id.empty());
@@ -716,8 +725,9 @@
AboutSigninInternals* about_signin_internals =
AboutSigninInternalsFactory::GetForProfile(profile);
- if (about_signin_internals)
+ if (about_signin_internals) {
about_signin_internals->OnAuthenticationResultReceived("Successful");
+ }
std::string signin_scoped_device_id =
GetSigninScopedDeviceIdForProfile(profile);
@@ -770,14 +780,16 @@
void InlineLoginHandlerImpl::SendLSTFetchResultsMessage(
const base::Value& arg) {
- if (IsJavascriptAllowed())
+ if (IsJavascriptAllowed()) {
FireWebUIListener("send-lst-fetch-results", arg);
+ }
}
Browser* InlineLoginHandlerImpl::GetDesktopBrowser() {
Browser* browser = chrome::FindBrowserWithTab(web_ui()->GetWebContents());
- if (!browser)
+ if (!browser) {
browser = chrome::FindLastActiveWithProfile(Profile::FromWebUI(web_ui()));
+ }
return browser;
}
diff --git a/chrome/browser/ui/webui/signin/inline_login_handler_impl.h b/chrome/browser/ui/webui/signin/inline_login_handler_impl.h
index 16588bd5..2c76413d 100644
--- a/chrome/browser/ui/webui/signin/inline_login_handler_impl.h
+++ b/chrome/browser/ui/webui/signin/inline_login_handler_impl.h
@@ -42,8 +42,8 @@
~InlineLoginHandlerImpl() override;
- using InlineLoginHandler::web_ui;
using InlineLoginHandler::CloseDialogFromJavascript;
+ using InlineLoginHandler::web_ui;
base::WeakPtr<InlineLoginHandlerImpl> GetWeakPtr() {
return weak_factory_.GetWeakPtr();
@@ -151,8 +151,7 @@
private:
// Overridden from GaiaAuthConsumer.
void OnClientOAuthSuccess(const ClientOAuthResult& result) override;
- void OnClientOAuthFailure(const GoogleServiceAuthError& error)
- override;
+ void OnClientOAuthFailure(const GoogleServiceAuthError& error) override;
void OnClientOAuthSuccessAndBrowserOpened(const ClientOAuthResult& result);
diff --git a/chrome/browser/ui/webui/signin/inline_login_ui.cc b/chrome/browser/ui/webui/signin/inline_login_ui.cc
index c339c70..169120ad 100644
--- a/chrome/browser/ui/webui/signin/inline_login_ui.cc
+++ b/chrome/browser/ui/webui/signin/inline_login_ui.cc
@@ -147,63 +147,63 @@
#if BUILDFLAG(IS_CHROMEOS_ASH)
static constexpr webui::ResourcePath kResources[] = {
- {"account_manager_shared.css.js", IDR_ACCOUNT_MANAGER_SHARED_CSS_JS},
- {"error_screen.html.js",
- IDR_ACCOUNT_MANAGER_COMPONENTS_ERROR_SCREEN_HTML_JS},
- {"error_screen.js", IDR_ACCOUNT_MANAGER_COMPONENTS_ERROR_SCREEN_JS},
- // Resources for the server-based edu coexistence flow.
- {"edu-coexistence", IDR_EDU_COEXISTENCE_EDU_COEXISTENCE_HTML},
+ {"account_manager_shared.css.js", IDR_ACCOUNT_MANAGER_SHARED_CSS_JS},
+ {"error_screen.html.js",
+ IDR_ACCOUNT_MANAGER_COMPONENTS_ERROR_SCREEN_HTML_JS},
+ {"error_screen.js", IDR_ACCOUNT_MANAGER_COMPONENTS_ERROR_SCREEN_JS},
+ // Resources for the server-based edu coexistence flow.
+ {"edu-coexistence", IDR_EDU_COEXISTENCE_EDU_COEXISTENCE_HTML},
- {"account_manager_signin_blocked_by_policy.svg",
- IDS_ACCOUNT_MANAGER_SIGNIN_BLOCKED_BY_POLICY_SVG},
+ {"account_manager_signin_blocked_by_policy.svg",
+ IDS_ACCOUNT_MANAGER_SIGNIN_BLOCKED_BY_POLICY_SVG},
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
- {"account_manager_welcome_1x.png", IDR_ACCOUNT_MANAGER_WELCOME_1X_PNG},
- {"account_manager_welcome_2x.png", IDR_ACCOUNT_MANAGER_WELCOME_2X_PNG},
- {"googleg.svg", IDR_ACCOUNT_MANAGER_WELCOME_GOOGLE_LOGO_SVG},
+ {"account_manager_welcome_1x.png", IDR_ACCOUNT_MANAGER_WELCOME_1X_PNG},
+ {"account_manager_welcome_2x.png", IDR_ACCOUNT_MANAGER_WELCOME_2X_PNG},
+ {"googleg.svg", IDR_ACCOUNT_MANAGER_WELCOME_GOOGLE_LOGO_SVG},
#endif
};
source->AddResourcePaths(kResources);
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
static constexpr webui::LocalizedString kLocalizedStrings[] = {
- {"accessibleCloseButtonLabel", IDS_SIGNIN_ACCESSIBLE_CLOSE_BUTTON},
- {"accessibleBackButtonLabel", IDS_SIGNIN_ACCESSIBLE_BACK_BUTTON},
+ {"accessibleCloseButtonLabel", IDS_SIGNIN_ACCESSIBLE_CLOSE_BUTTON},
+ {"accessibleBackButtonLabel", IDS_SIGNIN_ACCESSIBLE_BACK_BUTTON},
#if BUILDFLAG(IS_CHROMEOS_ASH)
- {"title", IDS_ACCOUNT_MANAGER_DIALOG_TITLE},
- {"ok", IDS_APP_OK},
- {"nextButtonLabel", IDS_ACCOUNT_MANAGER_DIALOG_NEXT_BUTTON},
- {"accountManagerDialogWelcomeTitle",
- IDS_ACCOUNT_MANAGER_DIALOG_WELCOME_TITLE},
- {"accountManagerDialogWelcomeCheckbox",
- IDS_ACCOUNT_MANAGER_DIALOG_WELCOME_CHECKBOX},
- {"accountManagerDialogArcAccountPickerTitle",
- IDS_ACCOUNT_MANAGER_DIALOG_ARC_ACCOUNT_PICKER_TITLE},
- {"addAccountLabel", IDS_ACCOUNT_MANAGER_DIALOG_ADD_ACCOUNT_LABEL},
- {"accountUseInArcButtonLabel",
- IDS_SETTINGS_ACCOUNT_MANAGER_USE_IN_ARC_BUTTON_LABEL},
- {"accountManagerErrorNoInternetTitle",
- IDS_ACCOUNT_MANAGER_ERROR_NO_INTERNET_TITLE},
- {"accountManagerErrorNoInternetBody",
- IDS_ACCOUNT_MANAGER_ERROR_NO_INTERNET_BODY},
- {"accountManagerErrorCannotAddAccountTitle",
- IDS_ACCOUNT_MANAGER_ERROR_CANNOT_ADD_ACCOUNT_TITLE},
- {"accountManagerErrorCannotAddAccountBody",
- IDS_ACCOUNT_MANAGER_ERROR_CANNOT_ADD_ACCOUNT_BODY},
- {"accountManagerDialogSigninBlockedByPolicyTitle",
- IDS_ACCOUNT_MANAGER_DIALOG_SIGNIN_BLOCKED_BY_POLICY_TITLE},
- {"accountManagerDialogSigninBlockedByPolicyBody",
- IDS_ACCOUNT_MANAGER_DIALOG_SIGNIN_BLOCKED_BY_POLICY_BODY},
- {"accountManagerDialogSigninErrorTitle",
- IDS_ACCOUNT_MANAGER_DIALOG_SIGNIN_ERROR_TITLE},
- {"accountManagerDialogSigninErrorBody",
- IDS_ACCOUNT_MANAGER_DIALOG_SIGNIN_ERROR_BODY},
- {"accountManagerDialogSigninBlockedByPolicyImageAlt",
- IDS_ACCOUNT_MANAGER_DIALOG_SIGNIN_BLOCKED_BY_POLICY_IMAGE_ALT},
- {"accountManagerDialogSigninSpinnerText",
- IDS_ACCOUNT_MANAGER_DIALOG_SIGNIN_SPINNER_TEXT},
+ {"title", IDS_ACCOUNT_MANAGER_DIALOG_TITLE},
+ {"ok", IDS_APP_OK},
+ {"nextButtonLabel", IDS_ACCOUNT_MANAGER_DIALOG_NEXT_BUTTON},
+ {"accountManagerDialogWelcomeTitle",
+ IDS_ACCOUNT_MANAGER_DIALOG_WELCOME_TITLE},
+ {"accountManagerDialogWelcomeCheckbox",
+ IDS_ACCOUNT_MANAGER_DIALOG_WELCOME_CHECKBOX},
+ {"accountManagerDialogArcAccountPickerTitle",
+ IDS_ACCOUNT_MANAGER_DIALOG_ARC_ACCOUNT_PICKER_TITLE},
+ {"addAccountLabel", IDS_ACCOUNT_MANAGER_DIALOG_ADD_ACCOUNT_LABEL},
+ {"accountUseInArcButtonLabel",
+ IDS_SETTINGS_ACCOUNT_MANAGER_USE_IN_ARC_BUTTON_LABEL},
+ {"accountManagerErrorNoInternetTitle",
+ IDS_ACCOUNT_MANAGER_ERROR_NO_INTERNET_TITLE},
+ {"accountManagerErrorNoInternetBody",
+ IDS_ACCOUNT_MANAGER_ERROR_NO_INTERNET_BODY},
+ {"accountManagerErrorCannotAddAccountTitle",
+ IDS_ACCOUNT_MANAGER_ERROR_CANNOT_ADD_ACCOUNT_TITLE},
+ {"accountManagerErrorCannotAddAccountBody",
+ IDS_ACCOUNT_MANAGER_ERROR_CANNOT_ADD_ACCOUNT_BODY},
+ {"accountManagerDialogSigninBlockedByPolicyTitle",
+ IDS_ACCOUNT_MANAGER_DIALOG_SIGNIN_BLOCKED_BY_POLICY_TITLE},
+ {"accountManagerDialogSigninBlockedByPolicyBody",
+ IDS_ACCOUNT_MANAGER_DIALOG_SIGNIN_BLOCKED_BY_POLICY_BODY},
+ {"accountManagerDialogSigninErrorTitle",
+ IDS_ACCOUNT_MANAGER_DIALOG_SIGNIN_ERROR_TITLE},
+ {"accountManagerDialogSigninErrorBody",
+ IDS_ACCOUNT_MANAGER_DIALOG_SIGNIN_ERROR_BODY},
+ {"accountManagerDialogSigninBlockedByPolicyImageAlt",
+ IDS_ACCOUNT_MANAGER_DIALOG_SIGNIN_BLOCKED_BY_POLICY_IMAGE_ALT},
+ {"accountManagerDialogSigninSpinnerText",
+ IDS_ACCOUNT_MANAGER_DIALOG_SIGNIN_SPINNER_TEXT},
#else
- {"title", IDS_CHROME_SIGNIN_TITLE},
+ {"title", IDS_CHROME_SIGNIN_TITLE},
#endif
};
source->AddLocalizedStrings(kLocalizedStrings);
@@ -352,8 +352,9 @@
Profile* profile = Profile::FromWebUI(web_ui);
CreateAndAddWebUIDataSource(profile);
- if (!IsValidChromeSigninReason(web_ui->GetWebContents()->GetVisibleURL()))
+ if (!IsValidChromeSigninReason(web_ui->GetWebContents()->GetVisibleURL())) {
return;
+ }
#if BUILDFLAG(IS_CHROMEOS_ASH)
web_ui->AddMessageHandler(
diff --git a/chrome/browser/ui/webui/signin/login_ui_service.cc b/chrome/browser/ui/webui/signin/login_ui_service.cc
index 7029ea2..255337e 100644
--- a/chrome/browser/ui/webui/signin/login_ui_service.cc
+++ b/chrome/browser/ui/webui/signin/login_ui_service.cc
@@ -49,8 +49,9 @@
void LoginUIService::SyncConfirmationUIClosed(
SyncConfirmationUIClosedResult result) {
- for (Observer& observer : observer_list_)
+ for (Observer& observer : observer_list_) {
observer.OnSyncConfirmationUIClosed(result);
+ }
}
void LoginUIService::DisplayLoginResult(Browser* browser,
diff --git a/chrome/browser/ui/webui/signin/login_ui_service_factory.cc b/chrome/browser/ui/webui/signin/login_ui_service_factory.cc
index 423e302..e76dbd5 100644
--- a/chrome/browser/ui/webui/signin/login_ui_service_factory.cc
+++ b/chrome/browser/ui/webui/signin/login_ui_service_factory.cc
@@ -42,7 +42,8 @@
std::unique_ptr<KeyedService>
LoginUIServiceFactory::BuildServiceInstanceForBrowserContext(
content::BrowserContext* browser_context) const {
- return std::make_unique<LoginUIService>(Profile::FromBrowserContext(browser_context));
+ return std::make_unique<LoginUIService>(
+ Profile::FromBrowserContext(browser_context));
}
bool LoginUIServiceFactory::ServiceIsCreatedWithBrowserContext() const {
diff --git a/chrome/browser/ui/webui/signin/login_ui_service_unittest.cc b/chrome/browser/ui/webui/signin/login_ui_service_unittest.cc
index 53d3363..aa2a4b84d 100644
--- a/chrome/browser/ui/webui/signin/login_ui_service_unittest.cc
+++ b/chrome/browser/ui/webui/signin/login_ui_service_unittest.cc
@@ -62,7 +62,7 @@
class TestLoginUI : public LoginUIService::LoginUI {
public:
- TestLoginUI() { }
+ TestLoginUI() {}
TestLoginUI(const TestLoginUI&) = delete;
TestLoginUI& operator=(const TestLoginUI&) = delete;
diff --git a/chrome/browser/ui/webui/signin/managed_user_profile_notice_handler.cc b/chrome/browser/ui/webui/signin/managed_user_profile_notice_handler.cc
index e206352..0da66fe 100644
--- a/chrome/browser/ui/webui/signin/managed_user_profile_notice_handler.cc
+++ b/chrome/browser/ui/webui/signin/managed_user_profile_notice_handler.cc
@@ -72,8 +72,9 @@
std::string GetManagedAccountTitle(ProfileAttributesEntry* entry,
const std::string& account_domain_name) {
DCHECK(entry);
- if (entry->GetHostedDomain() == kNoHostedDomainFound)
+ if (entry->GetHostedDomain() == kNoHostedDomainFound) {
return std::string();
+ }
const std::string domain_name = entry->GetHostedDomain().empty()
? account_domain_name
: entry->GetHostedDomain();
@@ -85,8 +86,9 @@
std::string GetManagedDeviceTitle() {
std::optional<std::string> device_manager =
chrome::GetDeviceManagerIdentity();
- if (!device_manager)
+ if (!device_manager) {
return std::string();
+ }
if (device_manager->empty()) {
return l10n_util::GetStringUTF8(
IDS_ENTERPRISE_PROFILE_WELCOME_DEVICE_MANAGED);
@@ -191,8 +193,9 @@
}
void ManagedUserProfileNoticeHandler::OnBrowserRemoved(Browser* browser) {
- if (browser_ == browser)
+ if (browser_ == browser) {
browser_ = nullptr;
+ }
}
void ManagedUserProfileNoticeHandler::OnExtendedAccountInfoUpdated(
@@ -231,8 +234,9 @@
const base::Value::List& args) {
AllowJavascript();
- if (browser_)
+ if (browser_) {
signin::SetInitializedModalHeight(browser_, web_ui(), args);
+ }
}
void ManagedUserProfileNoticeHandler::HandleProceed(
@@ -340,8 +344,9 @@
void ManagedUserProfileNoticeHandler::UpdateProfileInfo(
const base::FilePath& profile_path) {
DCHECK(IsJavascriptAllowed());
- if (profile_path != profile_path_)
+ if (profile_path != profile_path_) {
return;
+ }
FireWebUIListener("on-profile-info-changed", GetProfileInfoValue());
}
diff --git a/chrome/browser/ui/webui/signin/profile_customization_handler.cc b/chrome/browser/ui/webui/signin/profile_customization_handler.cc
index d7defb5..f3d8bb17 100644
--- a/chrome/browser/ui/webui/signin/profile_customization_handler.cc
+++ b/chrome/browser/ui/webui/signin/profile_customization_handler.cc
@@ -149,15 +149,17 @@
/*is_default_name=*/false);
}
- if (completion_callback_)
+ if (completion_callback_) {
std::move(completion_callback_).Run(CustomizationResult::kDone);
+ }
}
void ProfileCustomizationHandler::HandleSkip(const base::Value::List& args) {
CHECK_EQ(0u, args.size());
- if (completion_callback_)
+ if (completion_callback_) {
std::move(completion_callback_).Run(CustomizationResult::kSkip);
+ }
}
void ProfileCustomizationHandler::HandleDeleteProfile(
@@ -185,8 +187,9 @@
void ProfileCustomizationHandler::UpdateProfileInfo(
const base::FilePath& profile_path) {
DCHECK(IsJavascriptAllowed());
- if (profile_path != profile_->GetPath())
+ if (profile_path != profile_->GetPath()) {
return;
+ }
FireWebUIListener("on-profile-info-changed", GetProfileInfoValue());
}
@@ -204,8 +207,9 @@
dict.Set("pictureUrl", webui::GetBitmapDataUrl(icon.AsBitmap()));
dict.Set("isManaged", AccountInfo::IsManaged(entry->GetHostedDomain()));
std::u16string gaia_name = entry->GetGAIANameToDisplay();
- if (gaia_name.empty())
+ if (gaia_name.empty()) {
gaia_name = entry->GetLocalProfileName();
+ }
dict.Set("welcomeTitle", l10n_util::GetStringFUTF8(
IDS_PROFILE_CUSTOMIZATION_WELCOME, gaia_name));
return dict;
diff --git a/chrome/browser/ui/webui/signin/profile_customization_handler.h b/chrome/browser/ui/webui/signin/profile_customization_handler.h
index a01bc2ae..b01b258 100644
--- a/chrome/browser/ui/webui/signin/profile_customization_handler.h
+++ b/chrome/browser/ui/webui/signin/profile_customization_handler.h
@@ -5,13 +5,12 @@
#ifndef CHROME_BROWSER_UI_WEBUI_SIGNIN_PROFILE_CUSTOMIZATION_HANDLER_H_
#define CHROME_BROWSER_UI_WEBUI_SIGNIN_PROFILE_CUSTOMIZATION_HANDLER_H_
-#include "content/public/browser/web_ui_message_handler.h"
-
#include "base/files/file_path.h"
#include "base/functional/callback.h"
#include "base/memory/raw_ptr.h"
#include "base/scoped_observation.h"
#include "chrome/browser/profiles/profile_attributes_storage.h"
+#include "content/public/browser/web_ui_message_handler.h"
class Profile;
class ProfileAttributesEntry;
diff --git a/chrome/browser/ui/webui/signin/profile_picker_ui.cc b/chrome/browser/ui/webui/signin/profile_picker_ui.cc
index fad01b4..76e6a57 100644
--- a/chrome/browser/ui/webui/signin/profile_picker_ui.cc
+++ b/chrome/browser/ui/webui/signin/profile_picker_ui.cc
@@ -68,8 +68,9 @@
const base::Value* browser_signin_value = policies.GetValue(
policy::key::kBrowserSignin, base::Value::Type::INTEGER);
- if (!browser_signin_value)
+ if (!browser_signin_value) {
return true;
+ }
return static_cast<policy::BrowserSigninMode>(
browser_signin_value->GetInt()) !=
@@ -91,8 +92,9 @@
int managed_by_id =
IDS_PROFILE_PICKER_PROFILE_CREATION_FLOW_DEVICE_MANAGED_BY_DESCRIPTION;
#endif
- if (!manager)
+ if (!manager) {
return std::string();
+ }
if (manager->empty()) {
return l10n_util::GetStringUTF8(managed_id);
}
diff --git a/chrome/browser/ui/webui/signin/signin_email_confirmation_dialog.cc b/chrome/browser/ui/webui/signin/signin_email_confirmation_dialog.cc
index 4d8736d..dbe57cf 100644
--- a/chrome/browser/ui/webui/signin/signin_email_confirmation_dialog.cc
+++ b/chrome/browser/ui/webui/signin/signin_email_confirmation_dialog.cc
@@ -135,15 +135,17 @@
void SigninEmailConfirmationDialog::CloseDialog() {
content::WebContents* dialog_web_contents = GetDialogWebContents();
- if (!dialog_web_contents)
+ if (!dialog_web_contents) {
return;
+ }
content::WebUI* web_ui = dialog_web_contents->GetWebUI();
if (web_ui) {
SigninEmailConfirmationUI* signin_email_confirmation_ui =
static_cast<SigninEmailConfirmationUI*>(web_ui->GetController());
- if (signin_email_confirmation_ui)
+ if (signin_email_confirmation_ui) {
signin_email_confirmation_ui->Close();
+ }
}
}
@@ -187,8 +189,9 @@
NotifyModalDialogClosed();
- if (callback_)
+ if (callback_) {
std::move(callback_).Run(action);
+ }
}
void SigninEmailConfirmationDialog::CloseModalSignin() {
diff --git a/chrome/browser/ui/webui/signin/signin_error_handler.cc b/chrome/browser/ui/webui/signin/signin_error_handler.cc
index 013b9540e..2552e183 100644
--- a/chrome/browser/ui/webui/signin/signin_error_handler.cc
+++ b/chrome/browser/ui/webui/signin/signin_error_handler.cc
@@ -28,8 +28,9 @@
}
void SigninErrorHandler::OnBrowserRemoved(Browser* browser) {
- if (browser_ == browser)
+ if (browser_ == browser) {
browser_ = nullptr;
+ }
}
void SigninErrorHandler::RegisterMessages() {
@@ -53,8 +54,9 @@
void SigninErrorHandler::HandleSwitchToExistingProfile(
const base::Value::List& args) {
- if (duplicate_profile_path_.empty())
+ if (duplicate_profile_path_.empty()) {
return;
+ }
// CloseDialog will eventually destroy this object, so nothing should access
// its members after this call. However, closing the dialog may steal focus
@@ -75,8 +77,9 @@
void SigninErrorHandler::HandleLearnMore(const base::Value::List& args) {
// "Learn more" only shown when from_profile_picker_=false
DCHECK(!from_profile_picker_);
- if (!browser_)
+ if (!browser_) {
return;
+ }
CloseDialog();
signin_ui_util::ShowSigninErrorLearnMorePage(browser_->profile());
}
@@ -84,8 +87,9 @@
void SigninErrorHandler::HandleInitializedWithSize(
const base::Value::List& args) {
AllowJavascript();
- if (duplicate_profile_path_.empty())
+ if (duplicate_profile_path_.empty()) {
FireWebUIListener("switch-button-unavailable");
+ }
signin::SetInitializedModalHeight(browser_, web_ui(), args);
}
diff --git a/chrome/browser/ui/webui/signin/signin_error_handler_unittest.cc b/chrome/browser/ui/webui/signin/signin_error_handler_unittest.cc
index 889f9ab..e49e605a 100644
--- a/chrome/browser/ui/webui/signin/signin_error_handler_unittest.cc
+++ b/chrome/browser/ui/webui/signin/signin_error_handler_unittest.cc
@@ -39,10 +39,10 @@
SigninErrorHandler::CloseBrowserModalSigninDialog();
}
- using SigninErrorHandler::HandleSwitchToExistingProfile;
using SigninErrorHandler::HandleConfirm;
- using SigninErrorHandler::HandleLearnMore;
using SigninErrorHandler::HandleInitializedWithSize;
+ using SigninErrorHandler::HandleLearnMore;
+ using SigninErrorHandler::HandleSwitchToExistingProfile;
bool browser_modal_dialog_did_close() {
return browser_modal_dialog_did_close_;
diff --git a/chrome/browser/ui/webui/signin/signin_reauth_handler.cc b/chrome/browser/ui/webui/signin/signin_reauth_handler.cc
index 83f990c..8951c11 100644
--- a/chrome/browser/ui/webui/signin/signin_reauth_handler.cc
+++ b/chrome/browser/ui/webui/signin/signin_reauth_handler.cc
@@ -37,8 +37,9 @@
}
void SigninReauthHandler::OnJavascriptAllowed() {
- if (!controller_)
+ if (!controller_) {
return;
+ }
SigninReauthViewController::GaiaReauthType gaia_reauth_type =
controller_->gaia_reauth_type();
@@ -55,8 +56,9 @@
void SigninReauthHandler::OnGaiaReauthTypeDetermined(
SigninReauthViewController::GaiaReauthType reauth_type) {
- if (!IsJavascriptAllowed())
+ if (!IsJavascriptAllowed()) {
return;
+ }
FireWebUIListener("reauth-type-determined");
}
@@ -66,13 +68,15 @@
}
void SigninReauthHandler::HandleConfirm(const base::Value::List& args) {
- if (controller_)
+ if (controller_) {
controller_->OnReauthConfirmed(BuildConsent(args));
+ }
}
void SigninReauthHandler::HandleCancel(const base::Value::List& args) {
- if (controller_)
+ if (controller_) {
controller_->OnReauthDismissed();
+ }
}
sync_pb::UserConsentTypes::AccountPasswordsConsent
diff --git a/chrome/browser/ui/webui/signin/signin_url_utils.cc b/chrome/browser/ui/webui/signin/signin_url_utils.cc
index fde5838..641d4fc 100644
--- a/chrome/browser/ui/webui/signin/signin_url_utils.cc
+++ b/chrome/browser/ui/webui/signin/signin_url_utils.cc
@@ -59,8 +59,9 @@
signin_metrics::ReauthAccessPoint GetReauthAccessPointForReauthConfirmationURL(
const GURL& url) {
std::string value;
- if (!net::GetValueForKeyInQuery(url, kAccessPointParamKey, &value))
+ if (!net::GetValueForKeyInQuery(url, kAccessPointParamKey, &value)) {
return signin_metrics::ReauthAccessPoint::kUnknown;
+ }
int access_point_int = -1;
base::StringToInt(value, &access_point_int);
diff --git a/chrome/browser/ui/webui/signin/signin_utils.cc b/chrome/browser/ui/webui/signin/signin_utils.cc
index a241c5d..1b9dfabb 100644
--- a/chrome/browser/ui/webui/signin/signin_utils.cc
+++ b/chrome/browser/ui/webui/signin/signin_utils.cc
@@ -75,8 +75,9 @@
Browser* GetDesktopBrowser(content::WebUI* web_ui) {
Browser* browser = chrome::FindBrowserWithTab(web_ui->GetWebContents());
- if (!browser)
+ if (!browser) {
browser = chrome::FindLastActiveWithProfile(Profile::FromWebUI(web_ui));
+ }
return browser;
}
@@ -92,8 +93,9 @@
void SetInitializedModalHeight(Browser* browser,
content::WebUI* web_ui,
const base::Value::List& args) {
- if (!browser)
+ if (!browser) {
return;
+ }
double height = args[0].GetDouble();
browser->signin_view_controller()->SetModalSigninHeight(
diff --git a/chrome/browser/ui/webui/signin/signin_utils.h b/chrome/browser/ui/webui/signin/signin_utils.h
index 2e3c4b1..c9479e2 100644
--- a/chrome/browser/ui/webui/signin/signin_utils.h
+++ b/chrome/browser/ui/webui/signin/signin_utils.h
@@ -24,7 +24,7 @@
class RenderFrameHost;
class WebContents;
class WebUI;
-}
+} // namespace content
namespace extensions {
class WebViewGuest;
diff --git a/chrome/browser/ui/webui/signin/signin_utils_desktop.cc b/chrome/browser/ui/webui/signin/signin_utils_desktop.cc
index 42df1f5..5d0583e 100644
--- a/chrome/browser/ui/webui/signin/signin_utils_desktop.cc
+++ b/chrome/browser/ui/webui/signin/signin_utils_desktop.cc
@@ -26,19 +26,23 @@
SigninUIError CanOfferSignin(Profile* profile,
const GaiaId& gaia_id,
const std::string& email) {
- if (!profile)
+ if (!profile) {
return SigninUIError::Other(email);
+ }
- if (!profile->GetPrefs()->GetBoolean(prefs::kSigninAllowed))
+ if (!profile->GetPrefs()->GetBoolean(prefs::kSigninAllowed)) {
return SigninUIError::Other(email);
+ }
- if (!ChromeSigninClient::ProfileAllowsSigninCookies(profile))
+ if (!ChromeSigninClient::ProfileAllowsSigninCookies(profile)) {
return SigninUIError::Other(email);
+ }
if (!email.empty()) {
auto* identity_manager = IdentityManagerFactory::GetForProfile(profile);
- if (!identity_manager)
+ if (!identity_manager) {
return SigninUIError::Other(email);
+ }
// Make sure this username is not prohibited by policy.
if (!signin::IsUsernameAllowedByPatternFromPrefs(
@@ -53,8 +57,9 @@
identity_manager->GetPrimaryAccountInfo(signin::ConsentLevel::kSync)
.email;
const bool same_email = gaia::AreEmailsSame(current_email, email);
- if (!current_email.empty() && !same_email)
+ if (!current_email.empty() && !same_email) {
return SigninUIError::WrongReauthAccount(email, current_email);
+ }
// If some profile, not just the current one, is already connected to this
// account, don't show the infobar.
diff --git a/chrome/browser/ui/webui/signin/sync_confirmation_handler.cc b/chrome/browser/ui/webui/signin/sync_confirmation_handler.cc
index b1e98a65..44b572b0 100644
--- a/chrome/browser/ui/webui/signin/sync_confirmation_handler.cc
+++ b/chrome/browser/ui/webui/signin/sync_confirmation_handler.cc
@@ -164,8 +164,9 @@
}
void SyncConfirmationHandler::OnBrowserRemoved(Browser* browser) {
- if (browser_ == browser)
+ if (browser_ == browser) {
browser_ = nullptr;
+ }
}
void SyncConfirmationHandler::RegisterMessages() {
@@ -461,6 +462,7 @@
this, &SyncConfirmationHandler::OnDeadline);
}
- if (browser_)
+ if (browser_) {
signin::SetInitializedModalHeight(browser_, web_ui(), args);
+ }
}
diff --git a/chrome/browser/ui/webui/signin/sync_confirmation_handler_unittest.cc b/chrome/browser/ui/webui/signin/sync_confirmation_handler_unittest.cc
index e184a9d..843eaf08 100644
--- a/chrome/browser/ui/webui/signin/sync_confirmation_handler_unittest.cc
+++ b/chrome/browser/ui/webui/signin/sync_confirmation_handler_unittest.cc
@@ -68,9 +68,9 @@
const TestingSyncConfirmationHandler&) = delete;
using SyncConfirmationHandler::HandleConfirm;
- using SyncConfirmationHandler::HandleUndo;
- using SyncConfirmationHandler::HandleInitializedWithSize;
using SyncConfirmationHandler::HandleGoToSettings;
+ using SyncConfirmationHandler::HandleInitializedWithSize;
+ using SyncConfirmationHandler::HandleUndo;
using SyncConfirmationHandler::RecordConsent;
};
@@ -97,8 +97,7 @@
did_user_explicitly_interact_(false),
on_sync_confirmation_ui_closed_called_(false),
sync_confirmation_ui_closed_result_(LoginUIService::ABORT_SYNC),
- web_ui_(new content::TestWebUI) {
- }
+ web_ui_(new content::TestWebUI) {}
SyncConfirmationHandlerTest(const SyncConfirmationHandlerTest&) = delete;
SyncConfirmationHandlerTest& operator=(const SyncConfirmationHandlerTest&) =
@@ -137,13 +136,9 @@
TestingSyncConfirmationHandler* handler() { return handler_; }
- content::TestWebUI* web_ui() {
- return web_ui_.get();
- }
+ content::TestWebUI* web_ui() { return web_ui_.get(); }
- base::UserActionTester* user_action_tester() {
- return &user_action_tester_;
- }
+ base::UserActionTester* user_action_tester() { return &user_action_tester_; }
consent_auditor::FakeConsentAuditor* consent_auditor() {
return static_cast<consent_auditor::FakeConsentAuditor*>(
@@ -434,9 +429,9 @@
EXPECT_EQ(LoginUIService::ABORT_SYNC, sync_confirmation_ui_closed_result_);
EXPECT_EQ(1, user_action_tester()->GetActionCount("Signin_Undo_Signin"));
EXPECT_EQ(0, user_action_tester()->GetActionCount(
- "Signin_Signin_WithDefaultSyncSettings"));
+ "Signin_Signin_WithDefaultSyncSettings"));
EXPECT_EQ(0, user_action_tester()->GetActionCount(
- "Signin_Signin_WithAdvancedSyncSettings"));
+ "Signin_Signin_WithAdvancedSyncSettings"));
}
TEST_F(SyncConfirmationHandlerTest, TestHandleConfirm) {
@@ -463,9 +458,9 @@
sync_confirmation_ui_closed_result_);
EXPECT_EQ(0, user_action_tester()->GetActionCount("Signin_Undo_Signin"));
EXPECT_EQ(1, user_action_tester()->GetActionCount(
- "Signin_Signin_WithDefaultSyncSettings"));
+ "Signin_Signin_WithDefaultSyncSettings"));
EXPECT_EQ(0, user_action_tester()->GetActionCount(
- "Signin_Signin_WithAdvancedSyncSettings"));
+ "Signin_Signin_WithAdvancedSyncSettings"));
// The corresponding string IDs get recorded.
std::vector<std::vector<int>> expected_id_vectors = {{1, 2, 4}};
diff --git a/chrome/browser/ui/webui/signin/turn_sync_on_helper_delegate_impl.cc b/chrome/browser/ui/webui/signin/turn_sync_on_helper_delegate_impl.cc
index 718b915..a733dca 100644
--- a/chrome/browser/ui/webui/signin/turn_sync_on_helper_delegate_impl.cc
+++ b/chrome/browser/ui/webui/signin/turn_sync_on_helper_delegate_impl.cc
@@ -182,16 +182,19 @@
LoginUIService::SyncConfirmationUIClosedResult result) {
DCHECK(sync_confirmation_callback_);
// Treat closing the ui as an implicit ABORT_SYNC action.
- if (result == LoginUIService::UI_CLOSED)
+ if (result == LoginUIService::UI_CLOSED) {
result = LoginUIService::ABORT_SYNC;
- if (browser_)
+ }
+ if (browser_) {
browser_->signin_view_controller()->CloseModalSignin();
+ }
std::move(sync_confirmation_callback_).Run(result);
}
void TurnSyncOnHelperDelegateImpl::OnBrowserRemoved(Browser* browser) {
- if (browser == browser_)
+ if (browser == browser_) {
browser_ = nullptr;
+ }
}
#if !BUILDFLAG(IS_CHROMEOS_LACROS)
diff --git a/chrome/browser/ui/webui/signin/turn_sync_on_helper_delegate_impl.h b/chrome/browser/ui/webui/signin/turn_sync_on_helper_delegate_impl.h
index b581875..888c3919 100644
--- a/chrome/browser/ui/webui/signin/turn_sync_on_helper_delegate_impl.h
+++ b/chrome/browser/ui/webui/signin/turn_sync_on_helper_delegate_impl.h
@@ -20,7 +20,7 @@
namespace policy {
class ProfileSeparationPolicies;
class UserCloudSigninRestrictionPolicyFetcher;
-}
+} // namespace policy
// Default implementation for TurnSyncOnHelper::Delegate.
class TurnSyncOnHelperDelegateImpl : public TurnSyncOnHelper::Delegate,
diff --git a/chrome/browser/ui/webui/signin/turn_sync_on_helper_policy_fetch_tracker.cc b/chrome/browser/ui/webui/signin/turn_sync_on_helper_policy_fetch_tracker.cc
index 534b88f..7e99efa 100644
--- a/chrome/browser/ui/webui/signin/turn_sync_on_helper_policy_fetch_tracker.cc
+++ b/chrome/browser/ui/webui/signin/turn_sync_on_helper_policy_fetch_tracker.cc
@@ -66,8 +66,9 @@
// policy::PolicyService::ProviderUpdateObserver
void OnProviderUpdatePropagated(
policy::ConfigurationPolicyProvider* provider) override {
- if (provider != profile_->GetUserCloudPolicyManager())
+ if (provider != profile_->GetUserCloudPolicyManager()) {
return;
+ }
VLOG(2) << "Policies after sign in:";
VLOG(2) << policy::PolicyConversions(
std::make_unique<policy::ChromePolicyConversionsClient>(
@@ -75,15 +76,17 @@
.ToJSON();
scoped_policy_update_observer_.Reset();
policy_update_timeout_timer_.Reset();
- if (on_policy_updated_callback_)
+ if (on_policy_updated_callback_) {
std::move(on_policy_updated_callback_).Run();
+ }
}
void OnProviderUpdateTimedOut() {
DVLOG(1) << "Waiting for policies update propagated timed out";
scoped_policy_update_observer_.Reset();
- if (on_policy_updated_callback_)
+ if (on_policy_updated_callback_) {
std::move(on_policy_updated_callback_).Run();
+ }
}
private:
diff --git a/chrome/browser/ui/webui/support_tool/support_tool_ui_browsertest.cc b/chrome/browser/ui/webui/support_tool/support_tool_ui_browsertest.cc
index ec7be3f5..0fdb342 100644
--- a/chrome/browser/ui/webui/support_tool/support_tool_ui_browsertest.cc
+++ b/chrome/browser/ui/webui/support_tool/support_tool_ui_browsertest.cc
@@ -2,11 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "chrome/browser/ui/webui/support_tool/support_tool_ui.h"
+
#include <string>
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
-#include "chrome/browser/ui/webui/support_tool/support_tool_ui.h"
#include "chrome/common/chrome_features.h"
#include "chrome/common/webui_url_constants.h"
#include "chrome/test/base/in_process_browser_test.h"
diff --git a/chrome/browser/ui/webui/support_tool/support_tool_ui_utils_unittest.cc b/chrome/browser/ui/webui/support_tool/support_tool_ui_utils_unittest.cc
index 2f0b4c6..7a42151 100644
--- a/chrome/browser/ui/webui/support_tool/support_tool_ui_utils_unittest.cc
+++ b/chrome/browser/ui/webui/support_tool/support_tool_ui_utils_unittest.cc
@@ -90,8 +90,9 @@
ASSERT_TRUE(data_collector_enum);
if (base::Contains(included_data_collectors,
static_cast<support_tool::DataCollectorType>(
- data_collector_enum.value())))
+ data_collector_enum.value()))) {
data_collector_item.Set(support_tool_ui::kDataCollectorIncluded, true);
+ }
}
}
diff --git a/chrome/browser/ui/webui/system/system_info_ui.cc b/chrome/browser/ui/webui/system/system_info_ui.cc
index 4e005b2..e8c3d748 100644
--- a/chrome/browser/ui/webui/system/system_info_ui.cc
+++ b/chrome/browser/ui/webui/system/system_info_ui.cc
@@ -131,8 +131,9 @@
void SystemInfoUIHandler::OnSystemInfo(
std::unique_ptr<SystemLogsResponse> sys_info) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- if (!sys_info)
+ if (!sys_info) {
return;
+ }
base::Value::List data;
for (SystemLogsResponse::const_iterator it = sys_info->begin();
it != sys_info->end(); ++it) {
diff --git a/chrome/browser/ui/webui/tab_search/tab_search_page_handler.cc b/chrome/browser/ui/webui/tab_search/tab_search_page_handler.cc
index 7d82d340..9c5d7e75 100644
--- a/chrome/browser/ui/webui/tab_search/tab_search_page_handler.cc
+++ b/chrome/browser/ui/webui/tab_search/tab_search_page_handler.cc
@@ -104,8 +104,9 @@
for (const auto& tab : tabs) {
const sessions::SerializedNavigationEntry& entry =
tab->navigations[tab->current_navigation_index];
- if (entry.timestamp() > last_active_time)
+ if (entry.timestamp() > last_active_time) {
last_active_time = entry.timestamp();
+ }
}
return last_active_time;
}
@@ -659,8 +660,9 @@
if (!sent_initial_payload_) {
sent_initial_payload_ = true;
int tab_count = 0;
- for (const auto& window : profile_tabs->windows)
+ for (const auto& window : profile_tabs->windows) {
tab_count += window->tabs.size();
+ }
base::UmaHistogramCounts100("Tabs.TabSearch.NumWindowsOnOpen",
profile_tabs->windows.size());
base::UmaHistogramCounts10000("Tabs.TabSearch.NumTabsOnOpen", tab_count);
@@ -791,11 +793,13 @@
void TabSearchPageHandler::OpenRecentlyClosedEntry(int32_t session_id) {
sessions::TabRestoreService* tab_restore_service =
TabRestoreServiceFactory::GetForProfile(Profile::FromWebUI(web_ui_));
- if (!tab_restore_service)
+ if (!tab_restore_service) {
return;
+ }
Browser* active_browser = chrome::FindLastActive();
- if (!active_browser)
+ if (!active_browser) {
return;
+ }
tab_restore_service->RestoreEntryById(
BrowserLiveTabContext::FindContextForWebContents(
active_browser->tab_strip_model()->GetActiveWebContents()),
@@ -1092,21 +1096,24 @@
return;
}
auto embedder = webui_controller_->embedder();
- if (embedder)
+ if (embedder) {
embedder->ShowUI();
+ }
}
tab_search::mojom::ProfileDataPtr TabSearchPageHandler::CreateProfileData() {
auto profile_data = tab_search::mojom::ProfileData::New();
Browser* active_browser = chrome::FindLastActive();
- if (!active_browser)
+ if (!active_browser) {
return profile_data;
+ }
std::set<DedupKey> tab_dedup_keys;
std::set<tab_groups::TabGroupId> tab_group_ids;
for (Browser* browser : *BrowserList::GetInstance()) {
- if (!ShouldTrackBrowser(browser))
+ if (!ShouldTrackBrowser(browser)) {
continue;
+ }
TabStripModel* tab_strip_model = browser->tab_strip_model();
auto window = tab_search::mojom::Window::New();
@@ -1118,15 +1125,16 @@
// during loading and thus has no title/URL. Skip any such pending tabs.
// These tabs will be added to the list later on once loading has
// finished.
- if (!web_contents->GetController().GetLastCommittedEntry())
+ if (!web_contents->GetController().GetLastCommittedEntry()) {
continue;
+ }
tab_search::mojom::TabPtr tab = GetTab(tab_strip_model, web_contents, i);
tab_dedup_keys.insert(DedupKey(tab->url, tab->group_id));
window->tabs.push_back(std::move(tab));
}
profile_data->windows.push_back(std::move(window));
- if (tab_strip_model->group_model())
+ if (tab_strip_model->group_model()) {
for (auto tab_group_id :
tab_strip_model->group_model()->ListTabGroups()) {
const tab_groups::TabGroupVisualData* tab_group_visual_data =
@@ -1142,6 +1150,7 @@
tab_group_ids.insert(tab_group_id);
profile_data->tab_groups.push_back(std::move(tab_group));
}
+ }
}
AddRecentlyClosedEntries(profile_data->recently_closed_tabs,
@@ -1291,8 +1300,9 @@
std::set<DedupKey>& tab_dedup_keys) {
sessions::TabRestoreService* tab_restore_service =
TabRestoreServiceFactory::GetForProfile(Profile::FromWebUI(web_ui_));
- if (!tab_restore_service)
+ if (!tab_restore_service) {
return;
+ }
const int kRecentlyClosedTabCountThreshold = 100;
int recently_closed_tab_count = 0;
@@ -1381,8 +1391,9 @@
std::set<DedupKey>& tab_dedup_keys,
std::set<tab_groups::TabGroupId>& tab_group_ids,
std::vector<tab_search::mojom::TabGroupPtr>& tab_groups) {
- if (tab->navigations.size() == 0)
+ if (tab->navigations.size() == 0) {
return false;
+ }
tab_search::mojom::RecentlyClosedTabPtr recently_closed_tab =
GetRecentlyClosedTab(tab, close_time);
@@ -1570,15 +1581,18 @@
void TabSearchPageHandler::TabChangedAt(content::WebContents* contents,
int index,
TabChangeType change_type) {
- if (!IsWebContentsVisible())
+ if (!IsWebContentsVisible()) {
return;
+ }
// TODO(crbug.com/40709736): Support more values for TabChangeType and filter
// out the changes we are not interested in.
- if (change_type != TabChangeType::kAll)
+ if (change_type != TabChangeType::kAll) {
return;
+ }
Browser* browser = chrome::FindBrowserWithTab(contents);
- if (!browser)
+ if (!browser) {
return;
+ }
Browser* active_browser = chrome::FindLastActive();
TRACE_EVENT0("browser", "TabSearchPageHandler:TabChangedAt");
@@ -1596,13 +1610,15 @@
}
void TabSearchPageHandler::ScheduleDebounce() {
- if (!debounce_timer_->IsRunning())
+ if (!debounce_timer_->IsRunning()) {
debounce_timer_->Reset();
+ }
}
void TabSearchPageHandler::NotifyTabsChanged() {
- if (!IsWebContentsVisible())
+ if (!IsWebContentsVisible()) {
return;
+ }
page_->TabsChanged(CreateProfileData());
debounce_timer_->Stop();
}
diff --git a/chrome/browser/ui/webui/tab_strip/tab_before_unload_tracker.cc b/chrome/browser/ui/webui/tab_strip/tab_before_unload_tracker.cc
index 50fb3e5..799d052 100644
--- a/chrome/browser/ui/webui/tab_strip/tab_before_unload_tracker.cc
+++ b/chrome/browser/ui/webui/tab_strip/tab_before_unload_tracker.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/ui/webui/tab_strip/tab_before_unload_tracker.h"
#include <memory>
+
#include "base/memory/raw_ptr.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_observer.h"
diff --git a/chrome/browser/ui/webui/tab_strip/tab_strip_page_handler.cc b/chrome/browser/ui/webui/tab_strip/tab_strip_page_handler.cc
index 328ed65c..29911ec 100644
--- a/chrome/browser/ui/webui/tab_strip/tab_strip_page_handler.cc
+++ b/chrome/browser/ui/webui/tab_strip/tab_strip_page_handler.cc
@@ -270,8 +270,9 @@
const TabStripModelChange& change,
const TabStripSelectionChange& selection) {
TRACE_EVENT0("browser", "TabStripPageHandler:OnTabStripModelChanged");
- if (tab_strip_model->empty())
+ if (tab_strip_model->empty()) {
return;
+ }
// The context menu model is created when the menu is first shown. However, if
// the tab strip model changes, the context menu model may not longer reflect
@@ -405,15 +406,17 @@
should_drag_on_gesture_scroll_ = false;
return false;
}
- if (!context_menu_after_tap_)
+ if (!context_menu_after_tap_) {
page_->ShowContextMenu();
+ }
return true;
case blink::WebInputEvent::Type::kGestureTwoFingerTap:
page_->ShowContextMenu();
return true;
case blink::WebInputEvent::Type::kGestureLongTap:
- if (context_menu_after_tap_)
+ if (context_menu_after_tap_) {
page_->ShowContextMenu();
+ }
should_drag_on_gesture_scroll_ = false;
long_press_timer_->Stop();
@@ -829,10 +832,11 @@
return;
}
- if (thumbnail_tracked)
+ if (thumbnail_tracked) {
thumbnail_tracker_.AddTab(tab);
- else
+ } else {
thumbnail_tracker_.RemoveTab(tab);
+ }
}
void TabStripPageHandler::ReportTabActivationDuration(uint32_t duration_ms) {
@@ -863,8 +867,9 @@
// there is no data), send a blank URI.
TRACE_EVENT0("browser", "TabStripPageHandler:HandleThumbnailUpdate");
std::string data_uri;
- if (image)
+ if (image) {
data_uri = webui::MakeDataURIForImage(base::span(image->data), "jpeg");
+ }
const SessionID::id_type tab_id = extensions::ExtensionTabUtil::GetTabId(tab);
page_->TabThumbnailUpdated(tab_id, data_uri);
@@ -882,8 +887,9 @@
const char* histogram_fragment,
int tab_count,
base::TimeDelta duration) {
- if (tab_count <= 0)
+ if (tab_count <= 0) {
return;
+ }
// It isn't possible to report both a number of tabs and duration datapoint
// together in a histogram or to correlate two histograms together. As a
diff --git a/chrome/browser/ui/webui/tab_strip/tab_strip_ui_util.cc b/chrome/browser/ui/webui/tab_strip/tab_strip_ui_util.cc
index 96db108..99eafb2 100644
--- a/chrome/browser/ui/webui/tab_strip/tab_strip_ui_util.cc
+++ b/chrome/browser/ui/webui/tab_strip/tab_strip_ui_util.cc
@@ -31,8 +31,9 @@
std::optional<tab_groups::TabGroupId> GetTabGroupIdFromString(
TabGroupModel* tab_group_model,
std::string group_id_string) {
- if (!tab_group_model)
+ if (!tab_group_model) {
return std::nullopt;
+ }
for (tab_groups::TabGroupId candidate : tab_group_model->ListTabGroups()) {
if (candidate.ToString() == group_id_string) {
return std::optional<tab_groups::TabGroupId>{candidate};
@@ -178,8 +179,9 @@
bool DropTabsInNewBrowser(Browser* new_browser,
const std::u16string& tab_id_str,
const std::u16string& group_id_str) {
- if (tab_id_str.empty() && group_id_str.empty())
+ if (tab_id_str.empty() && group_id_str.empty()) {
return false;
+ }
Browser* source_browser = nullptr;
gfx::Range tab_indices_to_move;
@@ -191,8 +193,9 @@
if (!tab_id_str.empty()) {
int tab_id = -1;
- if (!base::StringToInt(tab_id_str, &tab_id))
+ if (!base::StringToInt(tab_id_str, &tab_id)) {
return false;
+ }
extensions::WindowController* source_window = nullptr;
int source_index = -1;
@@ -211,23 +214,27 @@
std::string group_id_utf8 = base::UTF16ToUTF8(group_id_str);
source_browser =
GetBrowserWithGroupId(new_browser->profile(), group_id_utf8);
- if (!source_browser)
+ if (!source_browser) {
return false;
+ }
TabGroupModel* source_group_model =
source_browser->tab_strip_model()->group_model();
- if (!source_group_model)
+ if (!source_group_model) {
return false;
+ }
source_group_id =
GetTabGroupIdFromString(source_group_model, group_id_utf8);
- if (!source_group_id)
+ if (!source_group_id) {
return false;
+ }
TabGroup* source_group = source_group_model->GetTabGroup(*source_group_id);
tab_indices_to_move = source_group->ListTabs();
TabGroupModel* new_group_model =
new_browser->tab_strip_model()->group_model();
- if (!new_group_model)
+ if (!new_group_model) {
return false;
+ }
new_group_model->AddTabGroup(*source_group_id,
*source_group->visual_data());
}
diff --git a/chrome/browser/ui/webui/tab_strip/thumbnail_tracker.cc b/chrome/browser/ui/webui/tab_strip/thumbnail_tracker.cc
index b57daa11..808fa15 100644
--- a/chrome/browser/ui/webui/tab_strip/thumbnail_tracker.cc
+++ b/chrome/browser/ui/webui/tab_strip/thumbnail_tracker.cc
@@ -19,8 +19,9 @@
ContentsData(ThumbnailTracker* parent, content::WebContents* contents)
: content::WebContentsObserver(contents), parent_(parent) {
thumbnail_ = parent_->thumbnail_getter_.Run(contents);
- if (!thumbnail_)
+ if (!thumbnail_) {
return;
+ }
subscription_ = thumbnail_->Subscribe();
subscription_->SetCompressedImageCallback(base::BindRepeating(
@@ -31,8 +32,9 @@
ContentsData& operator=(const ContentsData&) = delete;
void RequestThumbnail() {
- if (thumbnail_)
+ if (thumbnail_) {
thumbnail_->RequestCompressedThumbnailData();
+ }
}
// content::WebContents:
diff --git a/chrome/browser/ui/webui/test_files_request_filter.cc b/chrome/browser/ui/webui/test_files_request_filter.cc
index 906a1173..eac4bd5 100644
--- a/chrome/browser/ui/webui/test_files_request_filter.cc
+++ b/chrome/browser/ui/webui/test_files_request_filter.cc
@@ -17,8 +17,9 @@
bool ShouldHandleTestFileRequestCallback(const std::string& path) {
std::vector<std::string> url_substr =
base::SplitString(path, "/", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
- if (url_substr.size() != 2 || url_substr[0] != "test")
+ if (url_substr.size() != 2 || url_substr[0] != "test") {
return false;
+ }
base::ScopedAllowBlockingForTesting allow_blocking;
base::FilePath test_data_dir;
diff --git a/chrome/browser/ui/webui/theme_source.cc b/chrome/browser/ui/webui/theme_source.cc
index 1d418a8..c3e9480e 100644
--- a/chrome/browser/ui/webui/theme_source.cc
+++ b/chrome/browser/ui/webui/theme_source.cc
@@ -290,37 +290,36 @@
base::SPLIT_WANT_ALL);
using ColorIdCSSCallback = base::RepeatingCallback<std::string(ui::ColorId)>;
- auto generate_color_mapping = [&color_id_sets, &color_provider,
- &generate_rgb_vars](
- std::string set_name, ui::ColorId start,
- ui::ColorId end,
- ColorIdCSSCallback color_css_name) {
- // Only return these mappings if specified in the query parameter.
- auto it = base::ranges::find(color_id_sets, set_name);
- if (it == color_id_sets.end()) {
- return std::string();
- }
- color_id_sets.erase(it);
- std::string css_string;
- for (ui::ColorId id = start; id < end; ++id) {
- const SkColor color = color_provider.GetColor(id);
- std::string css_id_to_color_mapping =
- base::StringPrintf("%s:%s;", color_css_name.Run(id).c_str(),
- ui::ConvertSkColorToCSSColor(color).c_str());
- base::StrAppend(&css_string, {css_id_to_color_mapping});
- if (generate_rgb_vars) {
- // Also generate a r,g,b string for each color so apps can construct
- // colors with their own opacities in css.
- const std::string css_rgb_color_str =
- color_utils::SkColorToRgbString(color);
- const std::string css_id_to_rgb_color_mapping =
- base::StringPrintf("%s-rgb:%s;", color_css_name.Run(id).c_str(),
- css_rgb_color_str.c_str());
- base::StrAppend(&css_string, {css_id_to_rgb_color_mapping});
- }
- }
- return css_string;
- };
+ auto generate_color_mapping =
+ [&color_id_sets, &color_provider, &generate_rgb_vars](
+ std::string set_name, ui::ColorId start, ui::ColorId end,
+ ColorIdCSSCallback color_css_name) {
+ // Only return these mappings if specified in the query parameter.
+ auto it = base::ranges::find(color_id_sets, set_name);
+ if (it == color_id_sets.end()) {
+ return std::string();
+ }
+ color_id_sets.erase(it);
+ std::string css_string;
+ for (ui::ColorId id = start; id < end; ++id) {
+ const SkColor color = color_provider.GetColor(id);
+ std::string css_id_to_color_mapping =
+ base::StringPrintf("%s:%s;", color_css_name.Run(id).c_str(),
+ ui::ConvertSkColorToCSSColor(color).c_str());
+ base::StrAppend(&css_string, {css_id_to_color_mapping});
+ if (generate_rgb_vars) {
+ // Also generate a r,g,b string for each color so apps can construct
+ // colors with their own opacities in css.
+ const std::string css_rgb_color_str =
+ color_utils::SkColorToRgbString(color);
+ const std::string css_id_to_rgb_color_mapping =
+ base::StringPrintf("%s-rgb:%s;", color_css_name.Run(id).c_str(),
+ css_rgb_color_str.c_str());
+ base::StrAppend(&css_string, {css_id_to_rgb_color_mapping});
+ }
+ }
+ return css_string;
+ };
// Convenience lambda for wrapping
// |ConvertColorProviderColorIdToCSSColorId|.
diff --git a/chrome/browser/ui/webui/top_chrome/profile_preload_candidate_selector_unittest.cc b/chrome/browser/ui/webui/top_chrome/profile_preload_candidate_selector_unittest.cc
index 015cdfa..af2bbd9 100644
--- a/chrome/browser/ui/webui/top_chrome/profile_preload_candidate_selector_unittest.cc
+++ b/chrome/browser/ui/webui/top_chrome/profile_preload_candidate_selector_unittest.cc
@@ -16,11 +16,11 @@
#include "chrome/browser/ui/webui/top_chrome/top_chrome_web_ui_controller.h"
#include "chrome/browser/ui/webui/top_chrome/top_chrome_webui_config.h"
#include "chrome/test/base/chrome_render_view_host_test_harness.h"
-#include "content/public/browser/browser_context.h"
-#include "content/public/common/url_constants.h"
#include "components/site_engagement/content/site_engagement_score.h"
#include "components/site_engagement/content/site_engagement_service.h"
+#include "content/public/browser/browser_context.h"
#include "content/public/browser/web_contents.h"
+#include "content/public/common/url_constants.h"
#include "content/public/test/scoped_web_ui_controller_factory_registration.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "url/gurl.h"
@@ -99,8 +99,8 @@
: public ChromeRenderViewHostTestHarness {
public:
ProfilePreloadCandidateSelectorTest()
- : registration1_(std::make_unique<TestWebUIConfig1>(enabled_webui_1_)),
- registration2_(std::make_unique<TestWebUIConfig2>()) {}
+ : registration1_(std::make_unique<TestWebUIConfig1>(enabled_webui_1_)),
+ registration2_(std::make_unique<TestWebUIConfig2>()) {}
~ProfilePreloadCandidateSelectorTest() override = default;
ProfilePreloadCandidateSelectorTest(
const ProfilePreloadCandidateSelectorTest&) = delete;
@@ -217,8 +217,7 @@
EXPECT_EQ(GURL(kWebUIUrl2), *GetURLToPreload(profile()));
}
-TEST_F(ProfilePreloadCandidateSelectorTest,
- IgnoreDisabledWebUIs) {
+TEST_F(ProfilePreloadCandidateSelectorTest, IgnoreDisabledWebUIs) {
// Set engagement scores to maximum, so that the selector won't reject a URL
// due to its low engagemen score.
SetEngagementScore(profile(), GURL(kWebUIUrl1),
@@ -226,7 +225,7 @@
// Set URL2 to have a lower engagement score than URL1, so that when URL2 is
// selected, it is not due to it having a higher engagement score.
SetEngagementScore(profile(), GURL(kWebUIUrl2),
- SiteEngagementService::GetMaxPoints()-1);
+ SiteEngagementService::GetMaxPoints() - 1);
// By default no WebUI is present, selects either URL1 or URL2.
EXPECT_TRUE(
diff --git a/chrome/browser/ui/webui/top_chrome/top_chrome_web_ui_controller.cc b/chrome/browser/ui/webui/top_chrome/top_chrome_web_ui_controller.cc
index ca68a9f6..272f9609 100644
--- a/chrome/browser/ui/webui/top_chrome/top_chrome_web_ui_controller.cc
+++ b/chrome/browser/ui/webui/top_chrome/top_chrome_web_ui_controller.cc
@@ -7,7 +7,7 @@
#include "content/public/browser/web_ui.h"
TopChromeWebUIController::TopChromeWebUIController(content::WebUI* contents,
- bool enable_chrome_send)
+ bool enable_chrome_send)
: MojoWebUIController(contents, enable_chrome_send) {}
TopChromeWebUIController::~TopChromeWebUIController() = default;
diff --git a/chrome/browser/ui/webui/top_chrome/top_chrome_web_ui_controller.h b/chrome/browser/ui/webui/top_chrome/top_chrome_web_ui_controller.h
index a20cfac9..cefe27e3 100644
--- a/chrome/browser/ui/webui/top_chrome/top_chrome_web_ui_controller.h
+++ b/chrome/browser/ui/webui/top_chrome/top_chrome_web_ui_controller.h
@@ -34,10 +34,9 @@
// By default TopChromeWebUIController do not have normal WebUI bindings.
// Pass |enable_chrome_send| as true if these are needed.
explicit TopChromeWebUIController(content::WebUI* contents,
- bool enable_chrome_send = false);
+ bool enable_chrome_send = false);
TopChromeWebUIController(const TopChromeWebUIController&) = delete;
- TopChromeWebUIController& operator=(const TopChromeWebUIController&) =
- delete;
+ TopChromeWebUIController& operator=(const TopChromeWebUIController&) = delete;
~TopChromeWebUIController() override;
void set_embedder(base::WeakPtr<Embedder> embedder) { embedder_ = embedder; }
diff --git a/chrome/browser/ui/webui/top_chrome/webui_contents_wrapper.cc b/chrome/browser/ui/webui/top_chrome/webui_contents_wrapper.cc
index 7a133f3..b8279a2 100644
--- a/chrome/browser/ui/webui/top_chrome/webui_contents_wrapper.cc
+++ b/chrome/browser/ui/webui/top_chrome/webui_contents_wrapper.cc
@@ -133,10 +133,11 @@
}
void WebUIContentsWrapper::ResizeDueToAutoResize(content::WebContents* source,
- const gfx::Size& new_size) {
+ const gfx::Size& new_size) {
DCHECK_EQ(web_contents(), source);
- if (host_)
+ if (host_) {
host_->ResizeDueToAutoResize(source, new_size);
+ }
}
content::KeyboardEventProcessingResult
@@ -268,20 +269,23 @@
}
void WebUIContentsWrapper::CloseUI() {
- if (host_)
+ if (host_) {
host_->CloseUI();
+ }
}
void WebUIContentsWrapper::ShowContextMenu(
gfx::Point point,
std::unique_ptr<ui::MenuModel> menu_model) {
- if (host_)
+ if (host_) {
host_->ShowCustomContextMenu(point, std::move(menu_model));
+ }
}
void WebUIContentsWrapper::HideContextMenu() {
- if (host_)
+ if (host_) {
host_->HideCustomContextMenu();
+ }
}
base::WeakPtr<WebUIContentsWrapper::Host> WebUIContentsWrapper::GetHost() {
diff --git a/chrome/browser/ui/webui/top_chrome/webui_contents_wrapper_unittest.cc b/chrome/browser/ui/webui/top_chrome/webui_contents_wrapper_unittest.cc
index 2c0cc72..c96967f 100644
--- a/chrome/browser/ui/webui/top_chrome/webui_contents_wrapper_unittest.cc
+++ b/chrome/browser/ui/webui/top_chrome/webui_contents_wrapper_unittest.cc
@@ -86,8 +86,7 @@
base::WeakPtrFactory<MockHost> weak_ptr_factory_{this};
};
-class TestWebUIContentsWrapper
- : public WebUIContentsWrapper {
+class TestWebUIContentsWrapper : public WebUIContentsWrapper {
public:
explicit TestWebUIContentsWrapper(Profile* profile)
: WebUIContentsWrapper(GURL(""), profile, 0, true, true, true, "Test") {}
@@ -111,8 +110,7 @@
public:
WebUIContentsWrapperTest() = default;
WebUIContentsWrapperTest(const WebUIContentsWrapperTest&) = delete;
- WebUIContentsWrapperTest& operator=(const WebUIContentsWrapperTest&) =
- delete;
+ WebUIContentsWrapperTest& operator=(const WebUIContentsWrapperTest&) = delete;
~WebUIContentsWrapperTest() override = default;
// ViewsTestBase:
diff --git a/chrome/browser/ui/webui/user_actions/user_actions_ui_handler.cc b/chrome/browser/ui/webui/user_actions/user_actions_ui_handler.cc
index 1c3a3be..089a3fd7 100644
--- a/chrome/browser/ui/webui/user_actions/user_actions_ui_handler.cc
+++ b/chrome/browser/ui/webui/user_actions/user_actions_ui_handler.cc
@@ -38,8 +38,9 @@
void UserActionsUIHandler::OnUserAction(const std::string& action,
base::TimeTicks action_time) {
- if (!IsJavascriptAllowed())
+ if (!IsJavascriptAllowed()) {
return;
+ }
base::Value user_action_name(action);
FireWebUIListener("user-action", user_action_name);
diff --git a/chrome/browser/ui/webui/version/version_handler.cc b/chrome/browser/ui/webui/version/version_handler.cc
index 3c684382..2d8d97e 100644
--- a/chrome/browser/ui/webui/version/version_handler.cc
+++ b/chrome/browser/ui/webui/version/version_handler.cc
@@ -40,16 +40,18 @@
base::FilePath executable_path = base::MakeAbsoluteFilePath(
base::CommandLine::ForCurrentProcess()->GetProgram());
- if (!executable_path.empty())
+ if (!executable_path.empty()) {
*exec_path_out = executable_path.LossyDisplayName();
- else
+ } else {
*exec_path_out = l10n_util::GetStringUTF16(IDS_VERSION_UI_PATH_NOTFOUND);
+ }
base::FilePath profile_path_copy(base::MakeAbsoluteFilePath(profile_path));
- if (!profile_path.empty() && !profile_path_copy.empty())
+ if (!profile_path.empty() && !profile_path_copy.empty()) {
*profile_path_out = profile_path.LossyDisplayName();
- else
+ } else {
*profile_path_out = l10n_util::GetStringUTF16(IDS_VERSION_UI_PATH_NOTFOUND);
+ }
}
} // namespace
diff --git a/chrome/browser/ui/webui/version/version_ui.cc b/chrome/browser/ui/webui/version/version_ui.cc
index e9bdbe3..57ccd5e9d 100644
--- a/chrome/browser/ui/webui/version/version_ui.cc
+++ b/chrome/browser/ui/webui/version/version_ui.cc
@@ -269,8 +269,9 @@
std::string command_line;
typedef std::vector<std::string> ArgvList;
const ArgvList& argv = base::CommandLine::ForCurrentProcess()->argv();
- for (auto iter = argv.begin(); iter != argv.end(); iter++)
+ for (auto iter = argv.begin(); iter != argv.end(); iter++) {
command_line += " " + *iter;
+ }
// TODO(viettrungluu): |command_line| could really have any encoding, whereas
// below we assumes it's UTF-8.
html_source->AddString(version_ui::kCommandLine, command_line);
diff --git a/chrome/browser/ui/webui/version/version_util_win.cc b/chrome/browser/ui/webui/version/version_util_win.cc
index a14328e..ce37afa 100644
--- a/chrome/browser/ui/webui/version/version_util_win.cc
+++ b/chrome/browser/ui/webui/version/version_util_win.cc
@@ -72,13 +72,15 @@
const std::string release_id = gi->release_id();
- if (!release_id.empty())
+ if (!release_id.empty()) {
version += " Version " + release_id;
+ }
- if (patch > 0)
+ if (patch > 0) {
version += base::StringPrintf(" (Build %u.%u)", build, patch);
- else
+ } else {
version += base::StringPrintf(" (Build %u)", build);
+ }
return version;
}
diff --git a/chrome/browser/ui/webui/version/version_util_win.h b/chrome/browser/ui/webui/version/version_util_win.h
index a53b40f..19263a97 100644
--- a/chrome/browser/ui/webui/version/version_util_win.h
+++ b/chrome/browser/ui/webui/version/version_util_win.h
@@ -7,7 +7,6 @@
#include <string>
-
namespace version_utils {
namespace win {
diff --git a/chrome/browser/ui/webui/web_app_internals/iwa_internals_handler.cc b/chrome/browser/ui/webui/web_app_internals/iwa_internals_handler.cc
index 169c326..8f6c99d 100644
--- a/chrome/browser/ui/webui/web_app_internals/iwa_internals_handler.cc
+++ b/chrome/browser/ui/webui/web_app_internals/iwa_internals_handler.cc
@@ -618,7 +618,8 @@
return;
}
- RETURN_IF_ERROR(GetIsolatedWebAppById(provider->registrar_unsafe(), app_id), [&](auto) { std::move(callback).Run(/*success=*/false); });
+ RETURN_IF_ERROR(GetIsolatedWebAppById(provider->registrar_unsafe(), app_id),
+ [&](auto) { std::move(callback).Run(/*success=*/false); });
base::Version version = base::Version(pinned_version);
if (!version.IsValid()) {
diff --git a/chrome/browser/ui/webui/web_dialog_web_contents_delegate_unittest.cc b/chrome/browser/ui/webui/web_dialog_web_contents_delegate_unittest.cc
index 267dd770..4348c7a 100644
--- a/chrome/browser/ui/webui/web_dialog_web_contents_delegate_unittest.cc
+++ b/chrome/browser/ui/webui/web_dialog_web_contents_delegate_unittest.cc
@@ -24,9 +24,9 @@
#include "ui/gfx/geometry/rect.h"
#include "url/gurl.h"
+using content::BrowserContext;
using content::OpenURLParams;
using content::Referrer;
-using content::BrowserContext;
using content::WebContents;
using content::WebContentsTester;
using ui::WebDialogWebContentsDelegate;
diff --git a/chrome/browser/ui/webui/webapks/webapks_handler.cc b/chrome/browser/ui/webui/webapks/webapks_handler.cc
index 8f8e080..527546e 100644
--- a/chrome/browser/ui/webui/webapks/webapks_handler.cc
+++ b/chrome/browser/ui/webui/webapks/webapks_handler.cc
@@ -39,14 +39,16 @@
void WebApksHandler::HandleRequestWebApkUpdate(const base::Value::List& args) {
AllowJavascript();
for (const auto& val : args) {
- if (val.is_string())
+ if (val.is_string()) {
ShortcutHelper::SetForceWebApkUpdate(val.GetString());
+ }
}
}
void WebApksHandler::OnWebApkInfoRetrieved(const WebApkInfo& webapk_info) {
- if (!IsJavascriptAllowed())
+ if (!IsJavascriptAllowed()) {
return;
+ }
base::Value::Dict result;
result.Set("name", webapk_info.name);
result.Set("shortName", webapk_info.short_name);
diff --git a/chrome/browser/ui/webui/webui_allowlist_provider_unittest.cc b/chrome/browser/ui/webui/webui_allowlist_provider_unittest.cc
index 5139b084..99ff3bb5 100644
--- a/chrome/browser/ui/webui/webui_allowlist_provider_unittest.cc
+++ b/chrome/browser/ui/webui/webui_allowlist_provider_unittest.cc
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "ui/webui/webui_allowlist_provider.h"
+
#include <map>
#include <memory>
@@ -23,7 +25,6 @@
#include "net/cookies/site_for_cookies.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "ui/webui/webui_allowlist.h"
-#include "ui/webui/webui_allowlist_provider.h"
#include "url/origin.h"
using ::testing::_;
diff --git a/chrome/browser/ui/webui/webui_gallery/webui_gallery_ui.cc b/chrome/browser/ui/webui/webui_gallery/webui_gallery_ui.cc
index be04123..b65f7f7 100644
--- a/chrome/browser/ui/webui/webui_gallery/webui_gallery_ui.cc
+++ b/chrome/browser/ui/webui/webui_gallery/webui_gallery_ui.cc
@@ -27,10 +27,8 @@
content::WebUIDataSource* source = content::WebUIDataSource::CreateAndAdd(
profile, chrome::kChromeUIWebuiGalleryHost);
- webui::SetupWebUIDataSource(
- source,
- base::span(kWebuiGalleryResources),
- IDR_WEBUI_GALLERY_WEBUI_GALLERY_HTML);
+ webui::SetupWebUIDataSource(source, base::span(kWebuiGalleryResources),
+ IDR_WEBUI_GALLERY_WEBUI_GALLERY_HTML);
source->OverrideContentSecurityPolicy(
network::mojom::CSPDirectiveName::FrameSrc, "frame-src 'self';");
diff --git a/chrome/browser/ui/webui/webui_load_timer.cc b/chrome/browser/ui/webui/webui_load_timer.cc
index 4099daa..c5932977 100644
--- a/chrome/browser/ui/webui/webui_load_timer.cc
+++ b/chrome/browser/ui/webui/webui_load_timer.cc
@@ -49,8 +49,9 @@
void WebuiLoadTimer::DOMContentLoaded(
content::RenderFrameHost* render_frame_host) {
// See comment in DocumentOnLoadCompletedInPrimaryMainFrame.
- if (!timer_ || !render_frame_host->IsInPrimaryMainFrame())
+ if (!timer_ || !render_frame_host->IsInPrimaryMainFrame()) {
return;
+ }
CallUmaHistogramTimes(document_initial_load_uma_id_, timer_->Elapsed());
}
@@ -58,8 +59,9 @@
// The WebContents could have been created for a child RenderFrameHost so it
// would never receive a DidStartNavigation with the main frame, however it
// will receive this callback.
- if (!timer_)
+ if (!timer_) {
return;
+ }
CallUmaHistogramTimes(document_load_completed_uma_id_, timer_->Elapsed());
timer_.reset();
}
diff --git a/chrome/browser/ui/webui/webui_url_hashes_browsertest.cc b/chrome/browser/ui/webui/webui_url_hashes_browsertest.cc
index f21725ec..4fe1bb17 100644
--- a/chrome/browser/ui/webui/webui_url_hashes_browsertest.cc
+++ b/chrome/browser/ui/webui/webui_url_hashes_browsertest.cc
@@ -2,11 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "chrome/browser/ui/webui/webui_url_hashes.h"
+
#include "base/hash/hash.h"
#include "base/metrics/histogram_base.h"
#include "base/strings/strcat.h"
#include "base/strings/string_number_conversions.h"
-#include "chrome/browser/ui/webui/webui_url_hashes.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "content/public/browser/webui_config_map.h"
#include "content/public/test/browser_test.h"
diff --git a/chrome/browser/ui/webui/whats_new/whats_new_ui.cc b/chrome/browser/ui/webui/whats_new/whats_new_ui.cc
index 820f3174..bcc11ca 100644
--- a/chrome/browser/ui/webui/whats_new/whats_new_ui.cc
+++ b/chrome/browser/ui/webui/whats_new/whats_new_ui.cc
@@ -124,8 +124,9 @@
void WhatsNewUI::BindInterface(
mojo::PendingReceiver<browser_command::mojom::CommandHandlerFactory>
pending_receiver) {
- if (browser_command_factory_receiver_.is_bound())
+ if (browser_command_factory_receiver_.is_bound()) {
browser_command_factory_receiver_.reset();
+ }
browser_command_factory_receiver_.Bind(std::move(pending_receiver));
}