| Index: content/browser/webui/shared_resources_data_source.cc
|
| diff --git a/content/browser/webui/shared_resources_data_source.cc b/content/browser/webui/shared_resources_data_source.cc
|
| index d71556958be6acc1b88b665f23c4160f077e1e48..22101f8415485d97b1d16c4b499722a46c803378 100644
|
| --- a/content/browser/webui/shared_resources_data_source.cc
|
| +++ b/content/browser/webui/shared_resources_data_source.cc
|
| @@ -6,7 +6,6 @@
|
|
|
| #include <stddef.h>
|
|
|
| -#include "base/containers/hash_tables.h"
|
| #include "base/files/file_path.h"
|
| #include "base/logging.h"
|
| #include "base/memory/ref_counted_memory.h"
|
| @@ -27,8 +26,6 @@ namespace content {
|
|
|
| namespace {
|
|
|
| -using ResourcesMap = base::hash_map<std::string, int>;
|
| -
|
| // TODO(rkc): Once we have a separate source for apps, remove '*/apps/' aliases.
|
| const char* const kPathAliases[][2] = {
|
| {"../../../third_party/polymer/v1_0/components-chromium/", "polymer/v1_0/"},
|
| @@ -40,13 +37,14 @@ const char* const kPathAliases[][2] = {
|
|
|
| void AddResource(const std::string& path,
|
| int resource_id,
|
| - ResourcesMap* resources_map) {
|
| + SharedResourcesDataSource::ResourcesMap* resources_map) {
|
| if (!resources_map->insert(std::make_pair(path, resource_id)).second)
|
| NOTREACHED() << "Redefinition of '" << path << "'";
|
| }
|
|
|
| -const ResourcesMap* CreateResourcesMap() {
|
| - ResourcesMap* result = new ResourcesMap();
|
| +const SharedResourcesDataSource::ResourcesMap* CreateResourcesMap() {
|
| + SharedResourcesDataSource::ResourcesMap* result =
|
| + new SharedResourcesDataSource::ResourcesMap();
|
| for (size_t i = 0; i < kWebuiResourcesSize; ++i) {
|
| const std::string resource_name = kWebuiResources[i].name;
|
| const int resource_id = kWebuiResources[i].value;
|
| @@ -63,14 +61,15 @@ const ResourcesMap* CreateResourcesMap() {
|
| return result;
|
| }
|
|
|
| -const ResourcesMap& GetResourcesMap() {
|
| +} // namespace
|
| +
|
| +// static
|
| +const SharedResourcesDataSource::ResourcesMap& SharedResourcesDataSource::GetResourcesMap() {
|
| // This pointer will be intentionally leaked on shutdown.
|
| - static const ResourcesMap* resources_map = CreateResourcesMap();
|
| + static const SharedResourcesDataSource::ResourcesMap* resources_map = CreateResourcesMap();
|
| return *resources_map;
|
| }
|
|
|
| -} // namespace
|
| -
|
| SharedResourcesDataSource::SharedResourcesDataSource() {
|
| }
|
|
|
| @@ -86,7 +85,7 @@ void SharedResourcesDataSource::StartDataRequest(
|
| int render_process_id,
|
| int render_frame_id,
|
| const URLDataSource::GotDataCallback& callback) {
|
| - const ResourcesMap& resources_map = GetResourcesMap();
|
| + const SharedResourcesDataSource::ResourcesMap& resources_map = GetResourcesMap();
|
| auto it = resources_map.find(path);
|
| int idr = (it != resources_map.end()) ? it->second : -1;
|
| DCHECK_NE(-1, idr) << " path: " << path;
|
|
|