summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-23 17:03:08 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-23 17:03:08 +0000
commitbe22ebed50af76378fdccfb8c143495fde97f629 (patch)
treee75d1e663ba93d1891b05b89370b6ac1732836e4
parent061b425146105cd456261a9593ea44473c77e5ad (diff)
downloadchromium_src-be22ebed50af76378fdccfb8c143495fde97f629.zip
chromium_src-be22ebed50af76378fdccfb8c143495fde97f629.tar.gz
chromium_src-be22ebed50af76378fdccfb8c143495fde97f629.tar.bz2
Some minor refactoring to not depend on chrome for webui files that will move to content.
BUG=169170 Review URL: https://codereview.chromium.org/12047036 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@178312 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/ui/webui/chrome_url_data_manager_backend.cc3
-rw-r--r--chrome/browser/ui/webui/chrome_web_ui_data_source.cc5
-rw-r--r--chrome/browser/ui/webui/shared_resources_data_source.cc11
-rw-r--r--chrome/common/chrome_content_client.cc5
-rw-r--r--chrome/common/chrome_content_client.h2
-rw-r--r--chrome/common/chrome_content_client_ios.mm5
-rw-r--r--chrome/common/url_constants.cc2
-rw-r--r--chrome/common/url_constants.h2
-rw-r--r--content/public/common/content_client.cc5
-rw-r--r--content/public/common/content_client.h8
-rw-r--r--content/public/common/url_constants.cc5
-rw-r--r--content/public/common/url_constants.h4
12 files changed, 39 insertions, 18 deletions
diff --git a/chrome/browser/ui/webui/chrome_url_data_manager_backend.cc b/chrome/browser/ui/webui/chrome_url_data_manager_backend.cc
index c4ef56e..3e8b063 100644
--- a/chrome/browser/ui/webui/chrome_url_data_manager_backend.cc
+++ b/chrome/browser/ui/webui/chrome_url_data_manager_backend.cc
@@ -21,9 +21,8 @@
#include "base/string_util.h"
#include "chrome/browser/ui/webui/shared_resources_data_source.h"
#include "chrome/common/chrome_paths.h"
-#include "chrome/common/chrome_switches.h"
-#include "chrome/common/url_constants.h"
#include "content/public/browser/browser_thread.h"
+#include "content/public/common/url_constants.h"
#include "googleurl/src/url_util.h"
#include "grit/platform_locale_settings.h"
#include "net/base/io_buffer.h"
diff --git a/chrome/browser/ui/webui/chrome_web_ui_data_source.cc b/chrome/browser/ui/webui/chrome_web_ui_data_source.cc
index 3c8220a..5ed8122 100644
--- a/chrome/browser/ui/webui/chrome_web_ui_data_source.cc
+++ b/chrome/browser/ui/webui/chrome_web_ui_data_source.cc
@@ -9,8 +9,8 @@
#include "base/bind.h"
#include "base/memory/ref_counted_memory.h"
#include "base/string_util.h"
+#include "content/public/common/content_client.h"
#include "ui/base/l10n/l10n_util.h"
-#include "ui/base/resource/resource_bundle.h"
#include "ui/webui/jstemplate_builder.h"
#include "ui/webui/web_ui_util.h"
@@ -202,7 +202,6 @@ void ChromeWebUIDataSource::SendLocalizedStringsAsJSON(
void ChromeWebUIDataSource::SendFromResourceBundle(
const content::URLDataSource::GotDataCallback& callback, int idr) {
scoped_refptr<base::RefCountedStaticMemory> response(
- ResourceBundle::GetSharedInstance().LoadDataResourceBytes(
- idr));
+ content::GetContentClient()->GetDataResourceBytes(idr));
callback.Run(response);
}
diff --git a/chrome/browser/ui/webui/shared_resources_data_source.cc b/chrome/browser/ui/webui/shared_resources_data_source.cc
index 27c3ba0..9f53f03 100644
--- a/chrome/browser/ui/webui/shared_resources_data_source.cc
+++ b/chrome/browser/ui/webui/shared_resources_data_source.cc
@@ -4,20 +4,18 @@
#include "chrome/browser/ui/webui/shared_resources_data_source.h"
-#include <string>
-
+#include "base/logging.h"
#include "base/memory/ref_counted_memory.h"
#include "base/memory/singleton.h"
#include "base/threading/thread_restrictions.h"
-#include "chrome/browser/io_thread.h"
-#include "chrome/common/url_constants.h"
+#include "content/public/common/content_client.h"
+#include "content/public/common/url_constants.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
#include "grit/ui_resources.h"
#include "grit/webui_resources.h"
#include "grit/webui_resources_map.h"
#include "net/base/mime_util.h"
-#include "ui/base/resource/resource_bundle.h"
namespace {
@@ -51,9 +49,8 @@ void SharedResourcesDataSource::StartDataRequest(
const content::URLDataSource::GotDataCallback& callback) {
int idr = PathToIDR(path);
DCHECK_NE(-1, idr) << " path: " << path;
- const ResourceBundle& rb = ResourceBundle::GetSharedInstance();
scoped_refptr<base::RefCountedStaticMemory> bytes(
- rb.LoadDataResourceBytes(idr));
+ content::GetContentClient()->GetDataResourceBytes(idr));
callback.Run(bytes);
}
diff --git a/chrome/common/chrome_content_client.cc b/chrome/common/chrome_content_client.cc
index 577498b..1ff9b0a 100644
--- a/chrome/common/chrome_content_client.cc
+++ b/chrome/common/chrome_content_client.cc
@@ -434,6 +434,11 @@ base::StringPiece ChromeContentClient::GetDataResource(
resource_id, scale_factor);
}
+base::RefCountedStaticMemory* ChromeContentClient::GetDataResourceBytes(
+ int resource_id) const {
+ return ResourceBundle::GetSharedInstance().LoadDataResourceBytes(resource_id);
+}
+
gfx::Image& ChromeContentClient::GetNativeImageNamed(int resource_id) const {
return ResourceBundle::GetSharedInstance().GetNativeImageNamed(resource_id);
}
diff --git a/chrome/common/chrome_content_client.h b/chrome/common/chrome_content_client.h
index de0b960..414d7a7 100644
--- a/chrome/common/chrome_content_client.h
+++ b/chrome/common/chrome_content_client.h
@@ -36,6 +36,8 @@ class ChromeContentClient : public content::ContentClient {
virtual base::StringPiece GetDataResource(
int resource_id,
ui::ScaleFactor scale_factor) const OVERRIDE;
+ virtual base::RefCountedStaticMemory* GetDataResourceBytes(
+ int resource_id) const OVERRIDE;
virtual gfx::Image& GetNativeImageNamed(int resource_id) const OVERRIDE;
#if defined(OS_MACOSX) && !defined(OS_IOS)
diff --git a/chrome/common/chrome_content_client_ios.mm b/chrome/common/chrome_content_client_ios.mm
index c8b086e..963c1ad 100644
--- a/chrome/common/chrome_content_client_ios.mm
+++ b/chrome/common/chrome_content_client_ios.mm
@@ -75,6 +75,11 @@ base::StringPiece ChromeContentClient::GetDataResource(
resource_id, scale_factor);
}
+base::RefCountedStaticMemory* ChromeContentClient::GetDataResourceBytes(
+ int resource_id) const {
+ return ResourceBundle::GetSharedInstance().LoadDataResourceBytes(resource_id);
+}
+
gfx::Image& ChromeContentClient::GetNativeImageNamed(int resource_id) const {
return ResourceBundle::GetSharedInstance().GetNativeImageNamed(resource_id);
}
diff --git a/chrome/common/url_constants.cc b/chrome/common/url_constants.cc
index a5ed8a9..291ae0f 100644
--- a/chrome/common/url_constants.cc
+++ b/chrome/common/url_constants.cc
@@ -137,7 +137,6 @@ const char kChromeUICrashesHost[] = "crashes";
const char kChromeUICrashHost[] = "crash";
const char kChromeUICreditsHost[] = "credits";
const char kChromeUIDefaultHost[] = "version";
-const char kChromeUIDevToolsHost[] = "devtools";
const char kChromeUIDNSHost[] = "dns";
const char kChromeUIDownloadsHost[] = "downloads";
const char kChromeUIDriveInternalsHost[] = "drive-internals";
@@ -179,7 +178,6 @@ const char kChromeUIPredictorsHost[] = "predictors";
const char kChromeUIPrintHost[] = "print";
const char kChromeUIProfilerHost[] = "profiler";
const char kChromeUIQuotaInternalsHost[] = "quota-internals";
-const char kChromeUIResourcesHost[] = "resources";
const char kChromeUISessionFaviconHost[] = "session-favicon";
const char kChromeUISettingsHost[] = "settings";
const char kChromeUISettingsFrameHost[] = "settings-frame";
diff --git a/chrome/common/url_constants.h b/chrome/common/url_constants.h
index d877e9d..240d175 100644
--- a/chrome/common/url_constants.h
+++ b/chrome/common/url_constants.h
@@ -132,7 +132,6 @@ extern const char kChromeUICrashesHost[];
extern const char kChromeUICrashHost[];
extern const char kChromeUICreditsHost[];
extern const char kChromeUIDefaultHost[];
-extern const char kChromeUIDevToolsHost[];
extern const char kChromeUIDNSHost[];
extern const char kChromeUIDownloadsHost[];
extern const char kChromeUIDriveInternalsHost[];
@@ -174,7 +173,6 @@ extern const char kChromeUIPredictorsHost[];
extern const char kChromeUIPrintHost[];
extern const char kChromeUIProfilerHost[];
extern const char kChromeUIQuotaInternalsHost[];
-extern const char kChromeUIResourcesHost[];
extern const char kChromeUISessionFaviconHost[];
extern const char kChromeUISettingsHost[];
extern const char kChromeUISettingsFrameHost[];
diff --git a/content/public/common/content_client.cc b/content/public/common/content_client.cc
index d203e06..12457b7 100644
--- a/content/public/common/content_client.cc
+++ b/content/public/common/content_client.cc
@@ -78,6 +78,11 @@ base::StringPiece ContentClient::GetDataResource(
return base::StringPiece();
}
+base::RefCountedStaticMemory* ContentClient::GetDataResourceBytes(
+ int resource_id) const {
+ return NULL;
+}
+
gfx::Image& ContentClient::GetNativeImageNamed(int resource_id) const {
CR_DEFINE_STATIC_LOCAL(gfx::Image, kEmptyImage, ());
return kEmptyImage;
diff --git a/content/public/common/content_client.h b/content/public/common/content_client.h
index a3294e7..03788bc 100644
--- a/content/public/common/content_client.h
+++ b/content/public/common/content_client.h
@@ -18,6 +18,10 @@
class CommandLine;
class GURL;
+namespace base {
+class RefCountedStaticMemory;
+}
+
namespace IPC {
class Message;
}
@@ -123,6 +127,10 @@ class CONTENT_EXPORT ContentClient {
int resource_id,
ui::ScaleFactor scale_factor) const;
+ // Returns the raw bytes of a scale independent data resource.
+ virtual base::RefCountedStaticMemory* GetDataResourceBytes(
+ int resource_id) const;
+
// Returns a native image given its id.
virtual gfx::Image& GetNativeImageNamed(int resource_id) const;
diff --git a/content/public/common/url_constants.cc b/content/public/common/url_constants.cc
index baa17c4..15166ae 100644
--- a/content/public/common/url_constants.cc
+++ b/content/public/common/url_constants.cc
@@ -34,9 +34,12 @@ const char kAboutSrcDocURL[] = "about:srcdoc";
const char kChromeUIAppCacheInternalsHost[] = "appcache-internals";
const char kChromeUIBlobInternalsHost[] = "blob-internals";
const char kChromeUIBrowserCrashHost[] = "inducebrowsercrashforrealz";
+const char kChromeUIDevToolsHost[] = "devtools";
+const char kChromeUIHistogramHost[] = "histograms";
const char kChromeUINetworkViewCacheHost[] = "view-http-cache";
+const char kChromeUIResourcesHost[] = "resources";
const char kChromeUITcmallocHost[] = "tcmalloc";
-const char kChromeUIHistogramHost[] = "histograms";
+
const char kChromeUICrashURL[] = "chrome://crash";
const char kChromeUIGpuCleanURL[] = "chrome://gpuclean";
const char kChromeUIGpuCrashURL[] = "chrome://gpucrash";
diff --git a/content/public/common/url_constants.h b/content/public/common/url_constants.h
index 3504de6..158453d 100644
--- a/content/public/common/url_constants.h
+++ b/content/public/common/url_constants.h
@@ -40,9 +40,11 @@ CONTENT_EXPORT extern const char kAboutSrcDocURL[];
CONTENT_EXPORT extern const char kChromeUIAppCacheInternalsHost[];
CONTENT_EXPORT extern const char kChromeUIBlobInternalsHost[];
CONTENT_EXPORT extern const char kChromeUIBrowserCrashHost[];
+CONTENT_EXPORT extern const char kChromeUIDevToolsHost[];
+CONTENT_EXPORT extern const char kChromeUIHistogramHost[];
CONTENT_EXPORT extern const char kChromeUINetworkViewCacheHost[];
+CONTENT_EXPORT extern const char kChromeUIResourcesHost[];
CONTENT_EXPORT extern const char kChromeUITcmallocHost[];
-CONTENT_EXPORT extern const char kChromeUIHistogramHost[];
// Full about URLs (including schemes).
CONTENT_EXPORT extern const char kChromeUICrashURL[];