Index: chrome/browser/extensions/api/downloads/downloads_api.cc |
diff --git a/chrome/browser/extensions/api/downloads/downloads_api.cc b/chrome/browser/extensions/api/downloads/downloads_api.cc |
index 84e184241feb522b78641491b08839f0913d2ecc..4676961f6c3dfe128a3ef04f6a892f7df143374d 100644 |
--- a/chrome/browser/extensions/api/downloads/downloads_api.cc |
+++ b/chrome/browser/extensions/api/downloads/downloads_api.cc |
@@ -167,7 +167,7 @@ const char kUrlRegexKey[] = "urlRegex"; |
// Note: Any change to the danger type strings, should be accompanied by a |
// corresponding change to downloads.json. |
-const char* kDangerStrings[] = { |
+const char* const kDangerStrings[] = { |
kDangerSafe, |
kDangerFile, |
kDangerUrl, |
@@ -183,7 +183,7 @@ COMPILE_ASSERT(arraysize(kDangerStrings) == content::DOWNLOAD_DANGER_TYPE_MAX, |
// Note: Any change to the state strings, should be accompanied by a |
// corresponding change to downloads.json. |
-const char* kStateStrings[] = { |
+const char* const kStateStrings[] = { |
kStateInProgress, |
kStateComplete, |
kStateInterrupted, |
@@ -347,7 +347,8 @@ IconLoader::IconSize IconLoaderSizeFromPixelSize(int pixel_size) { |
typedef base::hash_map<std::string, DownloadQuery::FilterType> FilterTypeMap; |
-void InitFilterTypeMap(FilterTypeMap& filter_types) { |
+void InitFilterTypeMap(FilterTypeMap* filter_types_ptr) { |
+ FilterTypeMap& filter_types = *filter_types_ptr; |
filter_types[kBytesReceivedKey] = DownloadQuery::FILTER_BYTES_RECEIVED; |
filter_types[kExistsKey] = DownloadQuery::FILTER_EXISTS; |
filter_types[kFilenameKey] = DownloadQuery::FILTER_FILENAME; |
@@ -371,7 +372,8 @@ void InitFilterTypeMap(FilterTypeMap& filter_types) { |
typedef base::hash_map<std::string, DownloadQuery::SortType> SortTypeMap; |
-void InitSortTypeMap(SortTypeMap& sorter_types) { |
+void InitSortTypeMap(SortTypeMap* sorter_types_ptr) { |
+ SortTypeMap& sorter_types = *sorter_types_ptr; |
sorter_types[kBytesReceivedKey] = DownloadQuery::SORT_BYTES_RECEIVED; |
sorter_types[kDangerKey] = DownloadQuery::SORT_DANGER; |
sorter_types[kEndTimeKey] = DownloadQuery::SORT_END_TIME; |
@@ -454,8 +456,8 @@ void CompileDownloadQueryOrderBy( |
// comparisons. |
static base::LazyInstance<SortTypeMap> sorter_types = |
LAZY_INSTANCE_INITIALIZER; |
- if (sorter_types.Get().size() == 0) |
- InitSortTypeMap(sorter_types.Get()); |
+ if (sorter_types.Get().empty()) |
+ InitSortTypeMap(sorter_types.Pointer()); |
for (std::vector<std::string>::const_iterator iter = order_by_strs.begin(); |
iter != order_by_strs.end(); ++iter) { |
@@ -487,8 +489,8 @@ void RunDownloadQuery( |
// comparisons. |
static base::LazyInstance<FilterTypeMap> filter_types = |
LAZY_INSTANCE_INITIALIZER; |
- if (filter_types.Get().size() == 0) |
- InitFilterTypeMap(filter_types.Get()); |
+ if (filter_types.Get().empty()) |
+ InitFilterTypeMap(filter_types.Pointer()); |
DownloadQuery query_out; |