Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(257)

Unified Diff: chrome/browser/dom_ui/shared_resources_data_source.cc

Issue 2855021: Revert 50761 - Move the files in resources/shared/ into resources.pak... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/dom_ui/shared_resources_data_source.h ('k') | chrome/browser/resources/shared_resources.grd » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/dom_ui/shared_resources_data_source.cc
===================================================================
--- chrome/browser/dom_ui/shared_resources_data_source.cc (revision 50776)
+++ chrome/browser/dom_ui/shared_resources_data_source.cc (working copy)
@@ -1,88 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/dom_ui/shared_resources_data_source.h"
-
-#include "app/resource_bundle.h"
-#include "base/singleton.h"
-#include "chrome/browser/browser_process.h"
-#include "chrome/browser/chrome_thread.h"
-#include "chrome/browser/dom_ui/chrome_url_data_manager.h"
-#include "chrome/browser/io_thread.h"
-#include "chrome/common/url_constants.h"
-#include "grit/generated_resources.h"
-#include "grit/shared_resources.h"
-#include "grit/shared_resources_map.h"
-#include "grit/app_resources.h"
-#include "grit/theme_resources.h"
-#include "net/base/mime_util.h"
-
-namespace {
-
-int PathToIDR(const std::string& path) {
- int idr = -1;
- if (path == "images/bookmark_bar_folder_mac.png") {
- idr = IDR_BOOKMARK_BAR_FOLDER;
- } else if (path == "images/folder_closed.png") {
- idr = IDR_FOLDER_CLOSED;
- } else if (path == "images/folder_closed_rtl.png") {
- idr = IDR_FOLDER_CLOSED_RTL;
- } else if (path == "images/folder_open.png") {
- idr = IDR_FOLDER_OPEN;
- } else if (path == "images/folder_open_rtl.png") {
- idr = IDR_FOLDER_OPEN_RTL;
- } else {
- // The name of the files in the grd list are prefixed with the following
- // directory:
- std::string key("shared/");
- key += path;
-
- for (size_t i = 0; i < kSharedResourcesSize; ++i) {
- if (kSharedResources[i].name == key) {
- idr = kSharedResources[i].value;
- break;
- }
- }
- }
-
- return idr;
-}
-
-} // namespace
-
-// static
-void SharedResourcesDataSource::Register() {
- SharedResourcesDataSource* source = new SharedResourcesDataSource();
- ChromeThread::PostTask(
- ChromeThread::IO, FROM_HERE,
- NewRunnableMethod(
- Singleton<ChromeURLDataManager>::get(),
- &ChromeURLDataManager::AddDataSource,
- make_scoped_refptr(source)));
-}
-
-SharedResourcesDataSource::SharedResourcesDataSource()
- : DataSource(chrome::kChromeUIResourcesHost, NULL) {
-}
-
-SharedResourcesDataSource::~SharedResourcesDataSource() {
-}
-
-void SharedResourcesDataSource::StartDataRequest(const std::string& path,
- bool is_off_the_record,
- int request_id) {
- int idr = PathToIDR(path);
- DCHECK_NE(-1, idr);
- const ResourceBundle& rb = ResourceBundle::GetSharedInstance();
- scoped_refptr<RefCountedStaticMemory> bytes(rb.LoadDataResourceBytes(idr));
- SendResponse(request_id, bytes);
-}
-
-std::string SharedResourcesDataSource::GetMimeType(
- const std::string& path) const {
- std::string mime_type;
- net::GetMimeTypeFromFile(FilePath().AppendASCII(path), &mime_type);
- return mime_type;
-}
-
« no previous file with comments | « chrome/browser/dom_ui/shared_resources_data_source.h ('k') | chrome/browser/resources/shared_resources.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698