Commit 9f482eae authored by Oscar Johansson's avatar Oscar Johansson Committed by Commit Bot

Rename constants with the same name

When building with Jumbo, unnamed namespaces gets merged.
Constants with the same name within those namespaces conflict.
This commit renames those constant to something more file
specific.

Bug: 850484
Change-Id: If04a32cbf9ce544d852b1297f229d24d96845c59
Reviewed-on: https://chromium-review.googlesource.com/1096757
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: default avatarLei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#566596}
parent 93001349
...@@ -25,9 +25,9 @@ namespace ShowPermissionPromptForDelegatedInstall = ...@@ -25,9 +25,9 @@ namespace ShowPermissionPromptForDelegatedInstall =
namespace { namespace {
// Error messages that can be returned by the API. // Error messages that can be returned by the API.
const char kInvalidIconUrlError[] = "Invalid icon url"; const char kDashboardInvalidIconUrlError[] = "Invalid icon url";
const char kInvalidIdError[] = "Invalid id"; const char kDashboardInvalidIdError[] = "Invalid id";
const char kInvalidManifestError[] = "Invalid manifest"; const char kDashboardInvalidManifestError[] = "Invalid manifest";
const char kUserCancelledError[] = "User cancelled install"; const char kUserCancelledError[] = "User cancelled install";
api::dashboard_private::Result WebstoreInstallHelperResultToApiResult( api::dashboard_private::Result WebstoreInstallHelperResultToApiResult(
...@@ -61,16 +61,16 @@ DashboardPrivateShowPermissionPromptForDelegatedInstallFunction::Run() { ...@@ -61,16 +61,16 @@ DashboardPrivateShowPermissionPromptForDelegatedInstallFunction::Run() {
if (!crx_file::id_util::IdIsValid(params_->details.id)) { if (!crx_file::id_util::IdIsValid(params_->details.id)) {
return RespondNow(BuildResponse(api::dashboard_private::RESULT_INVALID_ID, return RespondNow(BuildResponse(api::dashboard_private::RESULT_INVALID_ID,
kInvalidIdError)); kDashboardInvalidIdError));
} }
GURL icon_url; GURL icon_url;
if (params_->details.icon_url) { if (params_->details.icon_url) {
icon_url = source_url().Resolve(*params_->details.icon_url); icon_url = source_url().Resolve(*params_->details.icon_url);
if (!icon_url.is_valid()) { if (!icon_url.is_valid()) {
return RespondNow(BuildResponse( return RespondNow(
api::dashboard_private::RESULT_INVALID_ICON_URL, BuildResponse(api::dashboard_private::RESULT_INVALID_ICON_URL,
kInvalidIconUrlError)); kDashboardInvalidIconUrlError));
} }
} }
...@@ -120,7 +120,7 @@ void DashboardPrivateShowPermissionPromptForDelegatedInstallFunction:: ...@@ -120,7 +120,7 @@ void DashboardPrivateShowPermissionPromptForDelegatedInstallFunction::
if (!dummy_extension_.get()) { if (!dummy_extension_.get()) {
OnWebstoreParseFailure(params_->details.id, OnWebstoreParseFailure(params_->details.id,
WebstoreInstallHelper::Delegate::MANIFEST_ERROR, WebstoreInstallHelper::Delegate::MANIFEST_ERROR,
kInvalidManifestError); kDashboardInvalidManifestError);
return; return;
} }
......
...@@ -26,7 +26,7 @@ namespace extensions { ...@@ -26,7 +26,7 @@ namespace extensions {
namespace { namespace {
const char kInvalidTypeOfParameter[] = "Attribute '%s' has an invalid type"; const char kCssInvalidTypeOfParameter[] = "Attribute '%s' has an invalid type";
} // namespace } // namespace
...@@ -48,14 +48,14 @@ DeclarativeContentCssPredicate::Create(ContentPredicateEvaluator* evaluator, ...@@ -48,14 +48,14 @@ DeclarativeContentCssPredicate::Create(ContentPredicateEvaluator* evaluator,
for (size_t i = 0; i < css_rules_value->GetSize(); ++i) { for (size_t i = 0; i < css_rules_value->GetSize(); ++i) {
std::string css_rule; std::string css_rule;
if (!css_rules_value->GetString(i, &css_rule)) { if (!css_rules_value->GetString(i, &css_rule)) {
*error = base::StringPrintf(kInvalidTypeOfParameter, *error = base::StringPrintf(kCssInvalidTypeOfParameter,
declarative_content_constants::kCss); declarative_content_constants::kCss);
return std::unique_ptr<DeclarativeContentCssPredicate>(); return std::unique_ptr<DeclarativeContentCssPredicate>();
} }
css_rules.push_back(css_rule); css_rules.push_back(css_rule);
} }
} else { } else {
*error = base::StringPrintf(kInvalidTypeOfParameter, *error = base::StringPrintf(kCssInvalidTypeOfParameter,
declarative_content_constants::kCss); declarative_content_constants::kCss);
return std::unique_ptr<DeclarativeContentCssPredicate>(); return std::unique_ptr<DeclarativeContentCssPredicate>();
} }
......
...@@ -19,7 +19,8 @@ namespace extensions { ...@@ -19,7 +19,8 @@ namespace extensions {
namespace { namespace {
const char kInvalidTypeOfParameter[] = "Attribute '%s' has an invalid type"; const char kIsBookmarkedInvalidTypeOfParameter[] =
"Attribute '%s' has an invalid type";
const char kIsBookmarkedRequiresBookmarkPermission[] = const char kIsBookmarkedRequiresBookmarkPermission[] =
"Property 'isBookmarked' requires 'bookmarks' permission"; "Property 'isBookmarked' requires 'bookmarks' permission";
...@@ -59,7 +60,7 @@ DeclarativeContentIsBookmarkedPredicate::Create( ...@@ -59,7 +60,7 @@ DeclarativeContentIsBookmarkedPredicate::Create(
evaluator, extension, is_bookmarked)); evaluator, extension, is_bookmarked));
} }
} else { } else {
*error = base::StringPrintf(kInvalidTypeOfParameter, *error = base::StringPrintf(kIsBookmarkedInvalidTypeOfParameter,
declarative_content_constants::kIsBookmarked); declarative_content_constants::kIsBookmarked);
return std::unique_ptr<DeclarativeContentIsBookmarkedPredicate>(); return std::unique_ptr<DeclarativeContentIsBookmarkedPredicate>();
} }
......
...@@ -17,7 +17,8 @@ namespace extensions { ...@@ -17,7 +17,8 @@ namespace extensions {
namespace { namespace {
const char kInvalidTypeOfParameter[] = "Attribute '%s' has an invalid type"; const char kPageUrlInvalidTypeOfParameter[] =
"Attribute '%s' has an invalid type";
static url_matcher::URLMatcherConditionSet::ID g_next_id = 0; static url_matcher::URLMatcherConditionSet::ID g_next_id = 0;
...@@ -40,7 +41,7 @@ DeclarativeContentPageUrlPredicate::Create( ...@@ -40,7 +41,7 @@ DeclarativeContentPageUrlPredicate::Create(
scoped_refptr<url_matcher::URLMatcherConditionSet> url_matcher_condition_set; scoped_refptr<url_matcher::URLMatcherConditionSet> url_matcher_condition_set;
const base::DictionaryValue* dict = nullptr; const base::DictionaryValue* dict = nullptr;
if (!value.GetAsDictionary(&dict)) { if (!value.GetAsDictionary(&dict)) {
*error = base::StringPrintf(kInvalidTypeOfParameter, *error = base::StringPrintf(kPageUrlInvalidTypeOfParameter,
declarative_content_constants::kPageUrl); declarative_content_constants::kPageUrl);
return std::unique_ptr<DeclarativeContentPageUrlPredicate>(); return std::unique_ptr<DeclarativeContentPageUrlPredicate>();
} else { } else {
......
...@@ -161,7 +161,7 @@ const char kFileSizeKey[] = "fileSize"; ...@@ -161,7 +161,7 @@ const char kFileSizeKey[] = "fileSize";
const char kFilenameKey[] = "filename"; const char kFilenameKey[] = "filename";
const char kFilenameRegexKey[] = "filenameRegex"; const char kFilenameRegexKey[] = "filenameRegex";
const char kIdKey[] = "id"; const char kIdKey[] = "id";
const char kIncognitoKey[] = "incognito"; const char kDownloadsApiIncognitoKey[] = "incognito";
const char kMimeKey[] = "mime"; const char kMimeKey[] = "mime";
const char kPausedKey[] = "paused"; const char kPausedKey[] = "paused";
const char kQueryKey[] = "query"; const char kQueryKey[] = "query";
...@@ -266,7 +266,8 @@ std::unique_ptr<base::DictionaryValue> DownloadItemToJSON( ...@@ -266,7 +266,8 @@ std::unique_ptr<base::DictionaryValue> DownloadItemToJSON(
base::TimeToISO8601(download_item->GetStartTime())); base::TimeToISO8601(download_item->GetStartTime()));
json->SetDouble(kBytesReceivedKey, download_item->GetReceivedBytes()); json->SetDouble(kBytesReceivedKey, download_item->GetReceivedBytes());
json->SetDouble(kTotalBytesKey, download_item->GetTotalBytes()); json->SetDouble(kTotalBytesKey, download_item->GetTotalBytes());
json->SetBoolean(kIncognitoKey, browser_context->IsOffTheRecord()); json->SetBoolean(kDownloadsApiIncognitoKey,
browser_context->IsOffTheRecord());
if (download_item->GetState() == DownloadItem::INTERRUPTED) { if (download_item->GetState() == DownloadItem::INTERRUPTED) {
json->SetString(kErrorKey, download::DownloadInterruptReasonToString( json->SetString(kErrorKey, download::DownloadInterruptReasonToString(
download_item->GetLastReason())); download_item->GetLastReason()));
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
namespace { namespace {
const size_t kMaximumMessageSize = 4096; // in bytes. const size_t kMaximumGcmMessageSize = 4096; // in bytes.
const char kCollapseKey[] = "collapse_key"; const char kCollapseKey[] = "collapse_key";
const char kGoogDotRestrictedPrefix[] = "goog."; const char kGoogDotRestrictedPrefix[] = "goog.";
const char kGoogleRestrictedPrefix[] = "google"; const char kGoogleRestrictedPrefix[] = "google";
...@@ -208,9 +208,9 @@ bool GcmSendFunction::ValidateMessageData(const gcm::MessageData& data) const { ...@@ -208,9 +208,9 @@ bool GcmSendFunction::ValidateMessageData(const gcm::MessageData& data) const {
total_size += iter->first.size() + iter->second.size(); total_size += iter->first.size() + iter->second.size();
if (!IsMessageKeyValid(iter->first) || if (!IsMessageKeyValid(iter->first) ||
kMaximumMessageSize < iter->first.size() || kMaximumGcmMessageSize < iter->first.size() ||
kMaximumMessageSize < iter->second.size() || kMaximumGcmMessageSize < iter->second.size() ||
kMaximumMessageSize < total_size) kMaximumGcmMessageSize < total_size)
return false; return false;
} }
......
...@@ -94,7 +94,7 @@ const char kNameKey[] = "name"; ...@@ -94,7 +94,7 @@ const char kNameKey[] = "name";
const char kMetadataKey[] = "metadata"; const char kMetadataKey[] = "metadata";
const char kAttachedImagesBlobInfoKey[] = "attachedImagesBlobInfo"; const char kAttachedImagesBlobInfoKey[] = "attachedImagesBlobInfo";
const char kBlobUUIDKey[] = "blobUUID"; const char kBlobUUIDKey[] = "blobUUID";
const char kTypeKey[] = "type"; const char kMediaGalleriesApiTypeKey[] = "type";
const char kSizeKey[] = "size"; const char kSizeKey[] = "size";
const char kInvalidGalleryId[] = "-1"; const char kInvalidGalleryId[] = "-1";
...@@ -752,7 +752,7 @@ void MediaGalleriesGetMetadataFunction::ConstructNextBlob( ...@@ -752,7 +752,7 @@ void MediaGalleriesGetMetadataFunction::ConstructNextBlob(
std::unique_ptr<base::DictionaryValue> attached_image( std::unique_ptr<base::DictionaryValue> attached_image(
new base::DictionaryValue); new base::DictionaryValue);
attached_image->SetString(kBlobUUIDKey, current_blob->GetUUID()); attached_image->SetString(kBlobUUIDKey, current_blob->GetUUID());
attached_image->SetString(kTypeKey, current_image->type); attached_image->SetString(kMediaGalleriesApiTypeKey, current_image->type);
attached_image->SetInteger( attached_image->SetInteger(
kSizeKey, base::checked_cast<int>(current_image->data.size())); kSizeKey, base::checked_cast<int>(current_image->data.size()));
attached_images_list->Append(std::move(attached_image)); attached_images_list->Append(std::move(attached_image));
......
...@@ -29,7 +29,7 @@ namespace { ...@@ -29,7 +29,7 @@ namespace {
// Maximum message size in bytes for messages received from Native Messaging // Maximum message size in bytes for messages received from Native Messaging
// hosts. Message size is limited mainly to prevent Chrome from crashing when // hosts. Message size is limited mainly to prevent Chrome from crashing when
// native application misbehaves (e.g. starts writing garbage to the pipe). // native application misbehaves (e.g. starts writing garbage to the pipe).
const size_t kMaximumMessageSize = 1024 * 1024; const size_t kMaximumNativeMessageSize = 1024 * 1024;
// Message header contains 4-byte integer size of the message. // Message header contains 4-byte integer size of the message.
const size_t kMessageHeaderSize = 4; const size_t kMessageHeaderSize = 4;
...@@ -273,7 +273,7 @@ void NativeMessageProcessHost::ProcessIncomingData( ...@@ -273,7 +273,7 @@ void NativeMessageProcessHost::ProcessIncomingData(
size_t message_size = size_t message_size =
*reinterpret_cast<const uint32_t*>(incoming_data_.data()); *reinterpret_cast<const uint32_t*>(incoming_data_.data());
if (message_size > kMaximumMessageSize) { if (message_size > kMaximumNativeMessageSize) {
LOG(ERROR) << "Native Messaging host tried sending a message that is " LOG(ERROR) << "Native Messaging host tried sending a message that is "
<< message_size << " bytes long."; << message_size << " bytes long.";
Close(kHostInputOutputError); Close(kHostInputOutputError);
......
...@@ -137,9 +137,9 @@ const char kWebstoreLogin[] = "extensions.webstore_login"; ...@@ -137,9 +137,9 @@ const char kWebstoreLogin[] = "extensions.webstore_login";
// Error messages that can be returned by the API. // Error messages that can be returned by the API.
const char kAlreadyInstalledError[] = "This item is already installed"; const char kAlreadyInstalledError[] = "This item is already installed";
const char kInvalidIconUrlError[] = "Invalid icon url"; const char kWebstoreInvalidIconUrlError[] = "Invalid icon url";
const char kInvalidIdError[] = "Invalid id"; const char kWebstoreInvalidIdError[] = "Invalid id";
const char kInvalidManifestError[] = "Invalid manifest"; const char kWebstoreInvalidManifestError[] = "Invalid manifest";
const char kNoPreviousBeginInstallWithManifestError[] = const char kNoPreviousBeginInstallWithManifestError[] =
"* does not match a previous call to beginInstallWithManifest3"; "* does not match a previous call to beginInstallWithManifest3";
const char kUserCancelledError[] = "User cancelled install"; const char kUserCancelledError[] = "User cancelled install";
...@@ -202,16 +202,16 @@ WebstorePrivateBeginInstallWithManifest3Function::Run() { ...@@ -202,16 +202,16 @@ WebstorePrivateBeginInstallWithManifest3Function::Run() {
if (!crx_file::id_util::IdIsValid(details().id)) { if (!crx_file::id_util::IdIsValid(details().id)) {
return RespondNow(BuildResponse(api::webstore_private::RESULT_INVALID_ID, return RespondNow(BuildResponse(api::webstore_private::RESULT_INVALID_ID,
kInvalidIdError)); kWebstoreInvalidIdError));
} }
GURL icon_url; GURL icon_url;
if (details().icon_url) { if (details().icon_url) {
icon_url = source_url().Resolve(*details().icon_url); icon_url = source_url().Resolve(*details().icon_url);
if (!icon_url.is_valid()) { if (!icon_url.is_valid()) {
return RespondNow(BuildResponse( return RespondNow(
api::webstore_private::RESULT_INVALID_ICON_URL, BuildResponse(api::webstore_private::RESULT_INVALID_ICON_URL,
kInvalidIconUrlError)); kWebstoreInvalidIconUrlError));
} }
} }
...@@ -275,7 +275,7 @@ void WebstorePrivateBeginInstallWithManifest3Function::OnWebstoreParseSuccess( ...@@ -275,7 +275,7 @@ void WebstorePrivateBeginInstallWithManifest3Function::OnWebstoreParseSuccess(
if (!dummy_extension_.get()) { if (!dummy_extension_.get()) {
OnWebstoreParseFailure(details().id, OnWebstoreParseFailure(details().id,
WebstoreInstallHelper::Delegate::MANIFEST_ERROR, WebstoreInstallHelper::Delegate::MANIFEST_ERROR,
kInvalidManifestError); kWebstoreInvalidManifestError);
return; return;
} }
...@@ -437,7 +437,7 @@ WebstorePrivateCompleteInstallFunction::Run() { ...@@ -437,7 +437,7 @@ WebstorePrivateCompleteInstallFunction::Run() {
} }
if (!crx_file::id_util::IdIsValid(params->expected_id)) if (!crx_file::id_util::IdIsValid(params->expected_id))
return RespondNow(Error(kInvalidIdError)); return RespondNow(Error(kWebstoreInvalidIdError));
approval_ = g_pending_approvals.Get().PopApproval( approval_ = g_pending_approvals.Get().PopApproval(
chrome_details_.GetProfile(), params->expected_id); chrome_details_.GetProfile(), params->expected_id);
......
...@@ -54,12 +54,12 @@ const char kCheckedKey[] = "checked"; ...@@ -54,12 +54,12 @@ const char kCheckedKey[] = "checked";
const char kContextsKey[] = "contexts"; const char kContextsKey[] = "contexts";
const char kDocumentURLPatternsKey[] = "document_url_patterns"; const char kDocumentURLPatternsKey[] = "document_url_patterns";
const char kEnabledKey[] = "enabled"; const char kEnabledKey[] = "enabled";
const char kIncognitoKey[] = "incognito"; const char kMenuManagerIncognitoKey[] = "incognito";
const char kParentUIDKey[] = "parent_uid"; const char kParentUIDKey[] = "parent_uid";
const char kStringUIDKey[] = "string_uid"; const char kStringUIDKey[] = "string_uid";
const char kTargetURLPatternsKey[] = "target_url_patterns"; const char kTargetURLPatternsKey[] = "target_url_patterns";
const char kTitleKey[] = "title"; const char kTitleKey[] = "title";
const char kTypeKey[] = "type"; const char kMenuManagerTypeKey[] = "type";
const char kVisibleKey[] = "visible"; const char kVisibleKey[] = "visible";
void SetIdKeyValue(base::DictionaryValue* properties, void SetIdKeyValue(base::DictionaryValue* properties,
...@@ -205,8 +205,8 @@ std::unique_ptr<base::DictionaryValue> MenuItem::ToValue() const { ...@@ -205,8 +205,8 @@ std::unique_ptr<base::DictionaryValue> MenuItem::ToValue() const {
// string IDs for items. // string IDs for items.
DCHECK_EQ(0, id_.uid); DCHECK_EQ(0, id_.uid);
value->SetString(kStringUIDKey, id_.string_uid); value->SetString(kStringUIDKey, id_.string_uid);
value->SetBoolean(kIncognitoKey, id_.incognito); value->SetBoolean(kMenuManagerIncognitoKey, id_.incognito);
value->SetInteger(kTypeKey, type_); value->SetInteger(kMenuManagerTypeKey, type_);
if (type_ != SEPARATOR) if (type_ != SEPARATOR)
value->SetString(kTitleKey, title_); value->SetString(kTitleKey, title_);
if (type_ == CHECKBOX || type_ == RADIO) if (type_ == CHECKBOX || type_ == RADIO)
...@@ -228,14 +228,14 @@ std::unique_ptr<MenuItem> MenuItem::Populate(const std::string& extension_id, ...@@ -228,14 +228,14 @@ std::unique_ptr<MenuItem> MenuItem::Populate(const std::string& extension_id,
const base::DictionaryValue& value, const base::DictionaryValue& value,
std::string* error) { std::string* error) {
bool incognito = false; bool incognito = false;
if (!value.GetBoolean(kIncognitoKey, &incognito)) if (!value.GetBoolean(kMenuManagerIncognitoKey, &incognito))
return nullptr; return nullptr;
Id id(incognito, MenuItem::ExtensionKey(extension_id)); Id id(incognito, MenuItem::ExtensionKey(extension_id));
if (!value.GetString(kStringUIDKey, &id.string_uid)) if (!value.GetString(kStringUIDKey, &id.string_uid))
return nullptr; return nullptr;
int type_int; int type_int;
Type type = NORMAL; Type type = NORMAL;
if (!value.GetInteger(kTypeKey, &type_int)) if (!value.GetInteger(kMenuManagerTypeKey, &type_int))
return nullptr; return nullptr;
type = static_cast<Type>(type_int); type = static_cast<Type>(type_int);
std::string title; std::string title;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment