summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorfischman@chromium.org <fischman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-17 21:28:20 +0000
committerfischman@chromium.org <fischman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-17 21:28:20 +0000
commit61a796c49a99e1e43e462ffd20a489f2142efcc8 (patch)
tree255809046b1d17f645b2fad9d3ecebf06c628915 /content
parent3a62d03239d6e7aacdb94650aae6d962badc0c24 (diff)
downloadchromium_src-61a796c49a99e1e43e462ffd20a489f2142efcc8.zip
chromium_src-61a796c49a99e1e43e462ffd20a489f2142efcc8.tar.gz
chromium_src-61a796c49a99e1e43e462ffd20a489f2142efcc8.tar.bz2
Revert 137734 - Select theme resources from ResourceBundle at requested scale factor.
Return the best match for a requested scale factor when fetching raw image data from ResourceBundle. TBR=aa,abodenha BUG=123611 TEST=ResourceBundle.LoadImageResourceBytes Review URL: https://chromiumcodereview.appspot.com/10387010 TBR=flackr@chromium.org git-svn-id: svn://svn.chromium.org/chrome/trunk/src@137738 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/browser/debugger/devtools_http_handler_impl.cc4
-rw-r--r--content/common/sandbox_mac.mm7
-rw-r--r--content/common/webkitplatformsupport_impl.cc11
-rw-r--r--content/common/webkitplatformsupport_impl.h7
-rw-r--r--content/public/common/content_client.h10
-rw-r--r--content/renderer/render_thread_impl.cc5
-rw-r--r--content/shell/layout_test_controller_bindings.cc4
-rw-r--r--content/shell/shell_content_client.cc13
-rw-r--r--content/shell/shell_content_client.h6
-rw-r--r--content/shell/shell_devtools_delegate.cc4
-rw-r--r--content/test/test_content_client.cc12
-rw-r--r--content/test/test_content_client.h6
12 files changed, 48 insertions, 41 deletions
diff --git a/content/browser/debugger/devtools_http_handler_impl.cc b/content/browser/debugger/devtools_http_handler_impl.cc
index e00d4ab..bbe45a4 100644
--- a/content/browser/debugger/devtools_http_handler_impl.cc
+++ b/content/browser/debugger/devtools_http_handler_impl.cc
@@ -38,7 +38,6 @@
#include "net/server/http_server_request_info.h"
#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_context_getter.h"
-#include "ui/base/layout.h"
namespace content {
@@ -231,8 +230,7 @@ void DevToolsHttpHandlerImpl::OnHttpRequest(
int resource_id = DevToolsHttpHandler::GetFrontendResourceId(filename);
if (resource_id != -1) {
base::StringPiece data =
- content::GetContentClient()->GetDataResource(
- resource_id, ui::SCALE_FACTOR_NONE);
+ content::GetContentClient()->GetDataResource(resource_id);
server_->Send200(connection_id,
data.as_string(),
GetMimeType(filename));
diff --git a/content/common/sandbox_mac.mm b/content/common/sandbox_mac.mm
index 90b7fe9..679fddf 100644
--- a/content/common/sandbox_mac.mm
+++ b/content/common/sandbox_mac.mm
@@ -31,7 +31,6 @@ extern "C" {
#include "content/public/common/content_client.h"
#include "content/public/common/content_switches.h"
#include "grit/content_resources.h"
-#include "ui/base/layout.h"
#include "ui/gl/gl_surface.h"
#include "unicode/uchar.h"
@@ -364,8 +363,7 @@ NSString* LoadSandboxTemplate(int sandbox_type) {
}
base::StringPiece sandbox_definition =
- content::GetContentClient()->GetDataResource(
- sandbox_profile_resource_id, ui::SCALE_FACTOR_NONE);
+ content::GetContentClient()->GetDataResource(sandbox_profile_resource_id);
if (sandbox_definition.empty()) {
LOG(FATAL) << "Failed to load the sandbox profile (resource id "
<< sandbox_profile_resource_id << ")";
@@ -373,8 +371,7 @@ NSString* LoadSandboxTemplate(int sandbox_type) {
}
base::StringPiece common_sandbox_definition =
- content::GetContentClient()->GetDataResource(
- IDR_COMMON_SANDBOX_PROFILE, ui::SCALE_FACTOR_NONE);
+ content::GetContentClient()->GetDataResource(IDR_COMMON_SANDBOX_PROFILE);
if (common_sandbox_definition.empty()) {
LOG(FATAL) << "Failed to load the common sandbox profile";
return nil;
diff --git a/content/common/webkitplatformsupport_impl.cc b/content/common/webkitplatformsupport_impl.cc
index 0fc1f2b..6309d9c 100644
--- a/content/common/webkitplatformsupport_impl.cc
+++ b/content/common/webkitplatformsupport_impl.cc
@@ -24,10 +24,15 @@ string16 WebKitPlatformSupportImpl::GetLocalizedString(int message_id) {
}
base::StringPiece WebKitPlatformSupportImpl::GetDataResource(
+ int resource_id) {
+ return content::GetContentClient()->GetDataResource(resource_id);
+}
+
+base::StringPiece WebKitPlatformSupportImpl::GetImageResource(
int resource_id,
- ui::ScaleFactor scale_factor) {
- return content::GetContentClient()->GetDataResource(resource_id,
- scale_factor);
+ float scale_factor) {
+ return content::GetContentClient()->GetImageResource(resource_id,
+ scale_factor);
}
void WebKitPlatformSupportImpl::GetPlugins(
diff --git a/content/common/webkitplatformsupport_impl.h b/content/common/webkitplatformsupport_impl.h
index 8d1e2f5..c190ae6 100644
--- a/content/common/webkitplatformsupport_impl.h
+++ b/content/common/webkitplatformsupport_impl.h
@@ -8,7 +8,6 @@
#include "base/compiler_specific.h"
#include "content/common/content_export.h"
-#include "ui/base/layout.h"
#include "webkit/glue/webkitplatformsupport_impl.h"
class GpuChannelHostFactory;
@@ -24,9 +23,9 @@ class CONTENT_EXPORT WebKitPlatformSupportImpl
virtual ~WebKitPlatformSupportImpl();
virtual string16 GetLocalizedString(int message_id) OVERRIDE;
- virtual base::StringPiece GetDataResource(
- int resource_id,
- ui::ScaleFactor scale_factor) OVERRIDE;
+ virtual base::StringPiece GetDataResource(int resource_id) OVERRIDE;
+ virtual base::StringPiece GetImageResource(int resource_id,
+ float scale_factor) OVERRIDE;
virtual void GetPlugins(bool refresh,
std::vector<webkit::WebPluginInfo>* plugins) OVERRIDE;
virtual webkit_glue::ResourceLoaderBridge* CreateResourceLoader(
diff --git a/content/public/common/content_client.h b/content/public/common/content_client.h
index 1190328..61ad9b9 100644
--- a/content/public/common/content_client.h
+++ b/content/public/common/content_client.h
@@ -14,7 +14,6 @@
#include "base/string_piece.h"
#include "build/build_config.h"
#include "content/common/content_export.h"
-#include "ui/base/layout.h"
class CommandLine;
class GURL;
@@ -116,9 +115,12 @@ class CONTENT_EXPORT ContentClient {
virtual string16 GetLocalizedString(int message_id) const = 0;
// Return the contents of a resource in a StringPiece given the resource id.
- virtual base::StringPiece GetDataResource(
- int resource_id,
- ui::ScaleFactor scale_factor) const = 0;
+ virtual base::StringPiece GetDataResource(int resource_id) const = 0;
+
+ // Return the contents of an image resource in a StringPiece given the
+ // resource id.
+ virtual base::StringPiece GetImageResource(int resource_id,
+ float scale_factor) const = 0;
#if defined(OS_WIN)
// Allows the embedder to sandbox a plugin, and apply a custom policy.
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc
index dce3836..3df9f77 100644
--- a/content/renderer/render_thread_impl.cc
+++ b/content/renderer/render_thread_impl.cc
@@ -77,9 +77,8 @@
#include "third_party/WebKit/Source/WebKit/chromium/public/WebRuntimeFeatures.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptController.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityPolicy.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
-#include "ui/base/layout.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
#include "ui/base/ui_base_switches.h"
#include "v8/include/v8.h"
#include "webkit/glue/webkit_glue.h"
@@ -493,7 +492,7 @@ void RenderThreadImpl::EnsureWebKitInitialized() {
if (CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDomAutomationController)) {
base::StringPiece extension = content::GetContentClient()->GetDataResource(
- IDR_DOM_AUTOMATION_JS, ui::SCALE_FACTOR_NONE);
+ IDR_DOM_AUTOMATION_JS);
RegisterExtension(new v8::Extension(
"dom_automation.js", extension.data(), 0, NULL, extension.size()));
}
diff --git a/content/shell/layout_test_controller_bindings.cc b/content/shell/layout_test_controller_bindings.cc
index 054b4f7..2f3a5ad 100644
--- a/content/shell/layout_test_controller_bindings.cc
+++ b/content/shell/layout_test_controller_bindings.cc
@@ -10,7 +10,6 @@
#include "grit/shell_resources.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
-#include "ui/base/layout.h"
#include "ui/base/resource/resource_bundle.h"
using WebKit::WebFrame;
@@ -21,8 +20,7 @@ namespace content {
namespace {
base::StringPiece GetStringResource(int resource_id) {
- return ResourceBundle::GetSharedInstance().GetRawDataResource(
- resource_id, ui::SCALE_FACTOR_NONE);
+ return ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id);
}
RenderView* GetCurrentRenderView() {
diff --git a/content/shell/shell_content_client.cc b/content/shell/shell_content_client.cc
index c004593..e3c80d8 100644
--- a/content/shell/shell_content_client.cc
+++ b/content/shell/shell_content_client.cc
@@ -52,11 +52,16 @@ string16 ShellContentClient::GetLocalizedString(int message_id) const {
return string16();
}
-base::StringPiece ShellContentClient::GetDataResource(
+base::StringPiece ShellContentClient::GetDataResource(int resource_id) const {
+ return ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id);
+}
+
+base::StringPiece ShellContentClient::GetImageResource(
int resource_id,
- ui::ScaleFactor scale_factor) const {
- return ResourceBundle::GetSharedInstance().GetRawDataResource(
- resource_id, scale_factor);
+ float scale_factor) const {
+ // TODO(flackr): Pass scale_factor to ResourceBundle to get best matching
+ // image resource for the given scale factor.
+ return ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id);
}
#if defined(OS_WIN)
diff --git a/content/shell/shell_content_client.h b/content/shell/shell_content_client.h
index 1d3aeda..d8b216e 100644
--- a/content/shell/shell_content_client.h
+++ b/content/shell/shell_content_client.h
@@ -31,9 +31,9 @@ class ShellContentClient : public ContentClient {
virtual bool CanHandleWhileSwappedOut(const IPC::Message& msg) OVERRIDE;
virtual std::string GetUserAgent() const OVERRIDE;
virtual string16 GetLocalizedString(int message_id) const OVERRIDE;
- virtual base::StringPiece GetDataResource(
- int resource_id,
- ui::ScaleFactor scale_factor) const OVERRIDE;
+ virtual base::StringPiece GetDataResource(int resource_id) const OVERRIDE;
+ virtual base::StringPiece GetImageResource(int resource_id,
+ float scale_factor) const OVERRIDE;
#if defined(OS_WIN)
virtual bool SandboxPlugin(CommandLine* command_line,
diff --git a/content/shell/shell_devtools_delegate.cc b/content/shell/shell_devtools_delegate.cc
index cf35cd1..15cdce8 100644
--- a/content/shell/shell_devtools_delegate.cc
+++ b/content/shell/shell_devtools_delegate.cc
@@ -9,7 +9,6 @@
#include "content/public/browser/devtools_http_handler.h"
#include "grit/shell_resources.h"
#include "net/url_request/url_request_context_getter.h"
-#include "ui/base/layout.h"
#include "ui/base/resource/resource_bundle.h"
namespace content {
@@ -36,8 +35,7 @@ void ShellDevToolsDelegate::Stop() {
std::string ShellDevToolsDelegate::GetDiscoveryPageHTML() {
return ResourceBundle::GetSharedInstance().GetRawDataResource(
- IDR_CONTENT_SHELL_DEVTOOLS_DISCOVERY_PAGE,
- ui::SCALE_FACTOR_NONE).as_string();
+ IDR_CONTENT_SHELL_DEVTOOLS_DISCOVERY_PAGE).as_string();
}
bool ShellDevToolsDelegate::BundlesFrontendResources() {
diff --git a/content/test/test_content_client.cc b/content/test/test_content_client.cc
index 0d2e3e0..11d9bb6 100644
--- a/content/test/test_content_client.cc
+++ b/content/test/test_content_client.cc
@@ -11,7 +11,7 @@
#include "base/string_piece.h"
TestContentClient::TestContentClient()
- : data_pack_(ui::SCALE_FACTOR_100P) {
+ : data_pack_(ui::ResourceHandle::kScaleFactor100x) {
FilePath content_resources_pack_path;
PathService::Get(base::DIR_MODULE, &content_resources_pack_path);
content_resources_pack_path = content_resources_pack_path.Append(
@@ -58,9 +58,15 @@ string16 TestContentClient::GetLocalizedString(int message_id) const {
return string16();
}
-base::StringPiece TestContentClient::GetDataResource(
+base::StringPiece TestContentClient::GetDataResource(int resource_id) const {
+ base::StringPiece resource;
+ data_pack_.GetStringPiece(resource_id, &resource);
+ return resource;
+}
+
+base::StringPiece TestContentClient::GetImageResource(
int resource_id,
- ui::ScaleFactor scale_factor) const {
+ float scale_factor) const {
base::StringPiece resource;
data_pack_.GetStringPiece(resource_id, &resource);
return resource;
diff --git a/content/test/test_content_client.h b/content/test/test_content_client.h
index ecf449b..94fb820 100644
--- a/content/test/test_content_client.h
+++ b/content/test/test_content_client.h
@@ -32,9 +32,9 @@ class TestContentClient : public content::ContentClient {
virtual bool CanHandleWhileSwappedOut(const IPC::Message& msg) OVERRIDE;
virtual std::string GetUserAgent() const OVERRIDE;
virtual string16 GetLocalizedString(int message_id) const OVERRIDE;
- virtual base::StringPiece GetDataResource(
- int resource_id,
- ui::ScaleFactor scale_factor) const OVERRIDE;
+ virtual base::StringPiece GetDataResource(int resource_id) const OVERRIDE;
+ virtual base::StringPiece GetImageResource(int resource_id,
+ float scale_factor) const OVERRIDE;
#if defined(OS_WIN)
virtual bool SandboxPlugin(CommandLine* command_line,
sandbox::TargetPolicy* policy) OVERRIDE;