Fix some instances of -Wshadow.
Bug: 794619
Change-Id: I5eb6a4ac0072e61c7638e6cacd402a86bb1a9354
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3152198
Auto-Submit: Peter Kasting <[email protected]>
Reviewed-by: Lei Zhang <[email protected]>
Commit-Queue: Peter Kasting <[email protected]>
Cr-Commit-Position: refs/heads/main@{#922539}
diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm
index 8dd911f..97749b5 100644
--- a/chrome/browser/app_controller_mac.mm
+++ b/chrome/browser/app_controller_mac.mm
@@ -1730,7 +1730,7 @@
return dockMenu;
if (IncognitoModePrefs::GetAvailability(profile->GetPrefs()) !=
- IncognitoModePrefs::DISABLED) {
+ IncognitoModePrefs::Availability::kDisabled) {
titleStr = l10n_util::GetNSStringWithFixup(IDS_NEW_INCOGNITO_WINDOW_MAC);
item.reset(
[[NSMenuItem alloc] initWithTitle:titleStr
diff --git a/chrome/browser/app_controller_mac_browsertest.mm b/chrome/browser/app_controller_mac_browsertest.mm
index 5f7eaaeb..daa7e25 100644
--- a/chrome/browser/app_controller_mac_browsertest.mm
+++ b/chrome/browser/app_controller_mac_browsertest.mm
@@ -1043,8 +1043,8 @@
ui_test_utils::WaitForBrowserToClose();
EXPECT_TRUE(BrowserList::GetInstance()->empty());
// Force incognito mode.
- IncognitoModePrefs::SetAvailability(profile->GetPrefs(),
- IncognitoModePrefs::FORCED);
+ IncognitoModePrefs::SetAvailability(
+ profile->GetPrefs(), IncognitoModePrefs::Availability::kForced);
// Simulate click on "New window".
ui_test_utils::BrowserChangeObserver browser_added_observer(
nullptr, ui_test_utils::BrowserChangeObserver::ChangeType::kAdded);
diff --git a/chrome/browser/apps/app_service/menu_util.cc b/chrome/browser/apps/app_service/menu_util.cc
index f569812..f96f2d7 100644
--- a/chrome/browser/apps/app_service/menu_util.cc
+++ b/chrome/browser/apps/app_service/menu_util.cc
@@ -242,7 +242,7 @@
// "Normal" windows are not allowed when incognito is enforced.
if (IncognitoModePrefs::GetAvailability(profile->GetPrefs()) !=
- IncognitoModePrefs::FORCED) {
+ IncognitoModePrefs::Availability::kForced) {
AddCommandItem((menu_type == mojom::MenuType::kAppList)
? ash::APP_CONTEXT_MENU_NEW_WINDOW
: ash::MENU_NEW_WINDOW,
@@ -252,7 +252,7 @@
// Incognito windows are not allowed when incognito is disabled.
if (!profile->IsOffTheRecord() &&
IncognitoModePrefs::GetAvailability(profile->GetPrefs()) !=
- IncognitoModePrefs::DISABLED) {
+ IncognitoModePrefs::Availability::kDisabled) {
AddCommandItem((menu_type == mojom::MenuType::kAppList)
? ash::APP_CONTEXT_MENU_NEW_INCOGNITO_WINDOW
: ash::MENU_NEW_INCOGNITO_WINDOW,
diff --git a/chrome/browser/autocomplete/chrome_autocomplete_provider_client.cc b/chrome/browser/autocomplete/chrome_autocomplete_provider_client.cc
index 80cccb4..94c0f6d 100644
--- a/chrome/browser/autocomplete/chrome_autocomplete_provider_client.cc
+++ b/chrome/browser/autocomplete/chrome_autocomplete_provider_client.cc
@@ -513,7 +513,7 @@
return false;
}
return IncognitoModePrefs::GetAvailability(profile_->GetPrefs()) !=
- IncognitoModePrefs::DISABLED;
+ IncognitoModePrefs::Availability::kDisabled;
}
bool ChromeAutocompleteProviderClient::IsSharingHubAvailable() const {
diff --git a/chrome/browser/extensions/api/developer_private/developer_private_api.cc b/chrome/browser/extensions/api/developer_private/developer_private_api.cc
index 1ae5b7f..2ff54a47 100644
--- a/chrome/browser/extensions/api/developer_private/developer_private_api.cc
+++ b/chrome/browser/extensions/api/developer_private/developer_private_api.cc
@@ -311,7 +311,7 @@
const PrefService::Preference* pref =
prefs->FindPreference(prefs::kExtensionsUIDeveloperMode);
info->is_incognito_available = IncognitoModePrefs::GetAvailability(prefs) !=
- IncognitoModePrefs::DISABLED;
+ IncognitoModePrefs::Availability::kDisabled;
info->is_developer_mode_controlled_by_policy = pref->IsManaged();
info->in_developer_mode =
!info->is_supervised &&
diff --git a/chrome/browser/extensions/api/tabs/tabs_api.cc b/chrome/browser/extensions/api/tabs/tabs_api.cc
index d0043b13..c5fa4d76 100644
--- a/chrome/browser/extensions/api/tabs/tabs_api.cc
+++ b/chrome/browser/extensions/api/tabs/tabs_api.cc
@@ -493,15 +493,18 @@
bool incognito = false;
if (create_data && create_data->incognito) {
incognito = *create_data->incognito;
- if (incognito && incognito_availability == IncognitoModePrefs::DISABLED) {
+ if (incognito &&
+ incognito_availability == IncognitoModePrefs::Availability::kDisabled) {
*error = tabs_constants::kIncognitoModeIsDisabled;
return false;
}
- if (!incognito && incognito_availability == IncognitoModePrefs::FORCED) {
+ if (!incognito &&
+ incognito_availability == IncognitoModePrefs::Availability::kForced) {
*error = tabs_constants::kIncognitoModeIsForced;
return false;
}
- } else if (incognito_availability == IncognitoModePrefs::FORCED) {
+ } else if (incognito_availability ==
+ IncognitoModePrefs::Availability::kForced) {
// If incognito argument is not specified explicitly, we default to
// incognito when forced so by policy.
incognito = true;
diff --git a/chrome/browser/extensions/api/tabs/tabs_test.cc b/chrome/browser/extensions/api/tabs/tabs_test.cc
index 33413f24..5a376b6f 100644
--- a/chrome/browser/extensions/api/tabs/tabs_test.cc
+++ b/chrome/browser/extensions/api/tabs/tabs_test.cc
@@ -477,8 +477,9 @@
static const char kArgsWithoutExplicitIncognitoParam[] =
"[{\"url\": \"about:blank\"}]";
// Force Incognito mode.
- IncognitoModePrefs::SetAvailability(browser()->profile()->GetPrefs(),
- IncognitoModePrefs::FORCED);
+ IncognitoModePrefs::SetAvailability(
+ browser()->profile()->GetPrefs(),
+ IncognitoModePrefs::Availability::kForced);
// Run without an explicit "incognito" param.
scoped_refptr<WindowsCreateFunction> function(new WindowsCreateFunction());
function->SetRenderFrameHost(
@@ -517,8 +518,9 @@
DefaultToIncognitoWhenItIsForcedAndNoArgs) {
static const char kEmptyArgs[] = "[]";
// Force Incognito mode.
- IncognitoModePrefs::SetAvailability(browser()->profile()->GetPrefs(),
- IncognitoModePrefs::FORCED);
+ IncognitoModePrefs::SetAvailability(
+ browser()->profile()->GetPrefs(),
+ IncognitoModePrefs::Availability::kForced);
// Run without an explicit "incognito" param.
scoped_refptr<WindowsCreateFunction> function = new WindowsCreateFunction();
scoped_refptr<const Extension> extension(ExtensionBuilder("Test").Build());
@@ -554,8 +556,9 @@
static const char kArgsWithExplicitIncognitoParam[] =
"[{\"url\": \"about:blank\", \"incognito\": false }]";
// Force Incognito mode.
- IncognitoModePrefs::SetAvailability(browser()->profile()->GetPrefs(),
- IncognitoModePrefs::FORCED);
+ IncognitoModePrefs::SetAvailability(
+ browser()->profile()->GetPrefs(),
+ IncognitoModePrefs::Availability::kForced);
// Run with an explicit "incognito" param.
scoped_refptr<WindowsCreateFunction> function = new WindowsCreateFunction();
@@ -584,8 +587,9 @@
Browser* incognito_browser = CreateIncognitoBrowser();
// Disable Incognito mode.
- IncognitoModePrefs::SetAvailability(browser()->profile()->GetPrefs(),
- IncognitoModePrefs::DISABLED);
+ IncognitoModePrefs::SetAvailability(
+ browser()->profile()->GetPrefs(),
+ IncognitoModePrefs::Availability::kDisabled);
// Run in normal window.
scoped_refptr<WindowsCreateFunction> function = new WindowsCreateFunction();
scoped_refptr<const Extension> extension(ExtensionBuilder("Test").Build());
diff --git a/chrome/browser/extensions/extension_tabs_apitest.cc b/chrome/browser/extensions/extension_tabs_apitest.cc
index d9e5f17..9a30aab 100644
--- a/chrome/browser/extensions/extension_tabs_apitest.cc
+++ b/chrome/browser/extensions/extension_tabs_apitest.cc
@@ -330,8 +330,9 @@
}
IN_PROC_BROWSER_TEST_F(ExtensionApiTabTest, IncognitoDisabledByPref) {
- IncognitoModePrefs::SetAvailability(browser()->profile()->GetPrefs(),
- IncognitoModePrefs::DISABLED);
+ IncognitoModePrefs::SetAvailability(
+ browser()->profile()->GetPrefs(),
+ IncognitoModePrefs::Availability::kDisabled);
// This makes sure that creating an incognito window fails due to pref
// (policy) being set.
diff --git a/chrome/browser/incognito/android/incognito_utils_android.cc b/chrome/browser/incognito/android/incognito_utils_android.cc
index 203519c..39bb5ba 100644
--- a/chrome/browser/incognito/android/incognito_utils_android.cc
+++ b/chrome/browser/incognito/android/incognito_utils_android.cc
@@ -15,10 +15,11 @@
ProfileManager::GetActiveUserProfile()->GetOriginalProfile()->GetPrefs();
IncognitoModePrefs::Availability incognito_pref =
IncognitoModePrefs::GetAvailability(prefs);
- DCHECK(incognito_pref == IncognitoModePrefs::ENABLED ||
- incognito_pref == IncognitoModePrefs::DISABLED)
- << "Unsupported incognito mode preference: " << incognito_pref;
- return incognito_pref != IncognitoModePrefs::DISABLED;
+ DCHECK(incognito_pref == IncognitoModePrefs::Availability::kEnabled ||
+ incognito_pref == IncognitoModePrefs::Availability::kDisabled)
+ << "Unsupported incognito mode preference: "
+ << static_cast<int>(incognito_pref);
+ return incognito_pref != IncognitoModePrefs::Availability::kDisabled;
}
static jboolean JNI_IncognitoUtils_GetIncognitoModeManaged(JNIEnv* env) {
diff --git a/chrome/browser/page_load_metrics/page_load_metrics_browsertest.cc b/chrome/browser/page_load_metrics/page_load_metrics_browsertest.cc
index 92bb548..84356930 100644
--- a/chrome/browser/page_load_metrics/page_load_metrics_browsertest.cc
+++ b/chrome/browser/page_load_metrics/page_load_metrics_browsertest.cc
@@ -664,7 +664,6 @@
ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url));
NavigateToUntrackedUrl();
- using PageLoad = ukm::builders::PageLoad;
auto entries =
test_ukm_recorder_->GetMergedEntriesByName(PageLoad::kEntryName);
EXPECT_EQ(1u, entries.size());
diff --git a/chrome/browser/password_manager/chrome_password_manager_client_unittest.cc b/chrome/browser/password_manager/chrome_password_manager_client_unittest.cc
index f01e629..55330dbb 100644
--- a/chrome/browser/password_manager/chrome_password_manager_client_unittest.cc
+++ b/chrome/browser/password_manager/chrome_password_manager_client_unittest.cc
@@ -484,7 +484,7 @@
const char* scheme;
bool password_manager_works;
};
-const SchemeTestCase kTestCases[] = {
+const SchemeTestCase kSchemeTestCases[] = {
{url::kHttpScheme, true},
{url::kHttpsScheme, true},
{url::kFtpScheme, true},
@@ -505,7 +505,7 @@
public:
static std::vector<const char*> GetSchemes() {
std::vector<const char*> result;
- for (const SchemeTestCase& test_case : kTestCases) {
+ for (const SchemeTestCase& test_case : kSchemeTestCases) {
result.push_back(test_case.scheme);
}
return result;
@@ -521,9 +521,9 @@
GetClient()->GetLastCommittedOrigin().GetURL());
auto* it = std::find_if(
- std::begin(kTestCases), std::end(kTestCases),
+ std::begin(kSchemeTestCases), std::end(kSchemeTestCases),
[](auto test_case) { return strcmp(test_case.scheme, GetParam()) == 0; });
- ASSERT_FALSE(it == std::end(kTestCases));
+ ASSERT_FALSE(it == std::end(kSchemeTestCases));
EXPECT_EQ(it->password_manager_works,
GetClient()->IsSavingAndFillingEnabled(url));
EXPECT_EQ(it->password_manager_works, GetClient()->IsFillingEnabled(url));
diff --git a/chrome/browser/permissions/contextual_notification_permission_ui_selector_unittest.cc b/chrome/browser/permissions/contextual_notification_permission_ui_selector_unittest.cc
index ad99257bc..9549399 100644
--- a/chrome/browser/permissions/contextual_notification_permission_ui_selector_unittest.cc
+++ b/chrome/browser/permissions/contextual_notification_permission_ui_selector_unittest.cc
@@ -37,7 +37,6 @@
using QuietUiReason = ContextualNotificationPermissionUiSelector::QuietUiReason;
using WarningReason = ContextualNotificationPermissionUiSelector::WarningReason;
using Decision = ContextualNotificationPermissionUiSelector::Decision;
-using SiteReputation = chrome_browser_crowd_deny::SiteReputation;
constexpr char kTestDomainUnknown[] = "unknown.com";
constexpr char kTestDomainAcceptable[] = "acceptable.com";
diff --git a/chrome/browser/plugins/plugin_finder_unittest.cc b/chrome/browser/plugins/plugin_finder_unittest.cc
index 9dc8222..893a4c8 100644
--- a/chrome/browser/plugins/plugin_finder_unittest.cc
+++ b/chrome/browser/plugins/plugin_finder_unittest.cc
@@ -57,9 +57,9 @@
if (!plugin->GetList("versions", &versions))
continue;
- for (const auto& version : versions->GetList()) {
+ for (const auto& version_value : versions->GetList()) {
const base::DictionaryValue* version_dict = nullptr;
- ASSERT_TRUE(version.GetAsDictionary(&version_dict));
+ ASSERT_TRUE(version_value.GetAsDictionary(&version_dict));
EXPECT_TRUE(version_dict->GetString("version", &dummy_str));
std::string status_str;
EXPECT_TRUE(version_dict->GetString("status", &status_str));
diff --git a/chrome/browser/plugins/plugin_installer.cc b/chrome/browser/plugins/plugin_installer.cc
index 5f0a30f..1f159dc 100644
--- a/chrome/browser/plugins/plugin_installer.cc
+++ b/chrome/browser/plugins/plugin_installer.cc
@@ -28,8 +28,8 @@
strong_observer_count_--;
observers_.RemoveObserver(observer);
if (strong_observer_count_ == 0) {
- for (WeakPluginInstallerObserver& observer : weak_observers_)
- observer.OnlyWeakObserversLeft();
+ for (WeakPluginInstallerObserver& weak_observer : weak_observers_)
+ weak_observer.OnlyWeakObserversLeft();
}
}
diff --git a/chrome/browser/predictors/autocomplete_action_predictor.cc b/chrome/browser/predictors/autocomplete_action_predictor.cc
index 7557bb0..9bd0fe94 100644
--- a/chrome/browser/predictors/autocomplete_action_predictor.cc
+++ b/chrome/browser/predictors/autocomplete_action_predictor.cc
@@ -262,18 +262,18 @@
std::vector<AutocompleteActionPredictorTable::Row> rows_to_add;
std::vector<AutocompleteActionPredictorTable::Row> rows_to_update;
- for (const TransitionalMatch& match : transitional_matches_) {
- if (!base::StartsWith(lower_user_text, match.user_text,
+ for (const TransitionalMatch& transitional_match : transitional_matches_) {
+ if (!base::StartsWith(lower_user_text, transitional_match.user_text,
base::CompareCase::SENSITIVE))
continue;
- DCHECK_GE(match.user_text.length(), kMinimumUserTextLength);
- DCHECK_LE(match.user_text.length(), kMaximumStringLength);
+ DCHECK_GE(transitional_match.user_text.length(), kMinimumUserTextLength);
+ DCHECK_LE(transitional_match.user_text.length(), kMaximumStringLength);
// Add entries to the database for those matches.
- for (const GURL& url : match.urls) {
+ for (const GURL& url : transitional_match.urls) {
DCHECK_LE(url.spec().length(), kMaximumStringLength);
- const DBCacheKey key = {match.user_text, url};
+ const DBCacheKey key = {transitional_match.user_text, url};
const bool is_hit = (url == opened_url);
AutocompleteActionPredictorTable::Row row;
diff --git a/chrome/browser/predictors/loading_predictor_browsertest.cc b/chrome/browser/predictors/loading_predictor_browsertest.cc
index 350b05e..044e744c 100644
--- a/chrome/browser/predictors/loading_predictor_browsertest.cc
+++ b/chrome/browser/predictors/loading_predictor_browsertest.cc
@@ -863,11 +863,11 @@
auto observer = NavigateToURLAsync(url);
EXPECT_TRUE(observer->WaitForRequestStart());
for (auto* const host : kHtmlSubresourcesHosts) {
- GURL url(base::StringPrintf("http://%s", host));
- preconnect_manager_observer()->WaitUntilHostLookedUp(url.host(),
+ GURL host_url(base::StringPrintf("http://%s", host));
+ preconnect_manager_observer()->WaitUntilHostLookedUp(host_url.host(),
network_isolation_key);
EXPECT_TRUE(preconnect_manager_observer()->HostFound(
- url.host(), network_isolation_key));
+ host_url.host(), network_isolation_key));
}
// 2 connections to the main frame host + 1 connection per host for others.
const size_t expected_connections = base::size(kHtmlSubresourcesHosts) + 1;
@@ -1441,11 +1441,11 @@
auto observer = NavigateToURLAsync(url);
EXPECT_TRUE(observer->WaitForRequestStart());
for (auto* const host : kHtmlSubresourcesHosts) {
- GURL url = embedded_test_server()->GetURL(host, "/");
+ GURL host_url = embedded_test_server()->GetURL(host, "/");
preconnect_manager_observer()->WaitUntilProxyLookedUp(
- url, network_isolation_key);
- EXPECT_TRUE(
- preconnect_manager_observer()->ProxyFound(url, network_isolation_key));
+ host_url, network_isolation_key);
+ EXPECT_TRUE(preconnect_manager_observer()->ProxyFound(
+ host_url, network_isolation_key));
}
// 2 connections to the main frame host + 1 connection per host for others.
const size_t expected_connections = base::size(kHtmlSubresourcesHosts) + 1;
diff --git a/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_browsertest.cc b/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_browsertest.cc
index 169e84e..79db29c 100644
--- a/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_browsertest.cc
+++ b/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_browsertest.cc
@@ -1536,8 +1536,6 @@
ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), starting_page));
WaitForUpdatedCustomProxyConfig();
- base::HistogramTester histogram_tester;
-
PrefetchProxyTabHelper* tab_helper =
PrefetchProxyTabHelper::FromWebContents(GetWebContents());
diff --git a/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_proxying_url_loader_factory.cc b/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_proxying_url_loader_factory.cc
index 2178d482..4368fcf 100644
--- a/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_proxying_url_loader_factory.cc
+++ b/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_proxying_url_loader_factory.cc
@@ -74,8 +74,8 @@
// Once no more callbacks reference the given arguments, they will all be
// cleaned up and |callback| will be destroyed, never having been run,,
if (success_count->count() == resources.size()) {
- for (const GURL& url : resources) {
- callback.Run(url);
+ for (const GURL& resource_url : resources) {
+ callback.Run(resource_url);
}
}
}
@@ -378,10 +378,10 @@
// Do not allow insecure resources to be fetched due to risk of privacy
// leaks in an HSTS setting.
if (!request.url.SchemeIs(url::kHttpsScheme)) {
- std::unique_ptr<AbortRequest> request = std::make_unique<AbortRequest>(
+ auto abort_request = std::make_unique<AbortRequest>(
std::move(loader_receiver), std::move(client));
// The request will manage its own lifecycle based on the mojo pipes.
- request.release();
+ abort_request.release();
return;
}
@@ -389,10 +389,10 @@
request_count_++;
if (request_count_ > PrefetchProxyMaxSubresourcesPerPrerender()) {
metrics_observer_->OnResourceThrottled(request.url);
- std::unique_ptr<AbortRequest> request = std::make_unique<AbortRequest>(
+ auto abort_request = std::make_unique<AbortRequest>(
std::move(loader_receiver), std::move(client));
// The request will manage its own lifecycle based on the mojo pipes.
- request.release();
+ abort_request.release();
return;
}
@@ -402,10 +402,10 @@
if (prefetch_proxy_service && !prefetch_proxy_service->proxy_configurator()
->IsPrefetchProxyAvailable()) {
metrics_observer_->OnProxyUnavailableForResource(request.url);
- std::unique_ptr<AbortRequest> request = std::make_unique<AbortRequest>(
+ auto abort_request = std::make_unique<AbortRequest>(
std::move(loader_receiver), std::move(client));
// The request will manage its own lifecycle based on the mojo pipes.
- request.release();
+ abort_request.release();
return;
}
diff --git a/chrome/browser/prefs/incognito_mode_prefs.cc b/chrome/browser/prefs/incognito_mode_prefs.cc
index 7e4b25dd..07280df8 100644
--- a/chrome/browser/prefs/incognito_mode_prefs.cc
+++ b/chrome/browser/prefs/incognito_mode_prefs.cc
@@ -36,7 +36,7 @@
// static
bool IncognitoModePrefs::IntToAvailability(int in_value,
Availability* out_value) {
- if (in_value < 0 || in_value >= AVAILABILITY_NUM_TYPES) {
+ if (in_value < 0 || in_value >= static_cast<int>(Availability::kNumTypes)) {
*out_value = kDefaultAvailability;
return false;
}
@@ -53,14 +53,15 @@
// static
void IncognitoModePrefs::SetAvailability(PrefService* prefs,
const Availability availability) {
- prefs->SetInteger(prefs::kIncognitoModeAvailability, availability);
+ prefs->SetInteger(prefs::kIncognitoModeAvailability,
+ static_cast<int>(availability));
}
// static
void IncognitoModePrefs::RegisterProfilePrefs(
user_prefs::PrefRegistrySyncable* registry) {
registry->RegisterIntegerPref(prefs::kIncognitoModeAvailability,
- kDefaultAvailability);
+ static_cast<int>(kDefaultAvailability));
}
// static
@@ -74,7 +75,7 @@
bool should_use_incognito =
command_line.HasSwitch(switches::kIncognito) ||
GetAvailabilityInternal(prefs, DONT_CHECK_PARENTAL_CONTROLS) ==
- IncognitoModePrefs::FORCED;
+ IncognitoModePrefs::Availability::kForced;
#if BUILDFLAG(IS_CHROMEOS_LACROS)
auto* init_params = chromeos::LacrosService::Get()->init_params();
// TODO(https://crbug.com/1194304): Remove in M93.
@@ -85,19 +86,19 @@
#endif
return should_use_incognito &&
GetAvailabilityInternal(prefs, CHECK_PARENTAL_CONTROLS) !=
- IncognitoModePrefs::DISABLED;
+ IncognitoModePrefs::Availability::kDisabled;
}
// static
bool IncognitoModePrefs::CanOpenBrowser(Profile* profile) {
switch (GetAvailability(profile->GetPrefs())) {
- case IncognitoModePrefs::ENABLED:
+ case IncognitoModePrefs::Availability::kEnabled:
return true;
- case IncognitoModePrefs::DISABLED:
+ case IncognitoModePrefs::Availability::kDisabled:
return !profile->IsIncognitoProfile();
- case IncognitoModePrefs::FORCED:
+ case IncognitoModePrefs::Availability::kForced:
return profile->IsIncognitoProfile();
default:
@@ -126,11 +127,11 @@
Availability result = kDefaultAvailability;
bool valid = IntToAvailability(pref_value, &result);
DCHECK(valid);
- if (result != IncognitoModePrefs::DISABLED &&
+ if (result != IncognitoModePrefs::Availability::kDisabled &&
mode == CHECK_PARENTAL_CONTROLS && ArePlatformParentalControlsEnabled()) {
- if (result == IncognitoModePrefs::FORCED)
+ if (result == IncognitoModePrefs::Availability::kForced)
LOG(ERROR) << "Ignoring FORCED incognito. Parental control logging on";
- return IncognitoModePrefs::DISABLED;
+ return IncognitoModePrefs::Availability::kDisabled;
}
return result;
}
diff --git a/chrome/browser/prefs/incognito_mode_prefs.h b/chrome/browser/prefs/incognito_mode_prefs.h
index b80d295..50123c0 100644
--- a/chrome/browser/prefs/incognito_mode_prefs.h
+++ b/chrome/browser/prefs/incognito_mode_prefs.h
@@ -24,21 +24,21 @@
public:
// Possible values for Incognito mode availability. Please, do not change
// the order of entries since numeric values are exposed to users.
- enum Availability {
+ enum class Availability {
// Incognito mode enabled. Users may open pages in both Incognito mode and
// normal mode (usually the default behaviour).
- ENABLED = 0,
+ kEnabled = 0,
// Incognito mode disabled. Users may not open pages in Incognito mode.
// Only normal mode is available for browsing.
- DISABLED,
+ kDisabled,
// Incognito mode forced. Users may open pages *ONLY* in Incognito mode.
// Normal mode is not available for browsing.
- FORCED,
+ kForced,
- AVAILABILITY_NUM_TYPES
+ kNumTypes
};
- static constexpr Availability kDefaultAvailability = ENABLED;
+ static constexpr Availability kDefaultAvailability = Availability::kEnabled;
// Register incognito related preferences.
static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
diff --git a/chrome/browser/prefs/incognito_mode_prefs_unittest.cc b/chrome/browser/prefs/incognito_mode_prefs_unittest.cc
index 0fe41ca..266c9a4 100644
--- a/chrome/browser/prefs/incognito_mode_prefs_unittest.cc
+++ b/chrome/browser/prefs/incognito_mode_prefs_unittest.cc
@@ -19,17 +19,17 @@
};
TEST_F(IncognitoModePrefsTest, IntToAvailability) {
- ASSERT_EQ(0, IncognitoModePrefs::ENABLED);
- ASSERT_EQ(1, IncognitoModePrefs::DISABLED);
- ASSERT_EQ(2, IncognitoModePrefs::FORCED);
+ ASSERT_EQ(0, static_cast<int>(IncognitoModePrefs::Availability::kEnabled));
+ ASSERT_EQ(1, static_cast<int>(IncognitoModePrefs::Availability::kDisabled));
+ ASSERT_EQ(2, static_cast<int>(IncognitoModePrefs::Availability::kForced));
IncognitoModePrefs::Availability incognito;
EXPECT_TRUE(IncognitoModePrefs::IntToAvailability(0, &incognito));
- EXPECT_EQ(IncognitoModePrefs::ENABLED, incognito);
+ EXPECT_EQ(IncognitoModePrefs::Availability::kEnabled, incognito);
EXPECT_TRUE(IncognitoModePrefs::IntToAvailability(1, &incognito));
- EXPECT_EQ(IncognitoModePrefs::DISABLED, incognito);
+ EXPECT_EQ(IncognitoModePrefs::Availability::kDisabled, incognito);
EXPECT_TRUE(IncognitoModePrefs::IntToAvailability(2, &incognito));
- EXPECT_EQ(IncognitoModePrefs::FORCED, incognito);
+ EXPECT_EQ(IncognitoModePrefs::Availability::kForced, incognito);
EXPECT_FALSE(IncognitoModePrefs::IntToAvailability(10, &incognito));
EXPECT_EQ(IncognitoModePrefs::kDefaultAvailability, incognito);
@@ -38,21 +38,22 @@
}
TEST_F(IncognitoModePrefsTest, GetAvailability) {
- prefs_.SetUserPref(
- prefs::kIncognitoModeAvailability,
- std::make_unique<base::Value>(IncognitoModePrefs::ENABLED));
- EXPECT_EQ(IncognitoModePrefs::ENABLED,
- IncognitoModePrefs::GetAvailability(&prefs_));
-
- prefs_.SetUserPref(
- prefs::kIncognitoModeAvailability,
- std::make_unique<base::Value>(IncognitoModePrefs::DISABLED));
- EXPECT_EQ(IncognitoModePrefs::DISABLED,
+ prefs_.SetUserPref(prefs::kIncognitoModeAvailability,
+ std::make_unique<base::Value>(static_cast<int>(
+ IncognitoModePrefs::Availability::kEnabled)));
+ EXPECT_EQ(IncognitoModePrefs::Availability::kEnabled,
IncognitoModePrefs::GetAvailability(&prefs_));
prefs_.SetUserPref(prefs::kIncognitoModeAvailability,
- std::make_unique<base::Value>(IncognitoModePrefs::FORCED));
- EXPECT_EQ(IncognitoModePrefs::FORCED,
+ std::make_unique<base::Value>(static_cast<int>(
+ IncognitoModePrefs::Availability::kDisabled)));
+ EXPECT_EQ(IncognitoModePrefs::Availability::kDisabled,
+ IncognitoModePrefs::GetAvailability(&prefs_));
+
+ prefs_.SetUserPref(prefs::kIncognitoModeAvailability,
+ std::make_unique<base::Value>(static_cast<int>(
+ IncognitoModePrefs::Availability::kForced)));
+ EXPECT_EQ(IncognitoModePrefs::Availability::kForced,
IncognitoModePrefs::GetAvailability(&prefs_));
}
@@ -64,6 +65,6 @@
EXPECT_DCHECK_DEATH({
IncognitoModePrefs::Availability availability =
IncognitoModePrefs::GetAvailability(&prefs_);
- EXPECT_EQ(IncognitoModePrefs::ENABLED, availability);
+ EXPECT_EQ(IncognitoModePrefs::Availability::kEnabled, availability);
});
}
diff --git a/chrome/browser/prefs/tracked/pref_hash_browsertest.cc b/chrome/browser/prefs/tracked/pref_hash_browsertest.cc
index 7c19a7b..72ea1ac 100644
--- a/chrome/browser/prefs/tracked/pref_hash_browsertest.cc
+++ b/chrome/browser/prefs/tracked/pref_hash_browsertest.cc
@@ -364,12 +364,12 @@
EXPECT_EQ(protection_level_ > PROTECTION_DISABLED_ON_PLATFORM,
num_tracked_prefs_ > 0);
- int num_split_tracked_prefs = GetTrackedPrefHistogramCount(
+ int split_tracked_prefs = GetTrackedPrefHistogramCount(
user_prefs::tracked::kTrackedPrefHistogramUnchanged,
user_prefs::tracked::kTrackedPrefRegistryValidationSuffix,
BEGIN_ALLOW_SINGLE_BUCKET + 5);
EXPECT_EQ(protection_level_ > PROTECTION_DISABLED_ON_PLATFORM ? 1 : 0,
- num_split_tracked_prefs);
+ split_tracked_prefs);
}
num_tracked_prefs_ += num_split_tracked_prefs;
diff --git a/chrome/browser/privacy_budget/identifiability_study_state.cc b/chrome/browser/privacy_budget/identifiability_study_state.cc
index bc34228c..ff0a005 100644
--- a/chrome/browser/privacy_budget/identifiability_study_state.cc
+++ b/chrome/browser/privacy_budget/identifiability_study_state.cc
@@ -132,13 +132,13 @@
blink::IdentifiableSurface surface) {
int selection_rate = surface_selection_rate_;
- auto rate_it = per_surface_selection_rates_.find(surface);
- if (rate_it != per_surface_selection_rates_.end()) {
- selection_rate = rate_it->second;
+ auto surface_rate_it = per_surface_selection_rates_.find(surface);
+ if (surface_rate_it != per_surface_selection_rates_.end()) {
+ selection_rate = surface_rate_it->second;
} else {
- auto rate_it = per_type_selection_rates_.find(surface.GetType());
- if (rate_it != per_type_selection_rates_.end())
- selection_rate = rate_it->second;
+ auto type_rate_it = per_type_selection_rates_.find(surface.GetType());
+ if (type_rate_it != per_type_selection_rates_.end())
+ selection_rate = type_rate_it->second;
}
if (selection_rate == 0)
diff --git a/chrome/browser/profile_resetter/profile_resetter_unittest.cc b/chrome/browser/profile_resetter/profile_resetter_unittest.cc
index c0f5e46..0f882404 100644
--- a/chrome/browser/profile_resetter/profile_resetter_unittest.cc
+++ b/chrome/browser/profile_resetter/profile_resetter_unittest.cc
@@ -792,9 +792,9 @@
EXPECT_TRUE(startup_list);
std::vector<std::string> startup_pages;
for (const auto& entry : startup_list->GetList()) {
- std::string url;
- EXPECT_TRUE(entry.GetAsString(&url));
- startup_pages.push_back(url);
+ std::string url_str;
+ EXPECT_TRUE(entry.GetAsString(&url_str));
+ startup_pages.push_back(url_str);
}
ASSERT_EQ(2u, startup_pages.size());
EXPECT_EQ("http://goo.gl", startup_pages[0]);
diff --git a/chrome/browser/profiles/incognito_mode_policy_handler.cc b/chrome/browser/profiles/incognito_mode_policy_handler.cc
index d7091b5..3016892 100644
--- a/chrome/browser/profiles/incognito_mode_policy_handler.cc
+++ b/chrome/browser/profiles/incognito_mode_policy_handler.cc
@@ -78,7 +78,7 @@
IncognitoModePrefs::IntToAvailability(availability->GetInt(),
&availability_enum_value)) {
prefs->SetInteger(prefs::kIncognitoModeAvailability,
- availability_enum_value);
+ static_cast<int>(availability_enum_value));
} else {
NOTREACHED();
}
@@ -86,10 +86,11 @@
// If kIncognitoModeAvailability is not specified, check the obsolete
// kIncognitoEnabled.
if (deprecated_enabled->is_bool()) {
- prefs->SetInteger(prefs::kIncognitoModeAvailability,
- deprecated_enabled->GetBool()
- ? IncognitoModePrefs::ENABLED
- : IncognitoModePrefs::DISABLED);
+ prefs->SetInteger(
+ prefs::kIncognitoModeAvailability,
+ static_cast<int>(deprecated_enabled->GetBool()
+ ? IncognitoModePrefs::Availability::kEnabled
+ : IncognitoModePrefs::Availability::kDisabled));
} else {
NOTREACHED();
}
diff --git a/chrome/browser/profiles/incognito_mode_policy_handler_unittest.cc b/chrome/browser/profiles/incognito_mode_policy_handler_unittest.cc
index fa709d44..fb9baea 100644
--- a/chrome/browser/profiles/incognito_mode_policy_handler_unittest.cc
+++ b/chrome/browser/profiles/incognito_mode_policy_handler_unittest.cc
@@ -51,7 +51,7 @@
void VerifyValues(IncognitoModePrefs::Availability availability) {
const base::Value* value = NULL;
EXPECT_TRUE(store_->GetValue(prefs::kIncognitoModeAvailability, &value));
- EXPECT_TRUE(base::Value(availability).Equals(value));
+ EXPECT_TRUE(base::Value(static_cast<int>(availability)).Equals(value));
}
};
@@ -60,20 +60,23 @@
// from IncognitoModeAvailability policy to pref "as is".
TEST_F(IncognitoModePolicyHandlerTest,
NoObsoletePolicyAndIncognitoEnabled) {
- SetPolicies(INCOGNITO_ENABLED_UNKNOWN, IncognitoModePrefs::ENABLED);
- VerifyValues(IncognitoModePrefs::ENABLED);
+ SetPolicies(INCOGNITO_ENABLED_UNKNOWN,
+ static_cast<int>(IncognitoModePrefs::Availability::kEnabled));
+ VerifyValues(IncognitoModePrefs::Availability::kEnabled);
}
TEST_F(IncognitoModePolicyHandlerTest,
NoObsoletePolicyAndIncognitoDisabled) {
- SetPolicies(INCOGNITO_ENABLED_UNKNOWN, IncognitoModePrefs::DISABLED);
- VerifyValues(IncognitoModePrefs::DISABLED);
+ SetPolicies(INCOGNITO_ENABLED_UNKNOWN,
+ static_cast<int>(IncognitoModePrefs::Availability::kDisabled));
+ VerifyValues(IncognitoModePrefs::Availability::kDisabled);
}
TEST_F(IncognitoModePolicyHandlerTest,
NoObsoletePolicyAndIncognitoForced) {
- SetPolicies(INCOGNITO_ENABLED_UNKNOWN, IncognitoModePrefs::FORCED);
- VerifyValues(IncognitoModePrefs::FORCED);
+ SetPolicies(INCOGNITO_ENABLED_UNKNOWN,
+ static_cast<int>(IncognitoModePrefs::Availability::kForced));
+ VerifyValues(IncognitoModePrefs::Availability::kForced);
}
TEST_F(IncognitoModePolicyHandlerTest,
@@ -88,26 +91,28 @@
// the IncognitoModeAvailability policy is not specified.
TEST_F(IncognitoModePolicyHandlerTest,
ObsoletePolicyDoesNotAffectAvailabilityEnabled) {
- SetPolicies(INCOGNITO_ENABLED_FALSE, IncognitoModePrefs::ENABLED);
- VerifyValues(IncognitoModePrefs::ENABLED);
+ SetPolicies(INCOGNITO_ENABLED_FALSE,
+ static_cast<int>(IncognitoModePrefs::Availability::kEnabled));
+ VerifyValues(IncognitoModePrefs::Availability::kEnabled);
}
TEST_F(IncognitoModePolicyHandlerTest,
ObsoletePolicyDoesNotAffectAvailabilityForced) {
- SetPolicies(INCOGNITO_ENABLED_TRUE, IncognitoModePrefs::FORCED);
- VerifyValues(IncognitoModePrefs::FORCED);
+ SetPolicies(INCOGNITO_ENABLED_TRUE,
+ static_cast<int>(IncognitoModePrefs::Availability::kForced));
+ VerifyValues(IncognitoModePrefs::Availability::kForced);
}
TEST_F(IncognitoModePolicyHandlerTest,
ObsoletePolicySetsPreferenceToEnabled) {
SetPolicies(INCOGNITO_ENABLED_TRUE, kIncognitoModeAvailabilityNotSet);
- VerifyValues(IncognitoModePrefs::ENABLED);
+ VerifyValues(IncognitoModePrefs::Availability::kEnabled);
}
TEST_F(IncognitoModePolicyHandlerTest,
ObsoletePolicySetsPreferenceToDisabled) {
SetPolicies(INCOGNITO_ENABLED_FALSE, kIncognitoModeAvailabilityNotSet);
- VerifyValues(IncognitoModePrefs::DISABLED);
+ VerifyValues(IncognitoModePrefs::Availability::kDisabled);
}
} // namespace policy
diff --git a/chrome/browser/profiles/off_the_record_profile_impl.cc b/chrome/browser/profiles/off_the_record_profile_impl.cc
index 4e76c7a..134bb80 100644
--- a/chrome/browser/profiles/off_the_record_profile_impl.cc
+++ b/chrome/browser/profiles/off_the_record_profile_impl.cc
@@ -180,7 +180,7 @@
// Always crash when incognito is not available.
CHECK(!IsIncognitoProfile() ||
IncognitoModePrefs::GetAvailability(profile_->GetPrefs()) !=
- IncognitoModePrefs::DISABLED);
+ IncognitoModePrefs::Availability::kDisabled);
#if !defined(OS_ANDROID)
TrackZoomLevelsFromParent();
diff --git a/chrome/browser/profiles/profile_attributes_storage_unittest.cc b/chrome/browser/profiles/profile_attributes_storage_unittest.cc
index cda5ae5..57638aa 100644
--- a/chrome/browser/profiles/profile_attributes_storage_unittest.cc
+++ b/chrome/browser/profiles/profile_attributes_storage_unittest.cc
@@ -493,8 +493,9 @@
std::vector<ProfileAttributesEntry*> entries =
storage()->GetAllProfilesAttributes();
- for (auto* entry : entries) {
- EXPECT_NE(GetProfilePath("testing_profile_path0"), entry->GetPath());
+ for (auto* attributes_entry : entries) {
+ EXPECT_NE(GetProfilePath("testing_profile_path0"),
+ attributes_entry->GetPath());
}
}
diff --git a/chrome/browser/profiles/profile_manager.cc b/chrome/browser/profiles/profile_manager.cc
index 2e41cebc..23f9a5c 100644
--- a/chrome/browser/profiles/profile_manager.cc
+++ b/chrome/browser/profiles/profile_manager.cc
@@ -620,10 +620,9 @@
// static
bool ProfileManager::IsOffTheRecordModeForced(Profile* profile) {
- return profile->IsGuestSession() ||
- profile->IsSystemProfile() ||
+ return profile->IsGuestSession() || profile->IsSystemProfile() ||
IncognitoModePrefs::GetAvailability(profile->GetPrefs()) ==
- IncognitoModePrefs::FORCED;
+ IncognitoModePrefs::Availability::kForced;
}
// static
diff --git a/chrome/browser/profiles/profile_manager_unittest.cc b/chrome/browser/profiles/profile_manager_unittest.cc
index ae53dc14..10f5ea1 100644
--- a/chrome/browser/profiles/profile_manager_unittest.cc
+++ b/chrome/browser/profiles/profile_manager_unittest.cc
@@ -1095,13 +1095,15 @@
ASSERT_TRUE(profile->GetPrimaryOTRProfile(/*create_if_needed=*/true));
- IncognitoModePrefs::SetAvailability(prefs, IncognitoModePrefs::DISABLED);
+ IncognitoModePrefs::SetAvailability(
+ prefs, IncognitoModePrefs::Availability::kDisabled);
EXPECT_FALSE(
profile_manager->GetLastUsedProfileAllowedByPolicy()->IsOffTheRecord());
// GetLastUsedProfileAllowedByPolicy() returns the off-the-record Profile when
// incognito mode is forced.
- IncognitoModePrefs::SetAvailability(prefs, IncognitoModePrefs::FORCED);
+ IncognitoModePrefs::SetAvailability(
+ prefs, IncognitoModePrefs::Availability::kForced);
EXPECT_TRUE(
profile_manager->GetLastUsedProfileAllowedByPolicy()->IsOffTheRecord());
}
diff --git a/chrome/browser/push_messaging/budget_database.cc b/chrome/browser/push_messaging/budget_database.cc
index db503c2..ba1bab1 100644
--- a/chrome/browser/push_messaging/budget_database.cc
+++ b/chrome/browser/push_messaging/budget_database.cc
@@ -163,10 +163,12 @@
double total = GetBudget(origin);
// Always add one entry at the front of the list for the total budget now.
- BudgetState prediction;
- prediction.budget_at = total;
- prediction.time = clock_->Now().ToJsTime();
- predictions.push_back(prediction);
+ {
+ BudgetState prediction;
+ prediction.budget_at = total;
+ prediction.time = clock_->Now().ToJsTime();
+ predictions.push_back(prediction);
+ }
// Starting with the soonest expiring chunks, add entries for the
// expiration times going forward.
diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu.cc b/chrome/browser/renderer_context_menu/render_view_context_menu.cc
index daf0c07e..f2dd911 100644
--- a/chrome/browser/renderer_context_menu/render_view_context_menu.cc
+++ b/chrome/browser/renderer_context_menu/render_view_context_menu.cc
@@ -1314,11 +1314,12 @@
std::vector<ProfileAttributesEntry*> target_profiles_entries;
for (ProfileAttributesEntry* entry : entries) {
base::FilePath profile_path = entry->GetPath();
- Profile* profile = profile_manager->GetProfileByPath(profile_path);
- if (profile != GetProfile() && !entry->IsOmitted() &&
+ Profile* profile_for_path =
+ profile_manager->GetProfileByPath(profile_path);
+ if (profile_for_path != GetProfile() && !entry->IsOmitted() &&
!entry->IsSigninRequired()) {
target_profiles_entries.push_back(entry);
- if (chrome::FindLastActiveWithProfile(profile))
+ if (chrome::FindLastActiveWithProfile(profile_for_path))
multiple_profiles_open_ = true;
}
}
@@ -3137,7 +3138,7 @@
IncognitoModePrefs::Availability incognito_avail =
IncognitoModePrefs::GetAvailability(GetPrefs(browser_context_));
- return incognito_avail != IncognitoModePrefs::DISABLED;
+ return incognito_avail != IncognitoModePrefs::Availability::kDisabled;
}
void RenderViewContextMenu::ExecOpenWebApp() {
diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu_unittest.cc b/chrome/browser/renderer_context_menu/render_view_context_menu_unittest.cc
index 049449f..f33720bb8 100644
--- a/chrome/browser/renderer_context_menu/render_view_context_menu_unittest.cc
+++ b/chrome/browser/renderer_context_menu/render_view_context_menu_unittest.cc
@@ -496,8 +496,8 @@
menu->IsCommandIdEnabled(IDC_CONTENT_CONTEXT_OPENLINKOFFTHERECORD));
// Disable Incognito mode.
- IncognitoModePrefs::SetAvailability(profile()->GetPrefs(),
- IncognitoModePrefs::DISABLED);
+ IncognitoModePrefs::SetAvailability(
+ profile()->GetPrefs(), IncognitoModePrefs::Availability::kDisabled);
menu = CreateContextMenu();
ASSERT_TRUE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_OPENLINKOFFTHERECORD));
EXPECT_FALSE(
diff --git a/chrome/browser/resource_coordinator/tab_lifecycle_unit_source.cc b/chrome/browser/resource_coordinator/tab_lifecycle_unit_source.cc
index edac697..94ef9f7 100644
--- a/chrome/browser/resource_coordinator/tab_lifecycle_unit_source.cc
+++ b/chrome/browser/resource_coordinator/tab_lifecycle_unit_source.cc
@@ -228,7 +228,7 @@
holder->set_lifecycle_unit(std::make_unique<TabLifecycleUnit>(
this, &tab_lifecycle_observers_, usage_clock_, contents,
tab_strip_model));
- TabLifecycleUnit* lifecycle_unit = holder->lifecycle_unit();
+ lifecycle_unit = holder->lifecycle_unit();
if (GetFocusedTabStripModel() == tab_strip_model && foreground)
UpdateFocusedTabTo(lifecycle_unit);
diff --git a/chrome/browser/safe_browsing/chrome_cleaner/chrome_prompt_channel_win_unittest.cc b/chrome/browser/safe_browsing/chrome_cleaner/chrome_prompt_channel_win_unittest.cc
index 1432146..b904305 100644
--- a/chrome/browser/safe_browsing/chrome_cleaner/chrome_prompt_channel_win_unittest.cc
+++ b/chrome/browser/safe_browsing/chrome_cleaner/chrome_prompt_channel_win_unittest.cc
@@ -315,8 +315,8 @@
channel_->ConnectToCleaner(std::move(mock_cleaner_process_));
// Invalid version
- constexpr uint8_t kVersion = 128;
- PostWriteByValue(kVersion);
+ constexpr uint8_t kInvalidVersion = 128;
+ PostWriteByValue(kInvalidVersion);
WaitForDisconnect();
// We expect the the handshake to have failed because of the version.
@@ -331,8 +331,8 @@
channel_->ConnectToCleaner(std::move(mock_cleaner_process_));
// Invalid version
- constexpr uint8_t kVersion = 0;
- PostWriteByValue(kVersion);
+ constexpr uint8_t kInvalidVersion = 0;
+ PostWriteByValue(kInvalidVersion);
WaitForDisconnect();
// We expect the the handshake to have failed because of the version.
diff --git a/chrome/browser/safe_browsing/cloud_content_scanning/binary_upload_service.cc b/chrome/browser/safe_browsing/cloud_content_scanning/binary_upload_service.cc
index 913bee1..88d325ae 100644
--- a/chrome/browser/safe_browsing/cloud_content_scanning/binary_upload_service.cc
+++ b/chrome/browser/safe_browsing/cloud_content_scanning/binary_upload_service.cc
@@ -560,17 +560,17 @@
Result result,
const enterprise_connectors::ContentAnalysisResponse& response) {
RecordRequestMetrics(request, result);
- for (const auto& result : response.results()) {
- if (result.tag() == "malware") {
+ for (const auto& response_result : response.results()) {
+ if (response_result.tag() == "malware") {
base::UmaHistogramBoolean(
"SafeBrowsingBinaryUploadRequest.MalwareResult",
- result.status() !=
+ response_result.status() !=
enterprise_connectors::ContentAnalysisResponse::Result::FAILURE);
}
- if (result.tag() == "dlp") {
+ if (response_result.tag() == "dlp") {
base::UmaHistogramBoolean(
"SafeBrowsingBinaryUploadRequest.DlpResult",
- result.status() !=
+ response_result.status() !=
enterprise_connectors::ContentAnalysisResponse::Result::FAILURE);
}
}
diff --git a/chrome/browser/safe_browsing/cloud_content_scanning/deep_scanning_utils.cc b/chrome/browser/safe_browsing/cloud_content_scanning/deep_scanning_utils.cc
index 706d480..1a1356b 100644
--- a/chrome/browser/safe_browsing/cloud_content_scanning/deep_scanning_utils.cc
+++ b/chrome/browser/safe_browsing/cloud_content_scanning/deep_scanning_utils.cc
@@ -152,24 +152,24 @@
if (result != BinaryUploadService::Result::SUCCESS)
return;
- for (const auto& result : response.results()) {
- if (result.status() !=
+ for (const auto& response_result : response.results()) {
+ if (response_result.status() !=
enterprise_connectors::ContentAnalysisResponse::Result::SUCCESS) {
- std::string unscanned_reason = "UNSCANNED_REASON_UNKNOWN";
- if (result.tag() == "malware")
+ unscanned_reason = "UNSCANNED_REASON_UNKNOWN";
+ if (response_result.tag() == "malware")
unscanned_reason = "MALWARE_SCAN_FAILED";
- else if (result.tag() == "dlp")
+ else if (response_result.tag() == "dlp")
unscanned_reason = "DLP_SCAN_FAILED";
router->OnUnscannedFileEvent(url, file_name, download_digest_sha256,
mime_type, trigger, access_point,
std::move(unscanned_reason), content_size,
event_result);
- } else if (result.triggered_rules_size() > 0) {
- router->OnAnalysisConnectorResult(url, file_name, download_digest_sha256,
- mime_type, trigger,
- response.request_token(), access_point,
- result, content_size, event_result);
+ } else if (response_result.triggered_rules_size() > 0) {
+ router->OnAnalysisConnectorResult(
+ url, file_name, download_digest_sha256, mime_type, trigger,
+ response.request_token(), access_point, response_result, content_size,
+ event_result);
}
}
}
@@ -248,14 +248,14 @@
return;
bool dlp_verdict_success = true;
bool malware_verdict_success = true;
- for (const auto& result : response.results()) {
- if (result.tag() == "dlp" &&
- result.status() !=
+ for (const auto& response_result : response.results()) {
+ if (response_result.tag() == "dlp" &&
+ response_result.status() !=
enterprise_connectors::ContentAnalysisResponse::Result::SUCCESS) {
dlp_verdict_success = false;
}
- if (result.tag() == "malware" &&
- result.status() !=
+ if (response_result.tag() == "malware" &&
+ response_result.status() !=
enterprise_connectors::ContentAnalysisResponse::Result::SUCCESS) {
malware_verdict_success = false;
}
diff --git a/chrome/browser/safe_browsing/download_protection/deep_scanning_request.cc b/chrome/browser/safe_browsing/download_protection/deep_scanning_request.cc
index e0b14fc..590633e 100644
--- a/chrome/browser/safe_browsing/download_protection/deep_scanning_request.cc
+++ b/chrome/browser/safe_browsing/download_protection/deep_scanning_request.cc
@@ -566,10 +566,10 @@
if (stored_result) {
stored_result->file_metadata.push_back(file_metadata);
} else {
- auto result =
+ auto scan_result =
std::make_unique<enterprise_connectors::ScanResult>(file_metadata);
item_->SetUserData(enterprise_connectors::ScanResult::kKey,
- std::move(result));
+ std::move(scan_result));
}
}
diff --git a/chrome/browser/safe_browsing/download_protection/download_protection_service_unittest.cc b/chrome/browser/safe_browsing/download_protection/download_protection_service_unittest.cc
index 7b2671b7..496a847 100644
--- a/chrome/browser/safe_browsing/download_protection/download_protection_service_unittest.cc
+++ b/chrome/browser/safe_browsing/download_protection/download_protection_service_unittest.cc
@@ -543,8 +543,8 @@
const base::FilePath& tmp_full_path,
const base::FilePath& final_full_path) {
url_chain_.clear();
- for (std::string item : url_chain_items)
- url_chain_.push_back(GURL(item));
+ for (std::string url_chain_item : url_chain_items)
+ url_chain_.push_back(GURL(url_chain_item));
if (url_chain_.empty())
url_chain_.push_back(GURL());
referrer_ = GURL(referrer_url);
diff --git a/chrome/browser/sessions/app_session_service_unittest.cc b/chrome/browser/sessions/app_session_service_unittest.cc
index 72fbc65..af6a46b 100644
--- a/chrome/browser/sessions/app_session_service_unittest.cc
+++ b/chrome/browser/sessions/app_session_service_unittest.cc
@@ -74,13 +74,13 @@
app_helper_.SetService(nullptr);
}
- void AppUpdateNavigation(const SessionID& window_id,
+ void AppUpdateNavigation(const SessionID& window_session_id,
const SessionID& tab_id,
const SerializedNavigationEntry& navigation,
bool select) {
- app_service()->UpdateTabNavigation(window_id, tab_id, navigation);
+ app_service()->UpdateTabNavigation(window_session_id, tab_id, navigation);
if (select) {
- app_service()->SetSelectedNavigationIndex(window_id, tab_id,
+ app_service()->SetSelectedNavigationIndex(window_session_id, tab_id,
navigation.index());
}
}
diff --git a/chrome/browser/sessions/session_data_service.cc b/chrome/browser/sessions/session_data_service.cc
index 7439d85c..e8f12d5 100644
--- a/chrome/browser/sessions/session_data_service.cc
+++ b/chrome/browser/sessions/session_data_service.cc
@@ -132,8 +132,8 @@
return;
// Check for any open windows for the current profile.
- for (auto* browser : *BrowserList::GetInstance()) {
- if (browser->profile() == profile_)
+ for (auto* open_browser : *BrowserList::GetInstance()) {
+ if (open_browser->profile() == profile_)
return;
}
diff --git a/chrome/browser/sessions/session_service_unittest.cc b/chrome/browser/sessions/session_service_unittest.cc
index f57247430..29b0d9ab5 100644
--- a/chrome/browser/sessions/session_service_unittest.cc
+++ b/chrome/browser/sessions/session_service_unittest.cc
@@ -100,25 +100,24 @@
helper_.SetService(nullptr);
}
- void UpdateNavigation(
- const SessionID& window_id,
- const SessionID& tab_id,
- const SerializedNavigationEntry& navigation,
- bool select) {
- service()->UpdateTabNavigation(window_id, tab_id, navigation);
+ void UpdateNavigation(const SessionID& window_session_id,
+ const SessionID& tab_id,
+ const SerializedNavigationEntry& navigation,
+ bool select) {
+ service()->UpdateTabNavigation(window_session_id, tab_id, navigation);
if (select) {
- service()->SetSelectedNavigationIndex(
- window_id, tab_id, navigation.index());
+ service()->SetSelectedNavigationIndex(window_session_id, tab_id,
+ navigation.index());
}
}
- SessionID CreateTabWithTestNavigationData(SessionID window_id,
+ SessionID CreateTabWithTestNavigationData(SessionID window_session_id,
int visual_index) {
const SessionID tab_id = SessionID::NewUnique();
const SerializedNavigationEntry nav =
SerializedNavigationEntryTestHelper::CreateNavigationForTest();
- helper_.PrepareTabInWindow(window_id, tab_id, visual_index, true);
- UpdateNavigation(window_id, tab_id, nav, true);
+ helper_.PrepareTabInWindow(window_session_id, tab_id, visual_index, true);
+ UpdateNavigation(window_session_id, tab_id, nav, true);
return tab_id;
}
diff --git a/chrome/browser/signin/chrome_signin_helper.cc b/chrome/browser/signin/chrome_signin_helper.cc
index 1133ece1..1fa42fc 100644
--- a/chrome/browser/signin/chrome_signin_helper.cc
+++ b/chrome/browser/signin/chrome_signin_helper.cc
@@ -595,7 +595,8 @@
return; // Account consistency is disabled in incognito.
int profile_mode_mask = PROFILE_MODE_DEFAULT;
- if (incognito_availibility == IncognitoModePrefs::DISABLED ||
+ if (incognito_availibility ==
+ static_cast<int>(IncognitoModePrefs::Availability::kDisabled) ||
IncognitoModePrefs::ArePlatformParentalControlsEnabled()) {
profile_mode_mask |= PROFILE_MODE_INCOGNITO_DISABLED;
}
diff --git a/chrome/browser/signin/chromeos_mirror_account_consistency_browsertest.cc b/chrome/browser/signin/chromeos_mirror_account_consistency_browsertest.cc
index 58d1f6f..dac98dc 100644
--- a/chrome/browser/signin/chromeos_mirror_account_consistency_browsertest.cc
+++ b/chrome/browser/signin/chromeos_mirror_account_consistency_browsertest.cc
@@ -129,8 +129,9 @@
// Incognito is always disabled for child accounts.
PrefService* prefs = profile->GetPrefs();
- prefs->SetInteger(prefs::kIncognitoModeAvailability,
- IncognitoModePrefs::DISABLED);
+ prefs->SetInteger(
+ prefs::kIncognitoModeAvailability,
+ static_cast<int>(IncognitoModePrefs::Availability::kDisabled));
ASSERT_EQ(1, signin::PROFILE_MODE_INCOGNITO_DISABLED);
// TODO(http://crbug.com/1134144): This test seems to test supervised profiles
diff --git a/chrome/browser/signin/header_modification_delegate_impl.cc b/chrome/browser/signin/header_modification_delegate_impl.cc
index 0aaddde..f9fe5ba 100644
--- a/chrome/browser/signin/header_modification_delegate_impl.cc
+++ b/chrome/browser/signin/header_modification_delegate_impl.cc
@@ -97,9 +97,10 @@
int incognito_mode_availability =
prefs->GetInteger(prefs::kIncognitoModeAvailability);
#if defined(OS_ANDROID)
- incognito_mode_availability = incognito_enabled_
- ? incognito_mode_availability
- : IncognitoModePrefs::DISABLED;
+ incognito_mode_availability =
+ incognito_enabled_
+ ? incognito_mode_availability
+ : static_cast<int>(IncognitoModePrefs::Availability::kDisabled);
#endif
FixAccountConsistencyRequestHeader(
diff --git a/chrome/browser/site_isolation/site_per_process_interactive_browsertest.cc b/chrome/browser/site_isolation/site_per_process_interactive_browsertest.cc
index b5c40e7..78ee687 100644
--- a/chrome/browser/site_isolation/site_per_process_interactive_browsertest.cc
+++ b/chrome/browser/site_isolation/site_per_process_interactive_browsertest.cc
@@ -870,10 +870,10 @@
std::set<std::string> expected_events = {"main_frame", "child", "grandchild"};
{
content::DOMMessageQueue queue;
- FullscreenNotificationObserver observer(browser());
+ FullscreenNotificationObserver fullscreen_observer(browser());
EXPECT_TRUE(ExecuteScript(grandchild, "activateFullscreen()"));
WaitForMultipleFullscreenEvents(expected_events, queue);
- observer.Wait();
+ fullscreen_observer.Wait();
}
// Verify that the browser has entered fullscreen for the current tab.
@@ -900,7 +900,7 @@
AddResizeListener(grandchild, original_grandchild_size);
{
content::DOMMessageQueue queue;
- FullscreenNotificationObserver observer(browser());
+ FullscreenNotificationObserver fullscreen_observer(browser());
switch (exit_method) {
case FullscreenExitMethod::JS_CALL:
EXPECT_TRUE(ExecuteScript(grandchild, "exitFullscreen()"));
@@ -913,7 +913,7 @@
NOTREACHED();
}
WaitForMultipleFullscreenEvents(expected_events, queue);
- observer.Wait();
+ fullscreen_observer.Wait();
}
EXPECT_FALSE(browser()->window()->IsFullscreen());
@@ -1031,10 +1031,10 @@
// browser finishes the fullscreen transition.
{
content::DOMMessageQueue queue;
- FullscreenNotificationObserver observer(browser());
+ FullscreenNotificationObserver fullscreen_observer(browser());
EXPECT_TRUE(ExecuteScript(c_middle, "activateFullscreen()"));
WaitForMultipleFullscreenEvents(expected_events, queue);
- observer.Wait();
+ fullscreen_observer.Wait();
}
// Verify that the browser has entered fullscreen for the current tab.
@@ -1071,11 +1071,11 @@
AddResizeListener(c_middle, c_middle_original_size);
{
content::DOMMessageQueue queue;
- FullscreenNotificationObserver observer(browser());
+ FullscreenNotificationObserver fullscreen_observer(browser());
ASSERT_TRUE(ui_test_utils::SendKeyPressSync(browser(), ui::VKEY_ESCAPE,
false, false, false, false));
WaitForMultipleFullscreenEvents(expected_events, queue);
- observer.Wait();
+ fullscreen_observer.Wait();
}
EXPECT_FALSE(browser()->window()->IsFullscreen());
diff --git a/chrome/browser/speech/extension_api/tts_engine_extension_api.cc b/chrome/browser/speech/extension_api/tts_engine_extension_api.cc
index 9c5478bd..d7a88d7 100644
--- a/chrome/browser/speech/extension_api/tts_engine_extension_api.cc
+++ b/chrome/browser/speech/extension_api/tts_engine_extension_api.cc
@@ -245,9 +245,9 @@
result_voice.remote = voice.remote;
result_voice.engine_id = extension->id();
- for (auto iter = voice.event_types.begin();
- iter != voice.event_types.end(); ++iter) {
- result_voice.events.insert(TtsEventTypeFromString(*iter));
+ for (auto it = voice.event_types.begin(); it != voice.event_types.end();
+ ++it) {
+ result_voice.events.insert(TtsEventTypeFromString(*it));
}
// If the extension sends end events, the controller will handle
diff --git a/chrome/browser/supervised_user/supervised_user_pref_store.cc b/chrome/browser/supervised_user/supervised_user_pref_store.cc
index 7af4c696..ffb238e5 100644
--- a/chrome/browser/supervised_user/supervised_user_pref_store.cc
+++ b/chrome/browser/supervised_user/supervised_user_pref_store.cc
@@ -139,9 +139,11 @@
bool record_history = true;
settings->GetBoolean(supervised_users::kRecordHistory, &record_history);
prefs_->SetBoolean(prefs::kAllowDeletingBrowserHistory, !record_history);
- prefs_->SetInteger(prefs::kIncognitoModeAvailability,
- record_history ? IncognitoModePrefs::DISABLED
- : IncognitoModePrefs::ENABLED);
+ prefs_->SetInteger(
+ prefs::kIncognitoModeAvailability,
+ static_cast<int>(record_history
+ ? IncognitoModePrefs::Availability::kDisabled
+ : IncognitoModePrefs::Availability::kEnabled));
}
{
diff --git a/chrome/browser/sync/test/integration/autofill_helper.cc b/chrome/browser/sync/test/integration/autofill_helper.cc
index 5308803..25ee317 100644
--- a/chrome/browser/sync/test/integration/autofill_helper.cc
+++ b/chrome/browser/sync/test/integration/autofill_helper.cc
@@ -303,8 +303,8 @@
void AddProfile(int profile, const AutofillProfile& autofill_profile) {
std::vector<AutofillProfile> autofill_profiles;
- for (AutofillProfile* profile : GetAllAutoFillProfiles(profile)) {
- autofill_profiles.push_back(*profile);
+ for (AutofillProfile* p : GetAllAutoFillProfiles(profile)) {
+ autofill_profiles.push_back(*p);
}
autofill_profiles.push_back(autofill_profile);
autofill_helper::SetProfiles(profile, &autofill_profiles);
@@ -312,9 +312,9 @@
void RemoveProfile(int profile, const std::string& guid) {
std::vector<AutofillProfile> autofill_profiles;
- for (AutofillProfile* profile : GetAllAutoFillProfiles(profile)) {
- if (profile->guid() != guid) {
- autofill_profiles.push_back(*profile);
+ for (AutofillProfile* p : GetAllAutoFillProfiles(profile)) {
+ if (p->guid() != guid) {
+ autofill_profiles.push_back(*p);
}
}
autofill_helper::SetProfiles(profile, &autofill_profiles);
@@ -326,9 +326,9 @@
const std::u16string& value,
autofill::structured_address::VerificationStatus status) {
std::vector<AutofillProfile> profiles;
- for (AutofillProfile* profile : GetAllAutoFillProfiles(profile)) {
- profiles.push_back(*profile);
- if (profile->guid() == guid) {
+ for (AutofillProfile* p : GetAllAutoFillProfiles(profile)) {
+ profiles.push_back(*p);
+ if (p->guid() == guid) {
profiles.back().SetRawInfoWithVerificationStatus(type.GetStorableType(),
value, status);
}
diff --git a/chrome/browser/sync/test/integration/two_client_bookmarks_sync_test.cc b/chrome/browser/sync/test/integration/two_client_bookmarks_sync_test.cc
index 863b509..53e7554 100644
--- a/chrome/browser/sync/test/integration/two_client_bookmarks_sync_test.cc
+++ b/chrome/browser/sync/test/integration/two_client_bookmarks_sync_test.cc
@@ -477,11 +477,11 @@
std::vector<BookmarkNodeMatcher> matchers_in_folder;
if (base::RandDouble() > 0.4) {
for (size_t j = 0; j < 20; ++j) {
- const std::string title = IndexedURLTitle(j);
+ const std::string url_title = IndexedURLTitle(j);
const GURL url = GURL(IndexedURL(j));
- ASSERT_NE(nullptr, AddURL(0, folder, j, title, url));
+ ASSERT_NE(nullptr, AddURL(0, folder, j, url_title, url));
matchers_in_folder.push_back(
- IsUrlBookmarkWithTitleAndUrl(title, url));
+ IsUrlBookmarkWithTitleAndUrl(url_title, url));
}
}
bookmark_bar_matchers.push_back(IsFolderWithTitleAndChildren(
@@ -674,14 +674,15 @@
ASSERT_NE(nullptr, folder);
for (size_t i = 0; i < 120; ++i) {
if (base::RandDouble() > 0.15) {
- const std::string title = IndexedURLTitle(i);
+ const std::string url_title = IndexedURLTitle(i);
const GURL url = GURL(IndexedURL(i));
- ASSERT_NE(nullptr, AddURL(0, folder, i, title, url));
- matchers_in_folder.push_back(IsUrlBookmarkWithTitleAndUrl(title, url));
+ ASSERT_NE(nullptr, AddURL(0, folder, i, url_title, url));
+ matchers_in_folder.push_back(
+ IsUrlBookmarkWithTitleAndUrl(url_title, url));
} else {
- const std::string title = IndexedSubfolderName(i);
- ASSERT_NE(nullptr, AddFolder(0, folder, i, title));
- matchers_in_folder.push_back(IsFolderWithTitle(title));
+ const std::string subfolder_title = IndexedSubfolderName(i);
+ ASSERT_NE(nullptr, AddFolder(0, folder, i, subfolder_title));
+ matchers_in_folder.push_back(IsFolderWithTitle(subfolder_title));
}
}
ASSERT_TRUE(BookmarksMatchChecker().Wait());
@@ -717,14 +718,15 @@
std::vector<BookmarkNodeMatcher> matchers_in_subfolder;
for (size_t i = 0; i < kNumSubfolderUrls; ++i) {
if (base::RandDouble() > 0.15) {
- const std::string title = IndexedURLTitle(i);
+ const std::string url_title = IndexedURLTitle(i);
const GURL url = GURL(IndexedURL(i));
- ASSERT_NE(nullptr, AddURL(0, subfolder, i, title, url));
- matchers_in_subfolder.push_back(IsUrlBookmarkWithTitleAndUrl(title, url));
+ ASSERT_NE(nullptr, AddURL(0, subfolder, i, url_title, url));
+ matchers_in_subfolder.push_back(
+ IsUrlBookmarkWithTitleAndUrl(url_title, url));
} else {
- const std::string title = IndexedSubsubfolderName(i);
- ASSERT_NE(nullptr, AddFolder(0, subfolder, i, title));
- matchers_in_subfolder.push_back(IsFolderWithTitle(title));
+ const std::string subfolder_title = IndexedSubsubfolderName(i);
+ ASSERT_NE(nullptr, AddFolder(0, subfolder, i, subfolder_title));
+ matchers_in_subfolder.push_back(IsFolderWithTitle(subfolder_title));
}
}
// Insert a |folder| matcher with its |subfolder|.
@@ -1045,15 +1047,15 @@
if (base::RandDouble() > 0.3) {
for (size_t j = 0; j < 10; ++j) {
if (base::RandDouble() > 0.6) {
- const std::string title = IndexedURLTitle(j);
+ const std::string url_title = IndexedURLTitle(j);
const GURL url = GURL(IndexedURL(j));
- ASSERT_NE(nullptr, AddURL(0, subfolder, j, title, url));
+ ASSERT_NE(nullptr, AddURL(0, subfolder, j, url_title, url));
matchers_in_subfolder.push_back(
- IsUrlBookmarkWithTitleAndUrl(title, url));
+ IsUrlBookmarkWithTitleAndUrl(url_title, url));
} else {
- const std::string title = IndexedSubsubfolderName(j);
- ASSERT_NE(nullptr, AddFolder(0, subfolder, j, title));
- matchers_in_subfolder.push_back(IsFolderWithTitle(title));
+ const std::string subfolder_title = IndexedSubsubfolderName(j);
+ ASSERT_NE(nullptr, AddFolder(0, subfolder, j, subfolder_title));
+ matchers_in_subfolder.push_back(IsFolderWithTitle(subfolder_title));
}
}
}
@@ -1766,10 +1768,11 @@
std::vector<BookmarkNodeMatcher> matchers_in_folder;
ASSERT_NE(nullptr, folder);
for (size_t j = 0; j < 10; ++j) {
- const std::string title = IndexedURLTitle(j);
+ const std::string url_title = IndexedURLTitle(j);
const GURL url = GURL(IndexedURL(j));
- ASSERT_NE(nullptr, AddURL(0, folder, j, title, url));
- matchers_in_folder.push_back(IsUrlBookmarkWithTitleAndUrl(title, url));
+ ASSERT_NE(nullptr, AddURL(0, folder, j, url_title, url));
+ matchers_in_folder.push_back(
+ IsUrlBookmarkWithTitleAndUrl(url_title, url));
}
matchers.push_back(IsFolderWithTitleAndChildren(
title, ElementsAreArray(std::move(matchers_in_folder))));
@@ -1794,10 +1797,11 @@
ASSERT_NE(nullptr, folder);
std::vector<BookmarkNodeMatcher> matchers_in_folder;
for (size_t j = 0; j < 10; ++j) {
- const std::string title = IndexedURLTitle(1000 * i + j);
+ const std::string url_title = IndexedURLTitle(1000 * i + j);
const GURL url = GURL(IndexedURL(j));
- ASSERT_NE(nullptr, AddURL(0, folder, j, title, url));
- matchers_in_folder.push_back(IsUrlBookmarkWithTitleAndUrl(title, url));
+ ASSERT_NE(nullptr, AddURL(0, folder, j, url_title, url));
+ matchers_in_folder.push_back(
+ IsUrlBookmarkWithTitleAndUrl(url_title, url));
}
matchers.push_back(IsFolderWithTitleAndChildren(
title, ElementsAreArray(std::move(matchers_in_folder))));
@@ -1971,19 +1975,19 @@
ASSERT_NE(nullptr, AddURL(1, i, title1, url1));
}
for (size_t i = 25; i < 30; ++i) {
- const std::string title0 = IndexedFolderName(i);
+ std::string title0 = IndexedFolderName(i);
const BookmarkNode* folder0 = AddFolder(0, i, title0);
ASSERT_NE(nullptr, folder0);
- const std::string title1 = IndexedFolderName(i + 50);
+ std::string title1 = IndexedFolderName(i + 50);
const BookmarkNode* folder1 = AddFolder(1, i, title1);
ASSERT_NE(nullptr, folder1);
for (size_t j = 0; j < 5; ++j) {
- const std::string title0 = IndexedURLTitle(i + 5 * j);
+ title0 = IndexedURLTitle(i + 5 * j);
const GURL url0 = GURL(IndexedURL(i + 5 * j));
ASSERT_NE(nullptr, AddURL(0, folder0, j, title0, url0));
- const std::string title1 = IndexedURLTitle(i + 5 * j + 50);
+ title1 = IndexedURLTitle(i + 5 * j + 50);
const GURL url1 = GURL(IndexedURL(i + 5 * j + 50));
ASSERT_NE(nullptr, AddURL(1, folder1, j, title1, url1));
}
diff --git a/chrome/browser/sync_file_system/drive_backend/local_to_remote_syncer.cc b/chrome/browser/sync_file_system/drive_backend/local_to_remote_syncer.cc
index a18c0ff3..7661621 100644
--- a/chrome/browser/sync_file_system/drive_backend/local_to_remote_syncer.cc
+++ b/chrome/browser/sync_file_system/drive_backend/local_to_remote_syncer.cc
@@ -485,7 +485,7 @@
// last sync completed. As our policy for deletion-modification conflict
// resolution, ignore the local deletion.
if (status == SYNC_STATUS_OK || error == google_apis::HTTP_NOT_FOUND) {
- SyncStatusCode status = metadata_database()->UpdateByDeletedRemoteFile(
+ status = metadata_database()->UpdateByDeletedRemoteFile(
remote_file_tracker_->file_id());
SyncCompleted(std::move(token), status);
return;
@@ -571,7 +571,7 @@
if (!details.missing() && details.file_kind() == FILE_KIND_FILE &&
details.title() == title.AsUTF8Unsafe() &&
HasFileAsParent(details, remote_parent_folder_tracker_->file_id())) {
- SyncStatusCode status = metadata_database()->UpdateTracker(
+ status = metadata_database()->UpdateTracker(
remote_file_tracker_->tracker_id(), file.details());
SyncCompleted(std::move(token), status);
return;
diff --git a/chrome/browser/sync_file_system/drive_backend/metadata_database.cc b/chrome/browser/sync_file_system/drive_backend/metadata_database.cc
index b0ba0ea..90a96ffd 100644
--- a/chrome/browser/sync_file_system/drive_backend/metadata_database.cc
+++ b/chrome/browser/sync_file_system/drive_backend/metadata_database.cc
@@ -1147,11 +1147,12 @@
std::unique_ptr<FileTracker> tracker_to_be_deactivated(new FileTracker);
if (index_->GetFileTracker(same_title_trackers.active_tracker(),
tracker_to_be_deactivated.get())) {
- const std::string file_id = tracker_to_be_deactivated->file_id();
+ const std::string tracker_file_id =
+ tracker_to_be_deactivated->file_id();
tracker_to_be_deactivated->set_active(false);
index_->StoreFileTracker(std::move(tracker_to_be_deactivated));
- MarkTrackersDirtyByFileID(file_id, index_.get());
+ MarkTrackersDirtyByFileID(tracker_file_id, index_.get());
} else {
NOTREACHED();
}
diff --git a/chrome/browser/sync_file_system/drive_backend/metadata_db_migration_util_unittest.cc b/chrome/browser/sync_file_system/drive_backend/metadata_db_migration_util_unittest.cc
index b17a035..632029cb 100644
--- a/chrome/browser/sync_file_system/drive_backend/metadata_db_migration_util_unittest.cc
+++ b/chrome/browser/sync_file_system/drive_backend/metadata_db_migration_util_unittest.cc
@@ -55,22 +55,6 @@
// Please see metadata_database_index.cc for version 3 format, and
// metadata_database_index_on_disk.cc for version 4 format.
- const char kDatabaseVersionKey[] = "VERSION";
- const char kServiceMetadataKey[] = "SERVICE";
- const char kFileMetadataKeyPrefix[] = "FILE: ";
- const char kFileTrackerKeyPrefix[] = "TRACKER: ";
-
- // Key prefixes used in version 4.
- const char kAppRootIDByAppIDKeyPrefix[] = "APP_ROOT: ";
- const char kActiveTrackerIDByFileIDKeyPrefix[] = "ACTIVE_FILE: ";
- const char kTrackerIDByFileIDKeyPrefix[] = "TRACKER_FILE: ";
- const char kMultiTrackerByFileIDKeyPrefix[] = "MULTI_FILE: ";
- const char kActiveTrackerIDByParentAndTitleKeyPrefix[] = "ACTIVE_PATH: ";
- const char kTrackerIDByParentAndTitleKeyPrefix[] = "TRACKER_PATH: ";
- const char kMultiBackingParentAndTitleKeyPrefix[] = "MULTI_PATH: ";
- const char kDirtyIDKeyPrefix[] = "DIRTY: ";
- const char kDemotedDirtyIDKeyPrefix[] = "DEMOTED_DIRTY: ";
-
// Set up environment.
base::ScopedTempDir base_dir;
std::unique_ptr<leveldb::DB> db;
diff --git a/chrome/browser/sync_file_system/drive_backend/remote_to_local_syncer.cc b/chrome/browser/sync_file_system/drive_backend/remote_to_local_syncer.cc
index 1f48941..5ea87056 100644
--- a/chrome/browser/sync_file_system/drive_backend/remote_to_local_syncer.cc
+++ b/chrome/browser/sync_file_system/drive_backend/remote_to_local_syncer.cc
@@ -378,7 +378,7 @@
}
int64_t change_id = remote_metadata_->details().change_id();
- int64_t latest_change_id = latest_file_metadata.details().change_id();
+ latest_change_id = latest_file_metadata.details().change_id();
if (change_id != latest_change_id) {
SyncCompleted(std::move(token), SYNC_STATUS_RETRY);
return;
diff --git a/chrome/browser/task_manager/task_manager_interface.cc b/chrome/browser/task_manager/task_manager_interface.cc
index ddb51ba..3cacb7e 100644
--- a/chrome/browser/task_manager/task_manager_interface.cc
+++ b/chrome/browser/task_manager/task_manager_interface.cc
@@ -91,11 +91,11 @@
// Recalculate the minimum refresh rate and the enabled resource flags.
int64_t flags = 0;
base::TimeDelta min_time = base::TimeDelta::Max();
- for (auto& observer : observers_) {
- if (observer.desired_refresh_time() < min_time)
- min_time = observer.desired_refresh_time();
+ for (auto& obs : observers_) {
+ if (obs.desired_refresh_time() < min_time)
+ min_time = obs.desired_refresh_time();
- flags |= observer.desired_resources_flags();
+ flags |= obs.desired_resources_flags();
}
if (min_time == base::TimeDelta::Max()) {
diff --git a/chrome/browser/themes/browser_theme_pack_unittest.cc b/chrome/browser/themes/browser_theme_pack_unittest.cc
index 57922d27..546fb27 100644
--- a/chrome/browser/themes/browser_theme_pack_unittest.cc
+++ b/chrome/browser/themes/browser_theme_pack_unittest.cc
@@ -448,7 +448,7 @@
int xy = 0;
SkColor color = rep3.GetBitmap().getColor(xy, xy);
normal.push_back(std::make_pair(xy, color));
- for (int xy = 0; xy < 40; ++xy) {
+ for (xy = 0; xy < 40; ++xy) {
SkColor next_color = rep3.GetBitmap().getColor(xy, xy);
if (next_color != color) {
color = next_color;
@@ -465,8 +465,8 @@
// We expect the same colors and at locations scaled by 2
// since this bitmap was scaled by 2.
for (size_t i = 0; i < normal.size(); ++i) {
- int xy = 2 * normal[i].first;
- SkColor color = normal[i].second;
+ xy = 2 * normal[i].first;
+ color = normal[i].second;
EXPECT_EQ(color, rep4.GetBitmap().getColor(xy, xy));
}
}
diff --git a/chrome/browser/ui/ash/chrome_new_window_client.cc b/chrome/browser/ui/ash/chrome_new_window_client.cc
index 1be001b..0c52cfd 100644
--- a/chrome/browser/ui/ash/chrome_new_window_client.cc
+++ b/chrome/browser/ui/ash/chrome_new_window_client.cc
@@ -155,7 +155,7 @@
Profile* profile = ProfileManager::GetActiveUserProfile();
return profile && !profile->IsGuestSession() &&
IncognitoModePrefs::GetAvailability(profile->GetPrefs()) !=
- IncognitoModePrefs::DISABLED;
+ IncognitoModePrefs::Availability::kDisabled;
}
// Converts the given ARC URL to an external file URL to read it via ARC content
diff --git a/chrome/browser/ui/ash/chrome_new_window_client_browsertest.cc b/chrome/browser/ui/ash/chrome_new_window_client_browsertest.cc
index c2b5f66..a90efa2 100644
--- a/chrome/browser/ui/ash/chrome_new_window_client_browsertest.cc
+++ b/chrome/browser/ui/ash/chrome_new_window_client_browsertest.cc
@@ -143,15 +143,15 @@
EXPECT_EQ(1u, chrome::GetTotalBrowserCount());
// Disabling incognito mode disables creation of new incognito windows.
- IncognitoModePrefs::SetAvailability(profile->GetPrefs(),
- IncognitoModePrefs::DISABLED);
+ IncognitoModePrefs::SetAvailability(
+ profile->GetPrefs(), IncognitoModePrefs::Availability::kDisabled);
ChromeNewWindowClient::Get()->NewWindow(
/*incognito=*/true, /*should_trigger_session_restore=*/true);
EXPECT_EQ(1u, chrome::GetTotalBrowserCount());
// Enabling incognito mode enables creation of new incognito windows.
- IncognitoModePrefs::SetAvailability(profile->GetPrefs(),
- IncognitoModePrefs::ENABLED);
+ IncognitoModePrefs::SetAvailability(
+ profile->GetPrefs(), IncognitoModePrefs::Availability::kEnabled);
ChromeNewWindowClient::Get()->NewWindow(
/*incognito=*/true, /*should_trigger_session_restore=*/true);
EXPECT_EQ(2u, chrome::GetTotalBrowserCount());
diff --git a/chrome/browser/ui/ash/shelf/extension_shelf_context_menu.cc b/chrome/browser/ui/ash/shelf/extension_shelf_context_menu.cc
index 8fe7062e..532bb56 100644
--- a/chrome/browser/ui/ash/shelf/extension_shelf_context_menu.cc
+++ b/chrome/browser/ui/ash/shelf/extension_shelf_context_menu.cc
@@ -130,12 +130,12 @@
// "Normal" windows are not allowed when incognito is enforced.
return IncognitoModePrefs::GetAvailability(
controller()->profile()->GetPrefs()) !=
- IncognitoModePrefs::FORCED;
+ IncognitoModePrefs::Availability::kForced;
case ash::MENU_NEW_INCOGNITO_WINDOW:
// Incognito windows are not allowed when incognito is disabled.
return IncognitoModePrefs::GetAvailability(
controller()->profile()->GetPrefs()) !=
- IncognitoModePrefs::DISABLED;
+ IncognitoModePrefs::Availability::kDisabled;
default:
if (command_id < ash::COMMAND_ID_COUNT)
return ShelfContextMenu::IsCommandIdEnabled(command_id);
diff --git a/chrome/browser/ui/ash/shelf/shelf_context_menu_unittest.cc b/chrome/browser/ui/ash/shelf/shelf_context_menu_unittest.cc
index c3f038f..3f6ca74 100644
--- a/chrome/browser/ui/ash/shelf/shelf_context_menu_unittest.cc
+++ b/chrome/browser/ui/ash/shelf/shelf_context_menu_unittest.cc
@@ -265,8 +265,8 @@
shelf_context_menu->IsCommandIdEnabled(ash::MENU_NEW_INCOGNITO_WINDOW));
// Disable Incognito mode.
- IncognitoModePrefs::SetAvailability(profile()->GetPrefs(),
- IncognitoModePrefs::DISABLED);
+ IncognitoModePrefs::SetAvailability(
+ profile()->GetPrefs(), IncognitoModePrefs::Availability::kDisabled);
shelf_context_menu =
CreateShelfContextMenu(ash::TYPE_BROWSER_SHORTCUT, display_id);
menu = GetMenuModel(shelf_context_menu.get());
@@ -288,8 +288,8 @@
EXPECT_TRUE(shelf_context_menu->IsCommandIdEnabled(ash::MENU_NEW_WINDOW));
// Disable Incognito mode.
- IncognitoModePrefs::SetAvailability(profile()->GetPrefs(),
- IncognitoModePrefs::FORCED);
+ IncognitoModePrefs::SetAvailability(
+ profile()->GetPrefs(), IncognitoModePrefs::Availability::kForced);
shelf_context_menu =
CreateShelfContextMenu(ash::TYPE_BROWSER_SHORTCUT, display_id);
menu = GetMenuModel(shelf_context_menu.get());
diff --git a/chrome/browser/ui/bookmarks/bookmark_context_menu_controller.cc b/chrome/browser/ui/bookmarks/bookmark_context_menu_controller.cc
index bb823ab..d2331e2 100644
--- a/chrome/browser/ui/bookmarks/bookmark_context_menu_controller.cc
+++ b/chrome/browser/ui/bookmarks/bookmark_context_menu_controller.cc
@@ -469,19 +469,19 @@
switch (command_id) {
case IDC_BOOKMARK_BAR_OPEN_INCOGNITO:
return !profile_->IsOffTheRecord() &&
- incognito_avail != IncognitoModePrefs::DISABLED;
+ incognito_avail != IncognitoModePrefs::Availability::kDisabled;
case IDC_BOOKMARK_BAR_OPEN_ALL_INCOGNITO:
- return chrome::HasBookmarkURLsAllowedInIncognitoMode(selection_, profile_)
- &&
+ return chrome::HasBookmarkURLsAllowedInIncognitoMode(selection_,
+ profile_) &&
!profile_->IsOffTheRecord() &&
- incognito_avail != IncognitoModePrefs::DISABLED;
+ incognito_avail != IncognitoModePrefs::Availability::kDisabled;
case IDC_BOOKMARK_BAR_OPEN_ALL:
case IDC_BOOKMARK_BAR_OPEN_ALL_NEW_TAB_GROUP:
return chrome::HasBookmarkURLs(selection_);
case IDC_BOOKMARK_BAR_OPEN_ALL_NEW_WINDOW:
return chrome::HasBookmarkURLs(selection_) &&
- incognito_avail != IncognitoModePrefs::FORCED;
+ incognito_avail != IncognitoModePrefs::Availability::kForced;
case IDC_BOOKMARK_BAR_RENAME_FOLDER:
case IDC_BOOKMARK_BAR_EDIT:
diff --git a/chrome/browser/ui/browser_browsertest.cc b/chrome/browser/ui/browser_browsertest.cc
index 5e8c4e4..03f6d00 100644
--- a/chrome/browser/ui/browser_browsertest.cc
+++ b/chrome/browser/ui/browser_browsertest.cc
@@ -1674,8 +1674,9 @@
EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_OPTIONS));
// Set Incognito to FORCED.
- IncognitoModePrefs::SetAvailability(browser()->profile()->GetPrefs(),
- IncognitoModePrefs::FORCED);
+ IncognitoModePrefs::SetAvailability(
+ browser()->profile()->GetPrefs(),
+ IncognitoModePrefs::Availability::kForced);
// Bookmarks & Settings commands should get disabled.
EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_NEW_WINDOW));
EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SHOW_BOOKMARK_MANAGER));
@@ -1729,8 +1730,9 @@
NoNewIncognitoWindowWhenIncognitoIsDisabled) {
CommandUpdater* command_updater = browser()->command_controller();
// Set Incognito to DISABLED.
- IncognitoModePrefs::SetAvailability(browser()->profile()->GetPrefs(),
- IncognitoModePrefs::DISABLED);
+ IncognitoModePrefs::SetAvailability(
+ browser()->profile()->GetPrefs(),
+ IncognitoModePrefs::Availability::kDisabled);
// Make sure New Incognito Window command is disabled. All remaining commands
// should be enabled.
EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_NEW_INCOGNITO_WINDOW));
@@ -1777,8 +1779,9 @@
DisableExtensionsAndSettingsWhenIncognitoIsDisabled) {
CommandUpdater* command_updater = browser()->command_controller();
// Set Incognito to DISABLED.
- IncognitoModePrefs::SetAvailability(browser()->profile()->GetPrefs(),
- IncognitoModePrefs::DISABLED);
+ IncognitoModePrefs::SetAvailability(
+ browser()->profile()->GetPrefs(),
+ IncognitoModePrefs::Availability::kDisabled);
// Make sure Manage Extensions command is disabled.
EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_MANAGE_EXTENSIONS));
EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_NEW_WINDOW));
@@ -1811,14 +1814,16 @@
EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_IMPORT_SETTINGS));
// Set Incognito to FORCED.
- IncognitoModePrefs::SetAvailability(popup_browser->profile()->GetPrefs(),
- IncognitoModePrefs::FORCED);
+ IncognitoModePrefs::SetAvailability(
+ popup_browser->profile()->GetPrefs(),
+ IncognitoModePrefs::Availability::kForced);
// OPTIONS and IMPORT_SETTINGS are disabled when Incognito is forced.
EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_OPTIONS));
EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_IMPORT_SETTINGS));
// Set Incognito to AVAILABLE.
- IncognitoModePrefs::SetAvailability(popup_browser->profile()->GetPrefs(),
- IncognitoModePrefs::ENABLED);
+ IncognitoModePrefs::SetAvailability(
+ popup_browser->profile()->GetPrefs(),
+ IncognitoModePrefs::Availability::kEnabled);
// OPTIONS and IMPORT_SETTINGS are still disabled since it is a non-normal UI.
EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_OPTIONS));
EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_IMPORT_SETTINGS));
@@ -2318,8 +2323,6 @@
EXPECT_EQ(url, web_contents->GetURL());
if (disposition == WindowOpenDisposition::CURRENT_TAB) {
- content::WebContents* web_contents =
- browser->tab_strip_model()->GetActiveWebContents();
content::TestNavigationObserver same_tab_observer(web_contents);
SimulateMouseClick(web_contents, modifiers, button);
same_tab_observer.Wait();
diff --git a/chrome/browser/ui/browser_command_controller.cc b/chrome/browser/ui/browser_command_controller.cc
index 93f3e51..f4cda962 100644
--- a/chrome/browser/ui/browser_command_controller.cc
+++ b/chrome/browser/ui/browser_command_controller.cc
@@ -1175,14 +1175,15 @@
IncognitoModePrefs::Availability incognito_availability =
IncognitoModePrefs::GetAvailability(profile->GetPrefs());
command_updater->UpdateCommandEnabled(
- IDC_NEW_WINDOW, incognito_availability != IncognitoModePrefs::FORCED);
+ IDC_NEW_WINDOW,
+ incognito_availability != IncognitoModePrefs::Availability::kForced);
command_updater->UpdateCommandEnabled(
IDC_NEW_INCOGNITO_WINDOW,
- incognito_availability != IncognitoModePrefs::DISABLED &&
+ incognito_availability != IncognitoModePrefs::Availability::kDisabled &&
!profile->IsGuestSession());
const bool forced_incognito =
- incognito_availability == IncognitoModePrefs::FORCED;
+ incognito_availability == IncognitoModePrefs::Availability::kForced;
const bool is_guest = profile->IsGuestSession();
command_updater->UpdateCommandEnabled(
diff --git a/chrome/browser/ui/browser_command_controller_unittest.cc b/chrome/browser/ui/browser_command_controller_unittest.cc
index 1741c14..330f963 100644
--- a/chrome/browser/ui/browser_command_controller_unittest.cc
+++ b/chrome/browser/ui/browser_command_controller_unittest.cc
@@ -174,8 +174,9 @@
EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_SHOW_SIGNIN));
testprofile->SetGuestSession(false);
- IncognitoModePrefs::SetAvailability(browser()->profile()->GetPrefs(),
- IncognitoModePrefs::FORCED);
+ IncognitoModePrefs::SetAvailability(
+ browser()->profile()->GetPrefs(),
+ IncognitoModePrefs::Availability::kForced);
chrome::BrowserCommandController ::
UpdateSharedCommandsForIncognitoAvailability(
browser()->command_controller(), testprofile);
@@ -467,8 +468,9 @@
// Setup guest session.
profile->SetGuestSession(true);
// Setup forced incognito mode.
- IncognitoModePrefs::SetAvailability(browser()->profile()->GetPrefs(),
- IncognitoModePrefs::FORCED);
+ IncognitoModePrefs::SetAvailability(
+ browser()->profile()->GetPrefs(),
+ IncognitoModePrefs::Availability::kForced);
EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_OPTIONS));
// Enter fullscreen.
browser()->command_controller()->FullscreenStateChanged();
@@ -478,10 +480,12 @@
EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_OPTIONS));
// Reenter incognito mode, this should trigger
// UpdateSharedCommandsForIncognitoAvailability() again.
- IncognitoModePrefs::SetAvailability(browser()->profile()->GetPrefs(),
- IncognitoModePrefs::DISABLED);
- IncognitoModePrefs::SetAvailability(browser()->profile()->GetPrefs(),
- IncognitoModePrefs::FORCED);
+ IncognitoModePrefs::SetAvailability(
+ browser()->profile()->GetPrefs(),
+ IncognitoModePrefs::Availability::kDisabled);
+ IncognitoModePrefs::SetAvailability(
+ browser()->profile()->GetPrefs(),
+ IncognitoModePrefs::Availability::kForced);
EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_OPTIONS));
}
diff --git a/chrome/browser/ui/browser_commands.cc b/chrome/browser/ui/browser_commands.cc
index 0b69550..7428ca894 100644
--- a/chrome/browser/ui/browser_commands.cc
+++ b/chrome/browser/ui/browser_commands.cc
@@ -453,7 +453,7 @@
PrefService* prefs = profile->GetPrefs();
if (off_the_record) {
if (IncognitoModePrefs::GetAvailability(prefs) ==
- IncognitoModePrefs::DISABLED) {
+ IncognitoModePrefs::Availability::kDisabled) {
off_the_record = false;
}
} else if (profile->IsGuestSession() ||
@@ -933,14 +933,14 @@
// If this is a tabbed browser, just create a duplicate tab inside the same
// window next to the tab being duplicated.
TabStripModel* tab_strip_model = browser->tab_strip_model();
- const int index = tab_strip_model->GetIndexOfWebContents(contents);
- pinned = tab_strip_model->IsTabPinned(index);
+ const int contents_index = tab_strip_model->GetIndexOfWebContents(contents);
+ pinned = tab_strip_model->IsTabPinned(contents_index);
int add_types = TabStripModel::ADD_ACTIVE |
TabStripModel::ADD_INHERIT_OPENER |
(pinned ? TabStripModel::ADD_PINNED : 0);
- const auto old_group = tab_strip_model->GetTabGroupForTab(index);
- tab_strip_model->InsertWebContentsAt(index + 1, std::move(contents_dupe),
- add_types, old_group);
+ const auto old_group = tab_strip_model->GetTabGroupForTab(contents_index);
+ tab_strip_model->InsertWebContentsAt(
+ contents_index + 1, std::move(contents_dupe), add_types, old_group);
} else {
CreateAndShowNewWindowWithContents(std::move(contents_dupe), browser);
}
diff --git a/chrome/browser/ui/browser_navigator.cc b/chrome/browser/ui/browser_navigator.cc
index 2c6cad79..1f5fab05e 100644
--- a/chrome/browser/ui/browser_navigator.cc
+++ b/chrome/browser/ui/browser_navigator.cc
@@ -136,7 +136,7 @@
// If incognito is forced, we punt.
PrefService* prefs = profile->GetPrefs();
if (prefs && IncognitoModePrefs::GetAvailability(prefs) ==
- IncognitoModePrefs::FORCED) {
+ IncognitoModePrefs::Availability::kForced) {
return false;
}
diff --git a/chrome/browser/ui/browser_navigator_browsertest.cc b/chrome/browser/ui/browser_navigator_browsertest.cc
index 5b94e91..e3e7de7 100644
--- a/chrome/browser/ui/browser_navigator_browsertest.cc
+++ b/chrome/browser/ui/browser_navigator_browsertest.cc
@@ -207,11 +207,13 @@
// Set kIncognitoModeAvailability to FORCED.
PrefService* prefs1 = browser->profile()->GetPrefs();
- prefs1->SetInteger(prefs::kIncognitoModeAvailability,
- IncognitoModePrefs::FORCED);
+ prefs1->SetInteger(
+ prefs::kIncognitoModeAvailability,
+ static_cast<int>(IncognitoModePrefs::Availability::kForced));
PrefService* prefs2 = browser->profile()->GetOriginalProfile()->GetPrefs();
- prefs2->SetInteger(prefs::kIncognitoModeAvailability,
- IncognitoModePrefs::FORCED);
+ prefs2->SetInteger(
+ prefs::kIncognitoModeAvailability,
+ static_cast<int>(IncognitoModePrefs::Availability::kForced));
// Navigate to the page.
NavigateParams params(MakeNavigateParams(browser));
diff --git a/chrome/browser/ui/browser_unittest.cc b/chrome/browser/ui/browser_unittest.cc
index d6d0942..0b2ffdd 100644
--- a/chrome/browser/ui/browser_unittest.cc
+++ b/chrome/browser/ui/browser_unittest.cc
@@ -187,8 +187,8 @@
// Tests BrowserCreate() when Incognito mode is disabled.
TEST_F(BrowserUnitTest, CreateBrowserWithIncognitoModeDisabled) {
- IncognitoModePrefs::SetAvailability(profile()->GetPrefs(),
- IncognitoModePrefs::DISABLED);
+ IncognitoModePrefs::SetAvailability(
+ profile()->GetPrefs(), IncognitoModePrefs::Availability::kDisabled);
// Creating a browser window in OTR profile should fail if incognito is
// disabled.
@@ -206,8 +206,8 @@
// Tests BrowserCreate() when Incognito mode is forced.
TEST_F(BrowserUnitTest, CreateBrowserWithIncognitoModeForced) {
- IncognitoModePrefs::SetAvailability(profile()->GetPrefs(),
- IncognitoModePrefs::FORCED);
+ IncognitoModePrefs::SetAvailability(
+ profile()->GetPrefs(), IncognitoModePrefs::Availability::kForced);
// Creating a browser window in the original profile should fail if incognito
// is forced.
@@ -226,7 +226,7 @@
// Tests BrowserCreate() with not restrictions on incognito mode.
TEST_F(BrowserUnitTest, CreateBrowserWithIncognitoModeEnabled) {
- ASSERT_EQ(IncognitoModePrefs::ENABLED,
+ ASSERT_EQ(IncognitoModePrefs::Availability::kEnabled,
IncognitoModePrefs::GetAvailability(profile()->GetPrefs()));
// Creating a browser in the original test profile should succeed.
diff --git a/chrome/browser/ui/commander/tab_command_source.cc b/chrome/browser/ui/commander/tab_command_source.cc
index becd344..4da5f0e 100644
--- a/chrome/browser/ui/commander/tab_command_source.cc
+++ b/chrome/browser/ui/commander/tab_command_source.cc
@@ -340,10 +340,10 @@
}
for (auto& match : GroupsMatchingInput(
browser, input, IneligibleGroupForSelected(tab_strip_model))) {
- auto item = match.ToCommandItem();
- item->command =
+ auto command_item = match.ToCommandItem();
+ command_item->command =
base::BindOnce(&AddTabsToGroup, browser->AsWeakPtr(), match.group);
- results.push_back(std::move(item));
+ results.push_back(std::move(command_item));
}
return results;
}
diff --git a/chrome/browser/ui/hats/hats_service.cc b/chrome/browser/ui/hats/hats_service.cc
index cb3a129..15707a3 100644
--- a/chrome/browser/ui/hats/hats_service.cc
+++ b/chrome/browser/ui/hats/hats_service.cc
@@ -511,7 +511,7 @@
return;
}
if (IncognitoModePrefs::GetAvailability(profile_->GetPrefs()) ==
- IncognitoModePrefs::DISABLED) {
+ IncognitoModePrefs::Availability::kDisabled) {
// Incognito mode needs to be enabled to create an off-the-record profile
// for HaTS dialog.
UMA_HISTOGRAM_ENUMERATION(kHatsShouldShowSurveyReasonHistogram,
diff --git a/chrome/browser/ui/hats/hats_service_browsertest.cc b/chrome/browser/ui/hats/hats_service_browsertest.cc
index 7549c62..9e3a99bb 100644
--- a/chrome/browser/ui/hats/hats_service_browsertest.cc
+++ b/chrome/browser/ui/hats/hats_service_browsertest.cc
@@ -264,9 +264,10 @@
SetMetricsConsent(true);
// Disable incognito mode for this profile.
PrefService* pref_service = browser()->profile()->GetPrefs();
- pref_service->SetInteger(prefs::kIncognitoModeAvailability,
- IncognitoModePrefs::DISABLED);
- EXPECT_EQ(IncognitoModePrefs::DISABLED,
+ pref_service->SetInteger(
+ prefs::kIncognitoModeAvailability,
+ static_cast<int>(IncognitoModePrefs::Availability::kDisabled));
+ EXPECT_EQ(IncognitoModePrefs::Availability::kDisabled,
IncognitoModePrefs::GetAvailability(pref_service));
GetHatsService()->LaunchSurvey(kHatsSurveyTriggerSettings);
diff --git a/chrome/browser/ui/login/login_handler_browsertest.cc b/chrome/browser/ui/login/login_handler_browsertest.cc
index 0b3a1fd..5c206f4 100644
--- a/chrome/browser/ui/login/login_handler_browsertest.cc
+++ b/chrome/browser/ui/login/login_handler_browsertest.cc
@@ -1492,10 +1492,10 @@
ui::PAGE_TRANSITION_TYPED, false));
auth_needed_waiter2.Wait();
ASSERT_EQ(1u, observer.handlers().size());
- WindowedAuthSuppliedObserver auth_supplied_waiter(controller);
- LoginHandler* handler = *observer.handlers().begin();
+ WindowedAuthSuppliedObserver auth_supplied_waiter2(controller);
+ handler = *observer.handlers().begin();
SetAuthFor(handler);
- auth_supplied_waiter.Wait();
+ auth_supplied_waiter2.Wait();
navigation_observer.Wait();
EXPECT_EQ(2, observer.auth_needed_count());
}
diff --git a/chrome/browser/ui/tabs/tab_strip_model_order_controller.cc b/chrome/browser/ui/tabs/tab_strip_model_order_controller.cc
index fc98a7a3..4e089b3 100644
--- a/chrome/browser/ui/tabs/tab_strip_model_order_controller.cc
+++ b/chrome/browser/ui/tabs/tab_strip_model_order_controller.cc
@@ -78,8 +78,8 @@
if (parent_opener) {
// If the tab has an opener, shift selection to the next tab with the same
// opener.
- int index = model_->GetIndexOfNextWebContentsOpenedBy(parent_opener,
- removing_index);
+ index = model_->GetIndexOfNextWebContentsOpenedBy(parent_opener,
+ removing_index);
if (index != TabStripModel::kNoTab && !model_->IsTabCollapsed(index))
return GetValidIndex(index, removing_index);
diff --git a/chrome/browser/ui/toolbar/app_menu_model.cc b/chrome/browser/ui/toolbar/app_menu_model.cc
index 45448c7..a21a5500 100644
--- a/chrome/browser/ui/toolbar/app_menu_model.cc
+++ b/chrome/browser/ui/toolbar/app_menu_model.cc
@@ -992,7 +992,7 @@
return false;
return IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) !=
- IncognitoModePrefs::DISABLED;
+ IncognitoModePrefs::Availability::kDisabled;
}
bool AppMenuModel::AddGlobalErrorMenuItems() {
diff --git a/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.cc b/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.cc
index 13ea487..06e5983a 100644
--- a/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.cc
+++ b/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.cc
@@ -646,7 +646,7 @@
DCHECK(base::FeatureList::IsEnabled(features::kTabRestoreSubMenus));
std::unique_ptr<ui::SimpleMenuModel> group_model =
std::make_unique<ui::SimpleMenuModel>(this);
- const int command_id = GetAndIncrementNextMenuID();
+ int command_id = GetAndIncrementNextMenuID();
group_model->AddItemWithStringIdAndIcon(
command_id, IDS_RESTORE_GROUP,
ui::ImageModel::FromVectorIcon(vector_icons::kLaunchIcon));
@@ -654,7 +654,7 @@
for (auto& tab : group.tabs) {
const sessions::SerializedNavigationEntry& current_navigation =
tab->navigations.at(tab->current_navigation_index);
- const int command_id = GetAndIncrementNextMenuID();
+ command_id = GetAndIncrementNextMenuID();
// There may be no tab title, in which case, use the url as tab title.
group_model->AddItem(
command_id,
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc
index 2f66b53e..719ed42 100644
--- a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc
+++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc
@@ -2194,12 +2194,12 @@
const BookmarkNode* old_node = parent;
size_t old_index_on_bb = old_index;
while (old_node && old_node != bbn) {
- const BookmarkNode* parent = old_node->parent();
- if (parent == bbn) {
+ const BookmarkNode* old_parent = old_node->parent();
+ if (old_parent == bbn) {
old_index_on_bb = static_cast<size_t>(bbn->GetIndexOf(old_node));
break;
}
- old_node = parent;
+ old_node = old_parent;
}
if (old_node) {
if (old_index_on_bb >= GetFirstHiddenNodeIndex()) {
diff --git a/chrome/browser/ui/views/chrome_views_delegate_win.cc b/chrome/browser/ui/views/chrome_views_delegate_win.cc
index 6ef061d..880a4770 100644
--- a/chrome/browser/ui/views/chrome_views_delegate_win.cc
+++ b/chrome/browser/ui/views/chrome_views_delegate_win.cc
@@ -21,8 +21,9 @@
namespace {
bool MonitorHasAutohideTaskbarForEdge(UINT edge, HMONITOR monitor) {
- APPBARDATA taskbar_data = {sizeof(APPBARDATA), NULL, 0, edge};
- taskbar_data.hWnd = ::GetForegroundWindow();
+ APPBARDATA taskbar_data_for_getautohidebar = {sizeof(APPBARDATA), NULL, 0,
+ edge};
+ taskbar_data_for_getautohidebar.hWnd = ::GetForegroundWindow();
// MSDN documents an ABM_GETAUTOHIDEBAREX, which supposedly takes a monitor
// rect and returns autohide bars on that monitor. This sounds like a good
@@ -38,7 +39,7 @@
// are looking for, we are done.
// NOTE: This call spins a nested run loop.
HWND taskbar = reinterpret_cast<HWND>(
- SHAppBarMessage(ABM_GETAUTOHIDEBAR, &taskbar_data));
+ SHAppBarMessage(ABM_GETAUTOHIDEBAR, &taskbar_data_for_getautohidebar));
if (!::IsWindow(taskbar)) {
APPBARDATA taskbar_data = {sizeof(APPBARDATA), 0, 0, 0};
unsigned int taskbar_state = SHAppBarMessage(ABM_GETSTATE, &taskbar_data);
diff --git a/chrome/browser/ui/views/frame/opaque_browser_frame_view_browsertest.cc b/chrome/browser/ui/views/frame/opaque_browser_frame_view_browsertest.cc
index 36aa846..afbfb1c 100644
--- a/chrome/browser/ui/views/frame/opaque_browser_frame_view_browsertest.cc
+++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view_browsertest.cc
@@ -225,7 +225,7 @@
{
EXPECT_TRUE(web_app_origin_text->GetVisible());
base::RunLoop view_hidden_runloop;
- auto subscription = web_app_origin_text->AddVisibleChangedCallback(
+ auto callback_subscription = web_app_origin_text->AddVisibleChangedCallback(
view_hidden_runloop.QuitClosure());
view_hidden_runloop.Run();
EXPECT_EQ(0, visible_count);
@@ -244,7 +244,7 @@
else
view_hidden_runloop.Quit();
});
- auto subscription =
+ auto callback_subscription =
web_app_origin_text->AddVisibleChangedCallback(quit_runloop);
// Make sure the navigation has finished before proceeding.
url_observer.Wait();
diff --git a/chrome/browser/ui/views/frame/webui_tab_strip_field_trial_browsertest.cc b/chrome/browser/ui/views/frame/webui_tab_strip_field_trial_browsertest.cc
index ad28f1be..1ee791e 100644
--- a/chrome/browser/ui/views/frame/webui_tab_strip_field_trial_browsertest.cc
+++ b/chrome/browser/ui/views/frame/webui_tab_strip_field_trial_browsertest.cc
@@ -57,8 +57,8 @@
variations::SyntheticTrialsActiveGroupIdProvider::GetInstance()
->GetActiveGroupIds(&active_groups);
- for (const auto& id : active_groups) {
- LOG(ERROR) << id.name << " " << id.group;
+ for (const auto& group_id : active_groups) {
+ LOG(ERROR) << group_id.name << " " << group_id.group;
}
return std::any_of(active_groups.begin(), active_groups.end(),
diff --git a/chrome/browser/ui/views/page_info/page_info_view_factory.h b/chrome/browser/ui/views/page_info/page_info_view_factory.h
index f44b04b..08edf9a 100644
--- a/chrome/browser/ui/views/page_info/page_info_view_factory.h
+++ b/chrome/browser/ui/views/page_info/page_info_view_factory.h
@@ -26,7 +26,7 @@
static constexpr int kMaxBubbleWidth = 1000;
enum PageInfoViewID {
- VIEW_ID_NONE = 0,
+ VIEW_ID_PAGE_INFO_NONE = 0,
VIEW_ID_PAGE_INFO_BUTTON_CHANGE_PASSWORD,
VIEW_ID_PAGE_INFO_BUTTON_ALLOWLIST_PASSWORD_REUSE,
VIEW_ID_PAGE_INFO_LABEL_EV_CERTIFICATE_DETAILS,
diff --git a/chrome/browser/ui/views/payments/editor_view_controller.cc b/chrome/browser/ui/views/payments/editor_view_controller.cc
index ab19723..c6f1d19 100644
--- a/chrome/browser/ui/views/payments/editor_view_controller.cc
+++ b/chrome/browser/ui/views/payments/editor_view_controller.cc
@@ -439,11 +439,11 @@
break;
}
case EditorField::ControlType::READONLY_LABEL: {
- std::unique_ptr<views::Label> label =
+ std::unique_ptr<views::Label> readonly_label =
std::make_unique<views::Label>(GetInitialValueForType(field.type));
- label->SetID(GetInputFieldViewId(field.type));
- label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
- layout->AddView(std::move(label), 1, 1, views::GridLayout::FILL,
+ readonly_label->SetID(GetInputFieldViewId(field.type));
+ readonly_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
+ layout->AddView(std::move(readonly_label), 1, 1, views::GridLayout::FILL,
views::GridLayout::FILL, 0, kInputFieldHeight);
break;
}
diff --git a/chrome/browser/ui/views/payments/payment_method_view_controller.cc b/chrome/browser/ui/views/payments/payment_method_view_controller.cc
index 40add151..f53a96b 100644
--- a/chrome/browser/ui/views/payments/payment_method_view_controller.cc
+++ b/chrome/browser/ui/views/payments/payment_method_view_controller.cc
@@ -121,9 +121,9 @@
views::BoxLayout::CrossAxisAlignment::kStart);
card_info_container->SetLayoutManager(std::move(box_layout));
- std::u16string label = app_->GetLabel();
- if (!label.empty())
- card_info_container->AddChildView(new views::Label(label));
+ std::u16string label_str = app_->GetLabel();
+ if (!label_str.empty())
+ card_info_container->AddChildView(new views::Label(label_str));
std::u16string sublabel = app_->GetSublabel();
if (!sublabel.empty())
card_info_container->AddChildView(new views::Label(sublabel));
@@ -138,7 +138,7 @@
}
*accessible_content = l10n_util::GetStringFUTF16(
- IDS_PAYMENTS_PROFILE_LABELS_ACCESSIBLE_FORMAT, label, sublabel,
+ IDS_PAYMENTS_PROFILE_LABELS_ACCESSIBLE_FORMAT, label_str, sublabel,
missing_info);
return card_info_container;
diff --git a/chrome/browser/ui/views/payments/shipping_address_editor_view_controller.cc b/chrome/browser/ui/views/payments/shipping_address_editor_view_controller.cc
index 044386c..352277e9 100644
--- a/chrome/browser/ui/views/payments/shipping_address_editor_view_controller.cc
+++ b/chrome/browser/ui/views/payments/shipping_address_editor_view_controller.cc
@@ -535,21 +535,23 @@
}
for (const auto& field : comboboxes()) {
// ValidatingCombobox* is the key, EditorField is the value.
- ValidatingCombobox* combobox = field.first;
+ ValidatingCombobox* validating_combobox = field.first;
// The country has already been dealt with.
- if (combobox->GetID() ==
+ if (validating_combobox->GetID() ==
GetInputFieldViewId(autofill::ADDRESS_HOME_COUNTRY))
continue;
- if (combobox->IsValid()) {
- success = profile->SetInfo(
- field.second.type,
- combobox->GetTextForRow(combobox->GetSelectedIndex()), locale);
+ if (validating_combobox->IsValid()) {
+ success = profile->SetInfo(field.second.type,
+ validating_combobox->GetTextForRow(
+ validating_combobox->GetSelectedIndex()),
+ locale);
} else {
success = false;
}
LOG_IF(ERROR, !success && !ignore_errors)
<< "Can't setinfo(" << field.second.type << ", "
- << combobox->GetTextForRow(combobox->GetSelectedIndex());
+ << validating_combobox->GetTextForRow(
+ validating_combobox->GetSelectedIndex());
if (!success && !ignore_errors)
return false;
}
diff --git a/chrome/browser/ui/views/send_tab_to_self/send_tab_to_self_icon_view.cc b/chrome/browser/ui/views/send_tab_to_self/send_tab_to_self_icon_view.cc
index 71ea814..b5b7d538 100644
--- a/chrome/browser/ui/views/send_tab_to_self/send_tab_to_self_icon_view.cc
+++ b/chrome/browser/ui/views/send_tab_to_self/send_tab_to_self_icon_view.cc
@@ -87,7 +87,6 @@
}
if (!GetVisible() && omnibox_view->model()->has_focus() &&
!omnibox_view->model()->user_input_in_progress()) {
- SendTabToSelfBubbleController* controller = GetController();
// Shows the "Send" animation once per profile.
if (controller && !controller->InitialSendAnimationShown() &&
initial_animation_state_ == AnimationState::kNotShown) {
diff --git a/chrome/browser/ui/views/tabs/stacked_tab_strip_layout_unittest.cc b/chrome/browser/ui/views/tabs/stacked_tab_strip_layout_unittest.cc
index 2a23fef..6eacea9c 100644
--- a/chrome/browser/ui/views/tabs/stacked_tab_strip_layout_unittest.cc
+++ b/chrome/browser/ui/views/tabs/stacked_tab_strip_layout_unittest.cc
@@ -95,10 +95,10 @@
PrepareChildViews(static_cast<int>(positions.size()));
for (int i = 0; i < view_model_.view_size(); ++i) {
int x = 0;
- gfx::Rect bounds(view_model_.ideal_bounds(i));
+ gfx::Rect bounds_rect(view_model_.ideal_bounds(i));
ASSERT_TRUE(base::StringToInt(positions[i], &x));
- bounds.set_x(x);
- view_model_.set_ideal_bounds(i, bounds);
+ bounds_rect.set_x(x);
+ view_model_.set_ideal_bounds(i, bounds_rect);
}
}
diff --git a/chrome/browser/ui/views/tabs/tab_strip_unittest.cc b/chrome/browser/ui/views/tabs/tab_strip_unittest.cc
index b720ce3..1f267e0 100644
--- a/chrome/browser/ui/views/tabs/tab_strip_unittest.cc
+++ b/chrome/browser/ui/views/tabs/tab_strip_unittest.cc
@@ -710,7 +710,7 @@
EXPECT_GT(tab_strip_->GetTabCount(), 1);
- const int active_index = controller_->GetActiveIndex();
+ int active_index = controller_->GetActiveIndex();
EXPECT_EQ(tab_strip_->GetTabCount() - 1, active_index);
EXPECT_LT(tab_strip_->ideal_bounds(0).width(),
tab_strip_->ideal_bounds(active_index).width());
@@ -719,7 +719,7 @@
// wide as it's minimum width.
controller_->SelectTab(0, dummy_event_);
while (tab_strip_->GetTabCount() > 0) {
- const int active_index = controller_->GetActiveIndex();
+ active_index = controller_->GetActiveIndex();
EXPECT_GE(tab_strip_->ideal_bounds(active_index).width(),
TabStyleViews::GetMinimumActiveWidth());
tab_strip_->CloseTab(tab_strip_->tab_at(active_index),
@@ -1337,8 +1337,8 @@
ASSERT_GT(i, 0);
EXPECT_LT(i, invisible_tab_index);
invisible_tab_index = i;
- for (int i = invisible_tab_index + 1; i < tab_strip_->GetTabCount(); ++i)
- EXPECT_FALSE(tab_strip_->tab_at(i)->GetVisible());
+ for (int j = invisible_tab_index + 1; j < tab_strip_->GetTabCount(); ++j)
+ EXPECT_FALSE(tab_strip_->tab_at(j)->GetVisible());
// When we're already in overflow, adding tabs at the beginning or end of
// the strip should not change how many tabs are visible.
@@ -1352,8 +1352,8 @@
EXPECT_FALSE(tab_strip_->tab_at(invisible_tab_index)->GetVisible());
// If we remove enough tabs, all the tabs should be visible.
- for (int i = tab_strip_->GetTabCount() - 1; i >= invisible_tab_index; --i)
- controller_->RemoveTab(i);
+ for (int j = tab_strip_->GetTabCount() - 1; j >= invisible_tab_index; --j)
+ controller_->RemoveTab(j);
CompleteAnimationAndLayout();
EXPECT_TRUE(tab_strip_->tab_at(tab_strip_->GetTabCount() - 1)->GetVisible());
}
diff --git a/chrome/browser/ui/views/web_apps/web_app_url_handler_intent_picker_dialog_view.cc b/chrome/browser/ui/views/web_apps/web_app_url_handler_intent_picker_dialog_view.cc
index 3750ab7..ef2efa4 100644
--- a/chrome/browser/ui/views/web_apps/web_app_url_handler_intent_picker_dialog_view.cc
+++ b/chrome/browser/ui/views/web_apps/web_app_url_handler_intent_picker_dialog_view.cc
@@ -282,17 +282,17 @@
const size_t button_index = hover_buttons_.size();
// TODO(crbug.com/1072058): Make sure the UI is reasonable when
// |app_title| is long.
- auto app_button = std::make_unique<WebAppUrlHandlerHoverButton>(
+ auto button = std::make_unique<WebAppUrlHandlerHoverButton>(
base::BindRepeating(
&WebAppUrlHandlerIntentPickerView::SetSelectedAppIndex,
base::Unretained(this), button_index),
launch_params, provider, app_title,
registrar.GetAppStartUrl(launch_params.app_id));
- app_button->set_tag(button_index);
- app_button->GetViewAccessibility().OverridePosInSet(button_index + 1,
- total_buttons);
- hover_buttons_.push_back(app_button.get());
- scrollable_view->AddChildViewAt(std::move(app_button), button_index);
+ button->set_tag(button_index);
+ button->GetViewAccessibility().OverridePosInSet(button_index + 1,
+ total_buttons);
+ hover_buttons_.push_back(button.get());
+ scrollable_view->AddChildViewAt(std::move(button), button_index);
}
auto scroll_view = std::make_unique<views::ScrollView>();
diff --git a/chrome/browser/ui/webui/devtools_ui_data_source.cc b/chrome/browser/ui/webui/devtools_ui_data_source.cc
index c40be35..c2bc29c 100644
--- a/chrome/browser/ui/webui/devtools_ui_data_source.cc
+++ b/chrome/browser/ui/webui/devtools_ui_data_source.cc
@@ -151,11 +151,13 @@
remote_path_prefix += "/";
if (base::StartsWith(path, remote_path_prefix,
base::CompareCase::INSENSITIVE_ASCII)) {
- GURL url(kRemoteFrontendBase + path.substr(remote_path_prefix.length()));
+ GURL remote_url(kRemoteFrontendBase +
+ path.substr(remote_path_prefix.length()));
- CHECK_EQ(url.host(), kRemoteFrontendDomain);
- if (url.is_valid() && DevToolsUIBindings::IsValidRemoteFrontendURL(url)) {
- StartRemoteDataRequest(url, std::move(callback));
+ CHECK_EQ(remote_url.host(), kRemoteFrontendDomain);
+ if (remote_url.is_valid() &&
+ DevToolsUIBindings::IsValidRemoteFrontendURL(remote_url)) {
+ StartRemoteDataRequest(remote_url, std::move(callback));
} else {
DLOG(ERROR) << "Refusing to load invalid remote front-end URL";
std::move(callback).Run(CreateNotFoundResponse());
@@ -170,10 +172,10 @@
base::CompareCase::INSENSITIVE_ASCII)) {
GURL custom_devtools_frontend = GetCustomDevToolsFrontendURL();
if (!custom_devtools_frontend.is_empty()) {
- GURL url = GURL(custom_devtools_frontend.spec() +
- path.substr(custom_path_prefix.length()));
- DCHECK(url.is_valid());
- StartCustomDataRequest(url, std::move(callback));
+ GURL devtools_url(custom_devtools_frontend.spec() +
+ path.substr(custom_path_prefix.length()));
+ DCHECK(devtools_url.is_valid());
+ StartCustomDataRequest(devtools_url, std::move(callback));
return;
}
}
diff --git a/chrome/browser/ui/webui/quota_internals/quota_internals_proxy.cc b/chrome/browser/ui/webui/quota_internals/quota_internals_proxy.cc
index d244c7a..bb14b45 100644
--- a/chrome/browser/ui/webui/quota_internals/quota_internals_proxy.cc
+++ b/chrome/browser/ui/webui/quota_internals/quota_internals_proxy.cc
@@ -185,25 +185,25 @@
std::set<blink::StorageKey> storage_keys =
quota_manager_->GetCachedStorageKeys(type);
- std::vector<PerOriginStorageInfo> origin_info;
- origin_info.reserve(storage_keys.size());
+ std::vector<PerOriginStorageInfo> origin_infos;
+ origin_infos.reserve(storage_keys.size());
std::set<std::string> hosts;
- std::vector<PerHostStorageInfo> host_info;
+ std::vector<PerHostStorageInfo> host_infos;
for (const blink::StorageKey& storage_key : storage_keys) {
- PerOriginStorageInfo info(storage_key.origin().GetURL(), type);
- origin_info.push_back(info);
+ PerOriginStorageInfo per_origin_info(storage_key.origin().GetURL(), type);
+ origin_infos.push_back(per_origin_info);
const std::string& host = storage_key.origin().host();
if (hosts.insert(host).second) {
- PerHostStorageInfo info(host, type);
- host_info.push_back(info);
+ PerHostStorageInfo per_host_info(host, type);
+ host_infos.push_back(per_host_info);
VisitHost(host, type);
}
}
- ReportPerOriginInfo(origin_info);
- ReportPerHostInfo(host_info);
+ ReportPerOriginInfo(origin_infos);
+ ReportPerHostInfo(host_infos);
}
void QuotaInternalsProxy::VisitHost(const std::string& host, StorageType type) {
diff --git a/chrome/browser/ui/webui/signin/inline_login_ui.cc b/chrome/browser/ui/webui/signin/inline_login_ui.cc
index 4239e1f..9fded757 100644
--- a/chrome/browser/ui/webui/signin/inline_login_ui.cc
+++ b/chrome/browser/ui/webui/signin/inline_login_ui.cc
@@ -212,7 +212,7 @@
chromeos::prefs::kShouldSkipInlineLoginWelcomePage));
bool is_incognito_enabled =
(IncognitoModePrefs::GetAvailability(profile->GetPrefs()) !=
- IncognitoModePrefs::DISABLED);
+ IncognitoModePrefs::Availability::kDisabled);
int message_id =
is_incognito_enabled
? IDS_ACCOUNT_MANAGER_DIALOG_WELCOME_BODY
diff --git a/chrome/browser/ui/webui/test_data_source.cc b/chrome/browser/ui/webui/test_data_source.cc
index 7d1247bc..8ae2d5b 100644
--- a/chrome/browser/ui/webui/test_data_source.cc
+++ b/chrome/browser/ui/webui/test_data_source.cc
@@ -163,18 +163,18 @@
// generated at build time. We do this first as if a test file exists under
// the same name in the src and gen directories, the generated file is
// generally the desired file (for example, may have been preprocessed).
- base::FilePath file_path =
+ base::FilePath gen_root_file_path =
gen_root_.Append(base::FilePath::FromUTF8Unsafe(no_query_path));
- if (base::PathExists(file_path)) {
- CHECK(base::ReadFileToString(file_path, &content))
- << url.spec() << "=" << file_path.value();
+ if (base::PathExists(gen_root_file_path)) {
+ CHECK(base::ReadFileToString(gen_root_file_path, &content))
+ << url.spec() << "=" << gen_root_file_path.value();
} else {
// Then try the |src_root_| folder, covering cases where the test file is
// generated at build time.
- base::FilePath file_path =
+ base::FilePath src_root_file_path =
src_root_.Append(base::FilePath::FromUTF8Unsafe(no_query_path));
- CHECK(base::ReadFileToString(file_path, &content))
- << url.spec() << "=" << file_path.value();
+ CHECK(base::ReadFileToString(src_root_file_path, &content))
+ << url.spec() << "=" << src_root_file_path.value();
}
}
diff --git a/chrome/browser/ui/zoom/chrome_zoom_level_prefs.cc b/chrome/browser/ui/zoom/chrome_zoom_level_prefs.cc
index dbef294..4dd61721 100644
--- a/chrome/browser/ui/zoom/chrome_zoom_level_prefs.cc
+++ b/chrome/browser/ui/zoom/chrome_zoom_level_prefs.cc
@@ -211,11 +211,11 @@
DictionaryPrefUpdate update(pref_service_,
prefs::kPartitionPerHostZoomLevels);
base::DictionaryValue* host_zoom_dictionaries = update.Get();
- base::DictionaryValue* host_zoom_dictionary = nullptr;
+ base::DictionaryValue* partition_dictionary = nullptr;
host_zoom_dictionaries->GetDictionary(partition_key_,
- &host_zoom_dictionary);
+ &partition_dictionary);
for (const std::string& s : keys_to_remove)
- host_zoom_dictionary->RemoveKey(s);
+ partition_dictionary->RemoveKey(s);
}
}
diff --git a/chrome/browser/vr/elements/ui_element.h b/chrome/browser/vr/elements/ui_element.h
index cd77135..8c5515d 100644
--- a/chrome/browser/vr/elements/ui_element.h
+++ b/chrome/browser/vr/elements/ui_element.h
@@ -76,7 +76,7 @@
// The result of performing a hit test.
struct HitTestResult {
- enum Type {
+ enum class Type {
// The given ray does not pass through the element.
kNone = 0,
// The given ray does not pass through the element, but passes through the
diff --git a/chrome/browser/vr/webxr_vr_indicators_browser_test.cc b/chrome/browser/vr/webxr_vr_indicators_browser_test.cc
index 5203f49..fbbe3a0 100644
--- a/chrome/browser/vr/webxr_vr_indicators_browser_test.cc
+++ b/chrome/browser/vr/webxr_vr_indicators_browser_test.cc
@@ -111,9 +111,10 @@
auto utils = UiUtils::Create();
// Check if the location indicator shows.
- for (const TestIndicatorSetting& t : test_indicator_settings)
- utils->PerformActionAndWaitForVisibilityStatus(
- t.element_name, t.element_visibility, base::DoNothing::Once());
+ for (const TestIndicatorSetting& setting : test_indicator_settings)
+ utils->PerformActionAndWaitForVisibilityStatus(setting.element_name,
+ setting.element_visibility,
+ base::DoNothing::Once());
t->EndSessionOrFail();
}
diff --git a/chrome/browser/web_applications/system_web_apps/test/system_web_app_manager_unittest.cc b/chrome/browser/web_applications/system_web_apps/test/system_web_app_manager_unittest.cc
index 3f29b68c..2d848b5 100644
--- a/chrome/browser/web_applications/system_web_apps/test/system_web_app_manager_unittest.cc
+++ b/chrome/browser/web_applications/system_web_apps/test/system_web_app_manager_unittest.cc
@@ -1219,7 +1219,7 @@
}
TEST_F(SystemWebAppManagerTimerTest, TestTimerWaitsForIdle) {
- ui::ScopedSetIdleState idle(ui::IDLE_STATE_ACTIVE);
+ ui::ScopedSetIdleState scoped_active(ui::IDLE_STATE_ACTIVE);
SetupTimer(base::TimeDelta::FromSeconds(300), true);
TestWebAppUrlLoader* loader = nullptr;
@@ -1259,7 +1259,7 @@
EXPECT_EQ(base::Time::Now(), timers[0]->polling_since_time_for_testing());
{
- ui::ScopedSetIdleState idle(ui::IDLE_STATE_IDLE);
+ ui::ScopedSetIdleState scoped_idle(ui::IDLE_STATE_IDLE);
task_environment()->FastForwardBy(base::TimeDelta::FromSeconds(30));
EXPECT_EQ(SystemAppBackgroundTask::WAIT_PERIOD,
timers[0]->get_state_for_testing());
@@ -1275,7 +1275,7 @@
EXPECT_EQ(2u, timers[0]->opened_count_for_testing());
}
{
- ui::ScopedSetIdleState idle(ui::IDLE_STATE_LOCKED);
+ ui::ScopedSetIdleState scoped_locked(ui::IDLE_STATE_LOCKED);
loader->AddPrepareForLoadResults({WebAppUrlLoader::Result::kUrlLoaded});
loader->SetNextLoadUrlResult(AppUrl1(),
WebAppUrlLoader::Result::kUrlLoaded);
diff --git a/chrome/browser/web_applications/web_app_database.cc b/chrome/browser/web_applications/web_app_database.cc
index e7cf2ad..e5ac5bc 100644
--- a/chrome/browser/web_applications/web_app_database.cc
+++ b/chrome/browser/web_applications/web_app_database.cc
@@ -716,13 +716,14 @@
}
if (WebAppFileHandlerManager::IconsEnabled()) {
- absl::optional<std::vector<apps::IconInfo>> parsed_icon_infos =
+ absl::optional<std::vector<apps::IconInfo>> file_handler_icon_infos =
ParseAppIconInfos("WebApp", file_handler_proto.downloaded_icons());
- if (!parsed_icon_infos) {
+ if (!file_handler_icon_infos) {
// ParseAppIconInfos() reports any errors.
return nullptr;
}
- file_handler.downloaded_icons = std::move(parsed_icon_infos.value());
+ file_handler.downloaded_icons =
+ std::move(file_handler_icon_infos.value());
}
file_handlers.push_back(std::move(file_handler));
diff --git a/chrome/browser/web_applications/web_app_icon_manager_unittest.cc b/chrome/browser/web_applications/web_app_icon_manager_unittest.cc
index ebb8007..31732e1 100644
--- a/chrome/browser/web_applications/web_app_icon_manager_unittest.cc
+++ b/chrome/browser/web_applications/web_app_icon_manager_unittest.cc
@@ -82,9 +82,10 @@
std::map<SquareSizePx, SkBitmap> generated_bitmaps;
- for (size_t i = 0; i < info.sizes_px.size(); ++i)
- AddGeneratedIcon(&generated_bitmaps, info.sizes_px[i],
- info.colors[i]);
+ for (size_t j = 0; j < info.sizes_px.size(); ++j) {
+ AddGeneratedIcon(&generated_bitmaps, info.sizes_px[j],
+ info.colors[j]);
+ }
menu_item_icon_map.SetBitmapsForPurpose(info.purpose,
std::move(generated_bitmaps));
diff --git a/chrome/browser/web_applications/web_app_mover.h b/chrome/browser/web_applications/web_app_mover.h
index 784e2f8..b9b73e7b 100644
--- a/chrome/browser/web_applications/web_app_mover.h
+++ b/chrome/browser/web_applications/web_app_mover.h
@@ -68,7 +68,7 @@
void OnSyncShutdown(syncer::SyncService* sync_service) final;
private:
- enum WebAppMoverResult {
+ enum class WebAppMoverResult {
kInvalidConfiguration = 0,
kInstallAppExists = 1,
kNoAppsToUninstall = 2,
diff --git a/chrome/browser/webshare/win/fake_data_writer_factory_unittest.cc b/chrome/browser/webshare/win/fake_data_writer_factory_unittest.cc
index 3df5be0e..31733a2 100644
--- a/chrome/browser/webshare/win/fake_data_writer_factory_unittest.cc
+++ b/chrome/browser/webshare/win/fake_data_writer_factory_unittest.cc
@@ -92,11 +92,17 @@
ASSERT_HRESULT_FAILED(data_writer->FlushAsync(&flush_operation)),
"FlushAsync");
- // Expect failures from the destructor from not storing the data and not
- // flushing the data
- EXPECT_NONFATAL_FAILURE(
- EXPECT_NONFATAL_FAILURE(data_writer.Reset(), "pending storage"),
- "FlushAsync");
+ {
+ ::testing::TestPartResultArray gtest_failures;
+ ::testing::ScopedFakeTestPartResultReporter gtest_reporter(
+ ::testing::ScopedFakeTestPartResultReporter::
+ INTERCEPT_ONLY_CURRENT_THREAD,
+ >est_failures);
+ // Expect failures from the destructor from not storing the data and not
+ // flushing the data
+ data_writer.Reset();
+ EXPECT_EQ(gtest_failures.size(), 2) << "pending storage";
+ }
// Cleanup
ASSERT_HRESULT_SUCCEEDED(stream->Close());
diff --git a/chrome/browser/win/jumplist.cc b/chrome/browser/win/jumplist.cc
index 2a050c8..c6f1b9c 100644
--- a/chrome/browser/win/jumplist.cc
+++ b/chrome/browser/win/jumplist.cc
@@ -180,7 +180,7 @@
// collection. We use our application icon as the icon for this item.
// We remove '&' characters from this string so we can share it with our
// system menu.
- if (incognito_availability != IncognitoModePrefs::FORCED) {
+ if (incognito_availability != IncognitoModePrefs::Availability::kForced) {
scoped_refptr<ShellLinkItem> chrome = CreateShellLink(cmd_line_profile_dir);
std::u16string chrome_title = l10n_util::GetStringUTF16(IDS_NEW_WINDOW);
base::ReplaceSubstringsAfterOffset(&chrome_title, 0, u"&",
@@ -192,7 +192,7 @@
// Create an IShellLink object which launches Chrome in incognito mode, and
// add it to the collection.
- if (incognito_availability != IncognitoModePrefs::DISABLED) {
+ if (incognito_availability != IncognitoModePrefs::Availability::kDisabled) {
scoped_refptr<ShellLinkItem> incognito =
CreateShellLink(cmd_line_profile_dir);
incognito->GetCommandLine()->AppendSwitch(switches::kIncognito);