diff options
author | erg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-24 22:34:09 +0000 |
---|---|---|
committer | erg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-24 22:34:09 +0000 |
commit | 01b12ba89a6117a849ac2537d58991c76f2f2da2 (patch) | |
tree | cd6ffd0ee6e1dc18c1bd5fe39c47ea1c1e9d3851 /chrome/browser | |
parent | 9b7262502272c7ea9016b9ed21b0f828f75b5998 (diff) | |
download | chromium_src-01b12ba89a6117a849ac2537d58991c76f2f2da2.zip chromium_src-01b12ba89a6117a849ac2537d58991c76f2f2da2.tar.gz chromium_src-01b12ba89a6117a849ac2537d58991c76f2f2da2.tar.bz2 |
Revert 50761 - Move the files in resources/shared/ into resources.pak
BUG=35793,42770
TEST=none
Review URL: http://codereview.chromium.org/2817026
TBR=erg@chromium.org
Review URL: http://codereview.chromium.org/2855021
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50777 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/dom_ui/chrome_url_data_manager.cc | 15 | ||||
-rw-r--r-- | chrome/browser/dom_ui/shared_resources_data_source.cc | 88 | ||||
-rw-r--r-- | chrome/browser/dom_ui/shared_resources_data_source.h | 33 | ||||
-rw-r--r-- | chrome/browser/resources/shared_resources.grd | 78 |
4 files changed, 13 insertions, 201 deletions
diff --git a/chrome/browser/dom_ui/chrome_url_data_manager.cc b/chrome/browser/dom_ui/chrome_url_data_manager.cc index c5aad64..a011801 100644 --- a/chrome/browser/dom_ui/chrome_url_data_manager.cc +++ b/chrome/browser/dom_ui/chrome_url_data_manager.cc @@ -19,7 +19,6 @@ #include "chrome/browser/appcache/view_appcache_internals_job_factory.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/chrome_thread.h" -#include "chrome/browser/dom_ui/shared_resources_data_source.h" #include "chrome/browser/net/chrome_url_request_context.h" #include "chrome/browser/net/view_http_cache_job_factory.h" #include "chrome/common/chrome_paths.h" @@ -99,7 +98,13 @@ void RegisterURLRequestChromeJob() { chrome::kChromeUIDevToolsHost, inspector_dir); } - SharedResourcesDataSource::Register(); + // Set up the chrome://resources/ source. + FilePath resources_dir; + if (PathService::Get(chrome::DIR_SHARED_RESOURCES, &resources_dir)) { + Singleton<ChromeURLDataManager>()->AddFileSource( + chrome::kChromeUIResourcesHost, resources_dir); + } + URLRequest::RegisterProtocolFactory(chrome::kChromeUIScheme, &ChromeURLDataManager::Factory); } @@ -110,6 +115,12 @@ void UnregisterURLRequestChromeJob() { Singleton<ChromeURLDataManager>()->RemoveFileSource( chrome::kChromeUIDevToolsHost); } + + FilePath resources_dir; + if (PathService::Get(chrome::DIR_SHARED_RESOURCES, &resources_dir)) { + Singleton<ChromeURLDataManager>()->RemoveFileSource( + chrome::kChromeUIResourcesHost); + } } // static diff --git a/chrome/browser/dom_ui/shared_resources_data_source.cc b/chrome/browser/dom_ui/shared_resources_data_source.cc deleted file mode 100644 index d460cdd..0000000 --- a/chrome/browser/dom_ui/shared_resources_data_source.cc +++ /dev/null @@ -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; -} - diff --git a/chrome/browser/dom_ui/shared_resources_data_source.h b/chrome/browser/dom_ui/shared_resources_data_source.h deleted file mode 100644 index 0dfe83a..0000000 --- a/chrome/browser/dom_ui/shared_resources_data_source.h +++ /dev/null @@ -1,33 +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. - -#ifndef CHROME_BROWSER_DOM_UI_SHARED_RESOURCES_DATA_SOURCE_H_ -#define CHROME_BROWSER_DOM_UI_SHARED_RESOURCES_DATA_SOURCE_H_ - -#include "chrome/browser/dom_ui/chrome_url_data_manager.h" - -class GURL; -class URLRequest; -class URLRequestJob; - -// A DataSource for chrome://resources/ URLs. -class SharedResourcesDataSource : public ChromeURLDataManager::DataSource { - public: - // Registers an instance of this data source with the ChromeUrlDataManager. - static void Register(); - - // Overridden from ChromeURLDataManager::DataSource: - virtual void StartDataRequest(const std::string& path, - bool is_off_the_record, - int request_id); - virtual std::string GetMimeType(const std::string&) const; - - private: - SharedResourcesDataSource(); - ~SharedResourcesDataSource(); - - DISALLOW_COPY_AND_ASSIGN(SharedResourcesDataSource); -}; - -#endif // CHROME_BROWSER_DOM_UI_SHARED_RESOURCES_DATA_SOURCE_H_ diff --git a/chrome/browser/resources/shared_resources.grd b/chrome/browser/resources/shared_resources.grd deleted file mode 100644 index 371aad0..0000000 --- a/chrome/browser/resources/shared_resources.grd +++ /dev/null @@ -1,78 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- This comment is only here because changes to resources are not picked up -without changes to the corresponding grd file. paaaae --> -<grit latest_public_release="0" current_release="1"> - <outputs> - <output filename="grit/shared_resources.h" type="rc_header"> - <emit emit_type='prepend'></emit> - </output> - <output filename="shared_resources.pak" type="data_package" /> - <output filename="grit/shared_resources_map.h" type="resource_map_header" /> - <output filename="grit/shared_resources_map.cc" type="resource_file_map_source" /> - </outputs> - <release seq="1"> - <includes> - <!-- shared/css/ --> - <include name="IDR_SHARED_CSS_BUTTON" - file="shared/css/button.css" type="BINDATA" /> - <include name="IDR_SHARED_CSS_LIST" - file="shared/css/list.css" type="BINDATA" /> - <include name="IDR_SHARED_CSS_MENU" - file="shared/css/menu.css" type="BINDATA" /> - <include name="IDR_SHARED_CSS_TREE" - file="shared/css/tree.css" type="BINDATA" /> - <include name="IDR_SHARED_CSS_TREE_JS" - file="shared/css/tree.css.js" type="BINDATA" /> - - <!-- shared/js/ --> - <include name="IDR_SHARED_JS_CLASS_LIST" - file="shared/js/class_list.js" type="BINDATA" /> - <include name="IDR_SHARED_JS_CR" - file="shared/js/cr.js" type="BINDATA" /> - <include name="IDR_SHARED_JS_I18N_TEMPLATE" - file="shared/js/i18n_template.js" type="BINDATA" /> - <include name="IDR_SHARED_JS_LOCAL_STRINGS" - file="shared/js/local_strings.js" type="BINDATA" /> - <include name="IDR_SHARED_JS_PARSE_HTML_SUBSET" - file="shared/js/parse_html_subset.js" type="BINDATA" /> - <include name="IDR_SHARED_JS_UTIL" - file="shared/js/util.js" type="BINDATA" /> - - <!-- shared/js/cr --> - <include name="IDR_SHARED_JS_CR_EVENT_TARGET" - file="shared/js/cr/event_target.js" type="BINDATA" /> - <include name="IDR_SHARED_JS_CR_LINK_CONTROLLER" - file="shared/js/cr/link_controller.js" type="BINDATA" /> - <include name="IDR_SHARED_JS_CR_PROMISE" - file="shared/js/cr/promise.js" type="BINDATA" /> - <include name="IDR_SHARED_JS_CR_UI" - file="shared/js/cr/ui.js" type="BINDATA" /> - - <!-- shared/js/cr/ui --> - <include name="IDR_SHARED_JS_CR_UI_ARRAY_DATA_MODEL" - file="shared/js/cr/ui/array_data_model.js" type="BINDATA" /> - <include name="IDR_SHARED_JS_CR_UI_COMMAND" - file="shared/js/cr/ui/command.js" type="BINDATA" /> - <include name="IDR_SHARED_JS_CR_UI_CONTEXT_MENU_HANDLER" - file="shared/js/cr/ui/context_menu_handler.js" type="BINDATA" /> - <include name="IDR_SHARED_JS_CR_UI_LIST_ITEM" - file="shared/js/cr/ui/list_item.js" type="BINDATA" /> - <include name="IDR_SHARED_JS_CR_UI_LIST" - file="shared/js/cr/ui/list.js" type="BINDATA" /> - <include name="IDR_SHARED_JS_CR_UI_LIST_SELECTION_MODEL" - file="shared/js/cr/ui/list_selection_model.js" type="BINDATA" /> - <include name="IDR_SHARED_JS_CR_UI_MENU_BUTTON" - file="shared/js/cr/ui/menu_button.js" type="BINDATA" /> - <include name="IDR_SHARED_JS_CR_UI_MENU_ITEM" - file="shared/js/cr/ui/menu_item.js" type="BINDATA" /> - <include name="IDR_SHARED_JS_CR_UI_MENU" - file="shared/js/cr/ui/menu.js" type="BINDATA" /> - <include name="IDR_SHARED_JS_CR_UI_POSITION_UTIL" - file="shared/js/cr/ui/position_util.js" type="BINDATA" /> - <include name="IDR_SHARED_JS_CR_UI_SPLITTER" - file="shared/js/cr/ui/splitter.js" type="BINDATA" /> - <include name="IDR_SHARED_JS_CR_UI_TREE" - file="shared/js/cr/ui/tree.js" type="BINDATA" /> - </includes> - </release> -</grit> |