summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/common/chrome_content_client.cc8
-rw-r--r--chrome/common/chrome_content_client.h2
-rw-r--r--content/common/webkitplatformsupport_impl.cc7
-rw-r--r--content/common/webkitplatformsupport_impl.h2
-rw-r--r--content/public/common/content_client.h5
-rw-r--r--content/shell/shell_content_client.cc8
-rw-r--r--content/shell/shell_content_client.h2
-rw-r--r--content/test/test_content_client.cc8
-rw-r--r--content/test/test_content_client.h2
-rw-r--r--ui/compositor/test/compositor_test_support.cc5
-rw-r--r--webkit/glue/webkit_glue_unittest.cc5
-rw-r--r--webkit/glue/webkitplatformsupport_impl.cc135
-rw-r--r--webkit/glue/webkitplatformsupport_impl.h6
-rw-r--r--webkit/support/platform_support_android.cc7
-rw-r--r--webkit/support/platform_support_linux.cc7
-rw-r--r--webkit/support/platform_support_mac.mm9
-rw-r--r--webkit/support/platform_support_win.cc9
-rw-r--r--webkit/support/test_webkit_platform_support.h2
-rw-r--r--webkit/tools/test_shell/test_shell_gtk.cc6
-rw-r--r--webkit/tools/test_shell/test_shell_mac.mm6
-rw-r--r--webkit/tools/test_shell/test_shell_webkit_init.h2
-rw-r--r--webkit/tools/test_shell/test_shell_win.cc8
22 files changed, 188 insertions, 63 deletions
diff --git a/chrome/common/chrome_content_client.cc b/chrome/common/chrome_content_client.cc
index 6116c08..369bc0a 100644
--- a/chrome/common/chrome_content_client.cc
+++ b/chrome/common/chrome_content_client.cc
@@ -419,6 +419,14 @@ base::StringPiece ChromeContentClient::GetDataResource(int resource_id) const {
return ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id);
}
+base::StringPiece ChromeContentClient::GetImageResource(
+ int resource_id,
+ 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)
bool ChromeContentClient::SandboxPlugin(CommandLine* command_line,
sandbox::TargetPolicy* policy) {
diff --git a/chrome/common/chrome_content_client.h b/chrome/common/chrome_content_client.h
index a3ec389..a69cd87 100644
--- a/chrome/common/chrome_content_client.h
+++ b/chrome/common/chrome_content_client.h
@@ -34,6 +34,8 @@ class ChromeContentClient : public content::ContentClient {
virtual std::string GetUserAgent() const OVERRIDE;
virtual string16 GetLocalizedString(int message_id) 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/common/webkitplatformsupport_impl.cc b/content/common/webkitplatformsupport_impl.cc
index 26c87bc..6309d9c 100644
--- a/content/common/webkitplatformsupport_impl.cc
+++ b/content/common/webkitplatformsupport_impl.cc
@@ -28,6 +28,13 @@ base::StringPiece WebKitPlatformSupportImpl::GetDataResource(
return content::GetContentClient()->GetDataResource(resource_id);
}
+base::StringPiece WebKitPlatformSupportImpl::GetImageResource(
+ int resource_id,
+ float scale_factor) {
+ return content::GetContentClient()->GetImageResource(resource_id,
+ scale_factor);
+}
+
void WebKitPlatformSupportImpl::GetPlugins(
bool refresh, std::vector<webkit::WebPluginInfo>* plugins) {
// This should not be called except in the renderer.
diff --git a/content/common/webkitplatformsupport_impl.h b/content/common/webkitplatformsupport_impl.h
index d92d4b4..c190ae6 100644
--- a/content/common/webkitplatformsupport_impl.h
+++ b/content/common/webkitplatformsupport_impl.h
@@ -24,6 +24,8 @@ class CONTENT_EXPORT WebKitPlatformSupportImpl
virtual string16 GetLocalizedString(int message_id) 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 1371641..61ad9b9 100644
--- a/content/public/common/content_client.h
+++ b/content/public/common/content_client.h
@@ -117,6 +117,11 @@ class CONTENT_EXPORT ContentClient {
// Return the contents of a resource in a StringPiece given the resource id.
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.
virtual bool SandboxPlugin(CommandLine* command_line,
diff --git a/content/shell/shell_content_client.cc b/content/shell/shell_content_client.cc
index 64ee8ea..e3c80d8 100644
--- a/content/shell/shell_content_client.cc
+++ b/content/shell/shell_content_client.cc
@@ -56,6 +56,14 @@ base::StringPiece ShellContentClient::GetDataResource(int resource_id) const {
return ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id);
}
+base::StringPiece ShellContentClient::GetImageResource(
+ int resource_id,
+ 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)
bool ShellContentClient::SandboxPlugin(CommandLine* command_line,
sandbox::TargetPolicy* policy) {
diff --git a/content/shell/shell_content_client.h b/content/shell/shell_content_client.h
index 6a740af..d8b216e 100644
--- a/content/shell/shell_content_client.h
+++ b/content/shell/shell_content_client.h
@@ -32,6 +32,8 @@ class ShellContentClient : public ContentClient {
virtual std::string GetUserAgent() const OVERRIDE;
virtual string16 GetLocalizedString(int message_id) 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/test/test_content_client.cc b/content/test/test_content_client.cc
index 4f7bce9..11d9bb6 100644
--- a/content/test/test_content_client.cc
+++ b/content/test/test_content_client.cc
@@ -64,6 +64,14 @@ base::StringPiece TestContentClient::GetDataResource(int resource_id) const {
return resource;
}
+base::StringPiece TestContentClient::GetImageResource(
+ int resource_id,
+ float scale_factor) const {
+ base::StringPiece resource;
+ data_pack_.GetStringPiece(resource_id, &resource);
+ return resource;
+}
+
#if defined(OS_WIN)
bool TestContentClient::SandboxPlugin(CommandLine* command_line,
sandbox::TargetPolicy* policy) {
diff --git a/content/test/test_content_client.h b/content/test/test_content_client.h
index 24b866a..94fb820 100644
--- a/content/test/test_content_client.h
+++ b/content/test/test_content_client.h
@@ -33,6 +33,8 @@ class TestContentClient : public content::ContentClient {
virtual std::string GetUserAgent() const OVERRIDE;
virtual string16 GetLocalizedString(int message_id) 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;
diff --git a/ui/compositor/test/compositor_test_support.cc b/ui/compositor/test/compositor_test_support.cc
index 6134f54..07c2ce7 100644
--- a/ui/compositor/test/compositor_test_support.cc
+++ b/ui/compositor/test/compositor_test_support.cc
@@ -21,6 +21,11 @@ class CompositorTestPlatformSupport:
return base::StringPiece();
}
+ virtual base::StringPiece GetImageResource(int resource_id,
+ float scale_factor) OVERRIDE {
+ return base::StringPiece();
+ }
+
virtual void GetPlugins(
bool refresh, std::vector<webkit::WebPluginInfo>* plugins) OVERRIDE {
}
diff --git a/webkit/glue/webkit_glue_unittest.cc b/webkit/glue/webkit_glue_unittest.cc
index 5971bc7..39b6208 100644
--- a/webkit/glue/webkit_glue_unittest.cc
+++ b/webkit/glue/webkit_glue_unittest.cc
@@ -104,6 +104,11 @@ class TestWebKitPlatformSupport
return base::StringPiece();
}
+ virtual base::StringPiece GetImageResource(int resource_id,
+ float scale_factor) OVERRIDE {
+ return base::StringPiece();
+ }
+
virtual void GetPlugins(bool,
std::vector<webkit::WebPluginInfo,
std::allocator<webkit::WebPluginInfo> >*) OVERRIDE {
diff --git a/webkit/glue/webkitplatformsupport_impl.cc b/webkit/glue/webkitplatformsupport_impl.cc
index 5b9267d..0849f76 100644
--- a/webkit/glue/webkitplatformsupport_impl.cc
+++ b/webkit/glue/webkitplatformsupport_impl.cc
@@ -381,80 +381,89 @@ WebData loadAudioSpatializationResource(WebKitPlatformSupportImpl* platform,
struct DataResource {
const char* name;
int id;
+ float scale_factor;
};
const DataResource kDataResources[] = {
- { "missingImage", IDR_BROKENIMAGE },
+ { "missingImage", IDR_BROKENIMAGE, 1.0 },
+ { "missingImage@2x", IDR_BROKENIMAGE, 2.0 },
#if defined(OS_ANDROID)
- { "mediaFullscreen", IDR_MEDIA_FULLSCREEN_BUTTON },
+ { "mediaFullscreen", IDR_MEDIA_FULLSCREEN_BUTTON, 1.0 },
#endif
- { "mediaPause", IDR_MEDIA_PAUSE_BUTTON },
- { "mediaPlay", IDR_MEDIA_PLAY_BUTTON },
- { "mediaPlayDisabled", IDR_MEDIA_PLAY_BUTTON_DISABLED },
- { "mediaSoundDisabled", IDR_MEDIA_SOUND_DISABLED },
- { "mediaSoundFull", IDR_MEDIA_SOUND_FULL_BUTTON },
- { "mediaSoundNone", IDR_MEDIA_SOUND_NONE_BUTTON },
- { "mediaSliderThumb", IDR_MEDIA_SLIDER_THUMB },
- { "mediaVolumeSliderThumb", IDR_MEDIA_VOLUME_SLIDER_THUMB },
- { "mediaplayerPause", IDR_MEDIAPLAYER_PAUSE_BUTTON },
- { "mediaplayerPauseHover", IDR_MEDIAPLAYER_PAUSE_BUTTON_HOVER },
- { "mediaplayerPauseDown", IDR_MEDIAPLAYER_PAUSE_BUTTON_DOWN },
- { "mediaplayerPlay", IDR_MEDIAPLAYER_PLAY_BUTTON },
- { "mediaplayerPlayHover", IDR_MEDIAPLAYER_PLAY_BUTTON_HOVER },
- { "mediaplayerPlayDown", IDR_MEDIAPLAYER_PLAY_BUTTON_DOWN },
- { "mediaplayerPlayDisabled", IDR_MEDIAPLAYER_PLAY_BUTTON_DISABLED },
- { "mediaplayerSoundLevel3", IDR_MEDIAPLAYER_SOUND_LEVEL3_BUTTON },
- { "mediaplayerSoundLevel3Hover", IDR_MEDIAPLAYER_SOUND_LEVEL3_BUTTON_HOVER },
- { "mediaplayerSoundLevel3Down", IDR_MEDIAPLAYER_SOUND_LEVEL3_BUTTON_DOWN },
- { "mediaplayerSoundLevel2", IDR_MEDIAPLAYER_SOUND_LEVEL2_BUTTON },
+ { "mediaPause", IDR_MEDIA_PAUSE_BUTTON, 1.0 },
+ { "mediaPlay", IDR_MEDIA_PLAY_BUTTON, 1.0 },
+ { "mediaPlayDisabled", IDR_MEDIA_PLAY_BUTTON_DISABLED, 1.0 },
+ { "mediaSoundDisabled", IDR_MEDIA_SOUND_DISABLED, 1.0 },
+ { "mediaSoundFull", IDR_MEDIA_SOUND_FULL_BUTTON, 1.0 },
+ { "mediaSoundNone", IDR_MEDIA_SOUND_NONE_BUTTON, 1.0 },
+ { "mediaSliderThumb", IDR_MEDIA_SLIDER_THUMB, 1.0 },
+ { "mediaVolumeSliderThumb", IDR_MEDIA_VOLUME_SLIDER_THUMB, 1.0 },
+ { "mediaplayerPause", IDR_MEDIAPLAYER_PAUSE_BUTTON, 1.0 },
+ { "mediaplayerPauseHover", IDR_MEDIAPLAYER_PAUSE_BUTTON_HOVER, 1.0 },
+ { "mediaplayerPauseDown", IDR_MEDIAPLAYER_PAUSE_BUTTON_DOWN, 1.0 },
+ { "mediaplayerPlay", IDR_MEDIAPLAYER_PLAY_BUTTON, 1.0 },
+ { "mediaplayerPlayHover", IDR_MEDIAPLAYER_PLAY_BUTTON_HOVER, 1.0 },
+ { "mediaplayerPlayDown", IDR_MEDIAPLAYER_PLAY_BUTTON_DOWN, 1.0 },
+ { "mediaplayerPlayDisabled", IDR_MEDIAPLAYER_PLAY_BUTTON_DISABLED, 1.0 },
+ { "mediaplayerSoundLevel3", IDR_MEDIAPLAYER_SOUND_LEVEL3_BUTTON, 1.0 },
+ { "mediaplayerSoundLevel3Hover",
+ IDR_MEDIAPLAYER_SOUND_LEVEL3_BUTTON_HOVER, 1.0 },
+ { "mediaplayerSoundLevel3Down",
+ IDR_MEDIAPLAYER_SOUND_LEVEL3_BUTTON_DOWN, 1.0 },
+ { "mediaplayerSoundLevel2", IDR_MEDIAPLAYER_SOUND_LEVEL2_BUTTON, 1.0 },
{ "mediaplayerSoundLevel2Hover",
- IDR_MEDIAPLAYER_SOUND_LEVEL2_BUTTON_HOVER },
- { "mediaplayerSoundLevel2Down", IDR_MEDIAPLAYER_SOUND_LEVEL2_BUTTON_DOWN },
- { "mediaplayerSoundLevel1", IDR_MEDIAPLAYER_SOUND_LEVEL1_BUTTON },
+ IDR_MEDIAPLAYER_SOUND_LEVEL2_BUTTON_HOVER, 1.0 },
+ { "mediaplayerSoundLevel2Down",
+ IDR_MEDIAPLAYER_SOUND_LEVEL2_BUTTON_DOWN, 1.0 },
+ { "mediaplayerSoundLevel1", IDR_MEDIAPLAYER_SOUND_LEVEL1_BUTTON, 1.0 },
{ "mediaplayerSoundLevel1Hover",
- IDR_MEDIAPLAYER_SOUND_LEVEL1_BUTTON_HOVER },
- { "mediaplayerSoundLevel1Down", IDR_MEDIAPLAYER_SOUND_LEVEL1_BUTTON_DOWN },
- { "mediaplayerSoundLevel0", IDR_MEDIAPLAYER_SOUND_LEVEL0_BUTTON },
+ IDR_MEDIAPLAYER_SOUND_LEVEL1_BUTTON_HOVER, 1.0 },
+ { "mediaplayerSoundLevel1Down",
+ IDR_MEDIAPLAYER_SOUND_LEVEL1_BUTTON_DOWN, 1.0 },
+ { "mediaplayerSoundLevel0", IDR_MEDIAPLAYER_SOUND_LEVEL0_BUTTON, 1.0 },
{ "mediaplayerSoundLevel0Hover",
- IDR_MEDIAPLAYER_SOUND_LEVEL0_BUTTON_HOVER },
- { "mediaplayerSoundLevel0Down", IDR_MEDIAPLAYER_SOUND_LEVEL0_BUTTON_DOWN },
- { "mediaplayerSoundDisabled", IDR_MEDIAPLAYER_SOUND_DISABLED },
- { "mediaplayerSliderThumb", IDR_MEDIAPLAYER_SLIDER_THUMB },
- { "mediaplayerSliderThumbHover", IDR_MEDIAPLAYER_SLIDER_THUMB_HOVER },
- { "mediaplayerSliderThumbDown", IDR_MEDIAPLAYER_SLIDER_THUMB_DOWN },
- { "mediaplayerVolumeSliderThumb", IDR_MEDIAPLAYER_VOLUME_SLIDER_THUMB },
+ IDR_MEDIAPLAYER_SOUND_LEVEL0_BUTTON_HOVER, 1.0 },
+ { "mediaplayerSoundLevel0Down",
+ IDR_MEDIAPLAYER_SOUND_LEVEL0_BUTTON_DOWN, 1.0 },
+ { "mediaplayerSoundDisabled", IDR_MEDIAPLAYER_SOUND_DISABLED, 1.0 },
+ { "mediaplayerSliderThumb", IDR_MEDIAPLAYER_SLIDER_THUMB, 1.0 },
+ { "mediaplayerSliderThumbHover", IDR_MEDIAPLAYER_SLIDER_THUMB_HOVER, 1.0 },
+ { "mediaplayerSliderThumbDown", IDR_MEDIAPLAYER_SLIDER_THUMB_DOWN, 1.0 },
+ { "mediaplayerVolumeSliderThumb", IDR_MEDIAPLAYER_VOLUME_SLIDER_THUMB, 1.0 },
{ "mediaplayerVolumeSliderThumbHover",
- IDR_MEDIAPLAYER_VOLUME_SLIDER_THUMB_HOVER },
+ IDR_MEDIAPLAYER_VOLUME_SLIDER_THUMB_HOVER, 1.0 },
{ "mediaplayerVolumeSliderThumbDown",
- IDR_MEDIAPLAYER_VOLUME_SLIDER_THUMB_DOWN },
+ IDR_MEDIAPLAYER_VOLUME_SLIDER_THUMB_DOWN, 1.0 },
{ "mediaplayerVolumeSliderThumbDisabled",
- IDR_MEDIAPLAYER_VOLUME_SLIDER_THUMB_DISABLED },
- { "mediaplayerFullscreen", IDR_MEDIAPLAYER_FULLSCREEN_BUTTON },
- { "mediaplayerFullscreenHover", IDR_MEDIAPLAYER_FULLSCREEN_BUTTON_HOVER },
- { "mediaplayerFullscreenDown", IDR_MEDIAPLAYER_FULLSCREEN_BUTTON_DOWN },
+ IDR_MEDIAPLAYER_VOLUME_SLIDER_THUMB_DISABLED, 1.0 },
+ { "mediaplayerFullscreen", IDR_MEDIAPLAYER_FULLSCREEN_BUTTON, 1.0 },
+ { "mediaplayerFullscreenHover",
+ IDR_MEDIAPLAYER_FULLSCREEN_BUTTON_HOVER, 1.0 },
+ { "mediaplayerFullscreenDown", IDR_MEDIAPLAYER_FULLSCREEN_BUTTON_DOWN, 1.0 },
{ "mediaplayerFullscreenDisabled",
- IDR_MEDIAPLAYER_FULLSCREEN_BUTTON_DISABLED },
+ IDR_MEDIAPLAYER_FULLSCREEN_BUTTON_DISABLED, 1.0 },
#if defined(OS_MACOSX)
- { "overhangPattern", IDR_OVERHANG_PATTERN },
+ { "overhangPattern", IDR_OVERHANG_PATTERN, 1.0 },
#endif
- { "panIcon", IDR_PAN_SCROLL_ICON },
- { "searchCancel", IDR_SEARCH_CANCEL },
- { "searchCancelPressed", IDR_SEARCH_CANCEL_PRESSED },
- { "searchMagnifier", IDR_SEARCH_MAGNIFIER },
- { "searchMagnifierResults", IDR_SEARCH_MAGNIFIER_RESULTS },
- { "textAreaResizeCorner", IDR_TEXTAREA_RESIZER },
- { "tickmarkDash", IDR_TICKMARK_DASH },
- { "inputSpeech", IDR_INPUT_SPEECH },
- { "inputSpeechRecording", IDR_INPUT_SPEECH_RECORDING },
- { "inputSpeechWaiting", IDR_INPUT_SPEECH_WAITING },
- { "americanExpressCC", IDR_AUTOFILL_CC_AMEX },
- { "dinersCC", IDR_AUTOFILL_CC_DINERS },
- { "discoverCC", IDR_AUTOFILL_CC_DISCOVER },
- { "genericCC", IDR_AUTOFILL_CC_GENERIC },
- { "jcbCC", IDR_AUTOFILL_CC_JCB },
- { "masterCardCC", IDR_AUTOFILL_CC_MASTERCARD },
- { "soloCC", IDR_AUTOFILL_CC_SOLO },
- { "visaCC", IDR_AUTOFILL_CC_VISA },
+ { "panIcon", IDR_PAN_SCROLL_ICON, 1.0 },
+ { "searchCancel", IDR_SEARCH_CANCEL, 1.0 },
+ { "searchCancelPressed", IDR_SEARCH_CANCEL_PRESSED, 1.0 },
+ { "searchMagnifier", IDR_SEARCH_MAGNIFIER, 1.0 },
+ { "searchMagnifierResults", IDR_SEARCH_MAGNIFIER_RESULTS, 1.0 },
+ { "textAreaResizeCorner", IDR_TEXTAREA_RESIZER, 1.0 },
+ { "textAreaResizeCorner@2x", IDR_TEXTAREA_RESIZER, 2.0 },
+ { "tickmarkDash", IDR_TICKMARK_DASH, 1.0 },
+ { "inputSpeech", IDR_INPUT_SPEECH, 1.0 },
+ { "inputSpeechRecording", IDR_INPUT_SPEECH_RECORDING, 1.0 },
+ { "inputSpeechWaiting", IDR_INPUT_SPEECH_WAITING, 1.0 },
+ { "americanExpressCC", IDR_AUTOFILL_CC_AMEX, 1.0 },
+ { "dinersCC", IDR_AUTOFILL_CC_DINERS, 1.0 },
+ { "discoverCC", IDR_AUTOFILL_CC_DISCOVER, 1.0 },
+ { "genericCC", IDR_AUTOFILL_CC_GENERIC, 1.0 },
+ { "jcbCC", IDR_AUTOFILL_CC_JCB, 1.0 },
+ { "masterCardCC", IDR_AUTOFILL_CC_MASTERCARD, 1.0 },
+ { "soloCC", IDR_AUTOFILL_CC_SOLO, 1.0 },
+ { "visaCC", IDR_AUTOFILL_CC_VISA, 1.0 },
};
} // namespace
@@ -470,9 +479,13 @@ WebData WebKitPlatformSupportImpl::loadResource(const char* name) {
if (StartsWithASCII(name, "IRC_Composite", true))
return loadAudioSpatializationResource(this, name);
+ // TODO(flackr): We should use a better than linear search here, a trie would
+ // be ideal.
for (size_t i = 0; i < arraysize(kDataResources); ++i) {
if (!strcmp(name, kDataResources[i].name)) {
- base::StringPiece resource = GetDataResource(kDataResources[i].id);
+ base::StringPiece resource =
+ GetImageResource(kDataResources[i].id,
+ kDataResources[i].scale_factor);
return WebData(resource.data(), resource.size());
}
}
diff --git a/webkit/glue/webkitplatformsupport_impl.h b/webkit/glue/webkitplatformsupport_impl.h
index 26fd537..c58eb86 100644
--- a/webkit/glue/webkitplatformsupport_impl.h
+++ b/webkit/glue/webkitplatformsupport_impl.h
@@ -121,6 +121,12 @@ class WEBKIT_GLUE_EXPORT WebKitPlatformSupportImpl :
// specified as BINDATA in the relevant .rc file.
virtual base::StringPiece GetDataResource(int resource_id) = 0;
+ // Returns the raw data for an image resource with a scale factor as close as
+ // is available to |scale_factor|. This resource must have been specified as
+ // BINDATA in the relevant .rc file.
+ virtual base::StringPiece GetImageResource(int resource_id,
+ float scale_factor) = 0;
+
// Returns the list of plugins.
virtual void GetPlugins(bool refresh,
std::vector<webkit::WebPluginInfo>* plugins) = 0;
diff --git a/webkit/support/platform_support_android.cc b/webkit/support/platform_support_android.cc
index 23ebe69..79a9cd3 100644
--- a/webkit/support/platform_support_android.cc
+++ b/webkit/support/platform_support_android.cc
@@ -62,6 +62,12 @@ string16 TestWebKitPlatformSupport::GetLocalizedString(int message_id) {
}
base::StringPiece TestWebKitPlatformSupport::GetDataResource(int resource_id) {
+ return ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id);
+}
+
+base::StringPiece TestWebKitPlatformSupport::GetImageResource(
+ int resource_id,
+ float scale_factor) {
FilePath resources_path;
PathService::Get(base::DIR_EXE, &resources_path);
resources_path = resources_path.Append("DumpRenderTree_resources");
@@ -88,5 +94,6 @@ base::StringPiece TestWebKitPlatformSupport::GetDataResource(int resource_id) {
}
}
+ // TODO(flackr): Pass scale_factor to ResourceBundle.
return ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id);
}
diff --git a/webkit/support/platform_support_linux.cc b/webkit/support/platform_support_linux.cc
index 55d8517..e777546 100644
--- a/webkit/support/platform_support_linux.cc
+++ b/webkit/support/platform_support_linux.cc
@@ -46,6 +46,12 @@ string16 TestWebKitPlatformSupport::GetLocalizedString(int message_id) {
}
base::StringPiece TestWebKitPlatformSupport::GetDataResource(int resource_id) {
+ return ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id);
+}
+
+base::StringPiece TestWebKitPlatformSupport::GetImageResource(
+ int resource_id,
+ float scale_factor) {
FilePath resources_path;
PathService::Get(base::DIR_EXE, &resources_path);
resources_path = resources_path.Append("DumpRenderTree_resources");
@@ -72,5 +78,6 @@ base::StringPiece TestWebKitPlatformSupport::GetDataResource(int resource_id) {
}
}
+ // TODO(flackr): Pass scale_factor to ResourceBundle.
return ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id);
}
diff --git a/webkit/support/platform_support_mac.mm b/webkit/support/platform_support_mac.mm
index 487d521..f26ae69 100644
--- a/webkit/support/platform_support_mac.mm
+++ b/webkit/support/platform_support_mac.mm
@@ -217,6 +217,15 @@ static FilePath GetResourcesFilePath() {
}
base::StringPiece TestWebKitPlatformSupport::GetDataResource(int resource_id) {
+ base::StringPiece res;
+ if (g_resource_data_pack)
+ g_resource_data_pack->GetStringPiece(resource_id, &res);
+ return res;
+}
+
+base::StringPiece TestWebKitPlatformSupport::GetImageResource(
+ int resource_id,
+ float scale_factor) {
switch (resource_id) {
case IDR_BROKENIMAGE: {
// Use webkit's broken image icon (16x16)
diff --git a/webkit/support/platform_support_win.cc b/webkit/support/platform_support_win.cc
index 0d5eee2..c385ccc 100644
--- a/webkit/support/platform_support_win.cc
+++ b/webkit/support/platform_support_win.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -73,6 +73,12 @@ string16 TestWebKitPlatformSupport::GetLocalizedString(int message_id) {
}
base::StringPiece TestWebKitPlatformSupport::GetDataResource(int resource_id) {
+ return ResourceProvider(resource_id);
+}
+
+base::StringPiece TestWebKitPlatformSupport::GetImageResource(
+ int resource_id,
+ float scale_factor) {
switch (resource_id) {
case IDR_BROKENIMAGE: {
// Use webkit's broken image icon (16x16)
@@ -100,5 +106,6 @@ base::StringPiece TestWebKitPlatformSupport::GetDataResource(int resource_id) {
}
}
+ // TODO(flackr): Pass scale_factor to ResourceProvider.
return ResourceProvider(resource_id);
}
diff --git a/webkit/support/test_webkit_platform_support.h b/webkit/support/test_webkit_platform_support.h
index a74e6b5f..238d008 100644
--- a/webkit/support/test_webkit_platform_support.h
+++ b/webkit/support/test_webkit_platform_support.h
@@ -112,6 +112,8 @@ class TestWebKitPlatformSupport :
virtual string16 GetLocalizedString(int message_id) 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/webkit/tools/test_shell/test_shell_gtk.cc b/webkit/tools/test_shell/test_shell_gtk.cc
index 59f1409..9b7904b 100644
--- a/webkit/tools/test_shell/test_shell_gtk.cc
+++ b/webkit/tools/test_shell/test_shell_gtk.cc
@@ -569,6 +569,11 @@ string16 TestShellWebKitInit::GetLocalizedString(int message_id) {
}
base::StringPiece TestShellWebKitInit::GetDataResource(int resource_id) {
+ return TestShell::ResourceProvider(resource_id);
+}
+
+base::StringPiece TestShellWebKitInit::GetImageResource(int resource_id,
+ float scale_factor) {
switch (resource_id) {
case IDR_BROKENIMAGE:
resource_id = IDR_BROKENIMAGE_TESTSHELL;
@@ -577,5 +582,6 @@ base::StringPiece TestShellWebKitInit::GetDataResource(int resource_id) {
resource_id = IDR_TEXTAREA_RESIZER_TESTSHELL;
break;
}
+ // TODO(flackr): Pass scale_factor.
return TestShell::ResourceProvider(resource_id);
}
diff --git a/webkit/tools/test_shell/test_shell_mac.mm b/webkit/tools/test_shell/test_shell_mac.mm
index a5a556c..e5f749d 100644
--- a/webkit/tools/test_shell/test_shell_mac.mm
+++ b/webkit/tools/test_shell/test_shell_mac.mm
@@ -631,6 +631,11 @@ string16 TestShellWebKitInit::GetLocalizedString(int message_id) {
}
base::StringPiece TestShellWebKitInit::GetDataResource(int resource_id) {
+ return base::StringPiece();
+}
+
+base::StringPiece TestShellWebKitInit::GetImageResource(int resource_id,
+ float scale_factor) {
switch (resource_id) {
case IDR_BROKENIMAGE: {
// Use webkit's broken image icon (16x16)
@@ -677,6 +682,7 @@ base::StringPiece TestShellWebKitInit::GetDataResource(int resource_id) {
case IDR_INPUT_SPEECH:
case IDR_INPUT_SPEECH_RECORDING:
case IDR_INPUT_SPEECH_WAITING:
+ // TODO(flackr): Pass scale_factor to ResourceProvider.
return TestShell::ResourceProvider(resource_id);
default:
diff --git a/webkit/tools/test_shell/test_shell_webkit_init.h b/webkit/tools/test_shell/test_shell_webkit_init.h
index b8c89b6..09f696d 100644
--- a/webkit/tools/test_shell/test_shell_webkit_init.h
+++ b/webkit/tools/test_shell/test_shell_webkit_init.h
@@ -106,6 +106,8 @@ class TestShellWebKitInit : public webkit_glue::WebKitPlatformSupportImpl {
virtual string16 GetLocalizedString(int message_id) 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/webkit/tools/test_shell/test_shell_win.cc b/webkit/tools/test_shell/test_shell_win.cc
index a5b1d8c..b07c26d 100644
--- a/webkit/tools/test_shell/test_shell_win.cc
+++ b/webkit/tools/test_shell/test_shell_win.cc
@@ -669,8 +669,13 @@ string16 TestShellWebKitInit::GetLocalizedString(int message_id) {
return string16(localized, length);
}
-// TODO(tc): Convert this to using resources from test_shell.rc.
base::StringPiece TestShellWebKitInit::GetDataResource(int resource_id) {
+ return base::StringPiece();
+}
+
+// TODO(tc): Convert this to using resources from test_shell.rc.
+base::StringPiece TestShellWebKitInit::GetImageResource(int resource_id,
+ float scale_factor) {
switch (resource_id) {
case IDR_BROKENIMAGE: {
// Use webkit's broken image icon (16x16)
@@ -714,6 +719,7 @@ base::StringPiece TestShellWebKitInit::GetDataResource(int resource_id) {
case IDR_INPUT_SPEECH:
case IDR_INPUT_SPEECH_RECORDING:
case IDR_INPUT_SPEECH_WAITING:
+ //TODO(flackr): Pass scale_factor.
return TestShell::ResourceProvider(resource_id);
default: