diff options
author | flackr@chromium.org <flackr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-17 21:05:40 +0000 |
---|---|---|
committer | flackr@chromium.org <flackr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-17 21:05:40 +0000 |
commit | bebfb2ed2025f1e0f99dbcf3aa9af48cc6e8ac0f (patch) | |
tree | 2858dc6858da0f4c70b7d4fa2d11ba02ca83fde6 /chrome/renderer | |
parent | c145c83565c8c019f97d0280d12c623352e1c58e (diff) | |
download | chromium_src-bebfb2ed2025f1e0f99dbcf3aa9af48cc6e8ac0f.zip chromium_src-bebfb2ed2025f1e0f99dbcf3aa9af48cc6e8ac0f.tar.gz chromium_src-bebfb2ed2025f1e0f99dbcf3aa9af48cc6e8ac0f.tar.bz2 |
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
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@137734 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r-- | chrome/renderer/chrome_content_renderer_client.cc | 6 | ||||
-rw-r--r-- | chrome/renderer/extensions/extension_dispatcher.cc | 4 | ||||
-rw-r--r-- | chrome/renderer/extensions/json_schema_unittest.cc | 3 | ||||
-rw-r--r-- | chrome/renderer/extensions/user_script_slave.cc | 7 | ||||
-rw-r--r-- | chrome/renderer/plugins/plugin_placeholder.cc | 18 | ||||
-rw-r--r-- | chrome/renderer/resource_bundle_source_map.cc | 4 |
6 files changed, 26 insertions, 16 deletions
diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc index 4013b92f..7450dde 100644 --- a/chrome/renderer/chrome_content_renderer_client.cc +++ b/chrome/renderer/chrome_content_renderer_client.cc @@ -18,11 +18,11 @@ #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/content_settings_pattern.h" -#include "chrome/common/external_ipc_fuzzer.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_constants.h" #include "chrome/common/extensions/extension_process_policy.h" #include "chrome/common/extensions/extension_set.h" +#include "chrome/common/external_ipc_fuzzer.h" #include "chrome/common/jstemplate_builder.h" #include "chrome/common/render_messages.h" #include "chrome/common/url_constants.h" @@ -83,6 +83,7 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLError.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLRequest.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/layout.h" #include "ui/base/resource/resource_bundle.h" #include "webkit/plugins/npapi/plugin_list.h" #include "webkit/plugins/ppapi/plugin_module.h" @@ -659,7 +660,8 @@ void ChromeContentRendererClient::GetNavigationErrorStrings( } const base::StringPiece template_html( - ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id)); + ResourceBundle::GetSharedInstance().GetRawDataResource( + resource_id, ui::SCALE_FACTOR_NONE)); if (template_html.empty()) { NOTREACHED() << "unable to load template. ID: " << resource_id; } else { diff --git a/chrome/renderer/extensions/extension_dispatcher.cc b/chrome/renderer/extensions/extension_dispatcher.cc index 9706f67..30876ca 100644 --- a/chrome/renderer/extensions/extension_dispatcher.cc +++ b/chrome/renderer/extensions/extension_dispatcher.cc @@ -57,6 +57,7 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLRequest.h" +#include "ui/base/layout.h" #include "ui/base/resource/resource_bundle.h" #include "v8/include/v8.h" @@ -412,7 +413,8 @@ void ExtensionDispatcher::OnLoaded( patterns.assign(platform_app_patterns); WebView::addUserStyleSheet( WebString::fromUTF8(ResourceBundle::GetSharedInstance(). - GetRawDataResource(IDR_PLATFORM_APP_CSS)), + GetRawDataResource(IDR_PLATFORM_APP_CSS, + ui::SCALE_FACTOR_NONE)), patterns, WebView::UserContentInjectInAllFrames, WebView::UserStyleInjectInExistingDocuments); diff --git a/chrome/renderer/extensions/json_schema_unittest.cc b/chrome/renderer/extensions/json_schema_unittest.cc index c4b0614..8eb4581 100644 --- a/chrome/renderer/extensions/json_schema_unittest.cc +++ b/chrome/renderer/extensions/json_schema_unittest.cc @@ -9,6 +9,7 @@ #include "chrome/test/base/v8_unit_test.h" #include "grit/renderer_resources.h" #include "testing/gtest/include/gtest/gtest.h" +#include "ui/base/layout.h" #include "ui/base/resource/resource_bundle.h" static const char kJsonSchema[] = "json_schema.js"; @@ -23,7 +24,7 @@ class JsonSchemaTest : public V8UnitTest { // Add the json schema code to the context. std::string code = ResourceBundle::GetSharedInstance().GetRawDataResource( - IDR_JSON_SCHEMA_JS).as_string(); + IDR_JSON_SCHEMA_JS, ui::SCALE_FACTOR_NONE).as_string(); // json_schema.js expects to have requireNative() defined. ExecuteScriptInContext( diff --git a/chrome/renderer/extensions/user_script_slave.cc b/chrome/renderer/extensions/user_script_slave.cc index 9008381..088dc56 100644 --- a/chrome/renderer/extensions/user_script_slave.cc +++ b/chrome/renderer/extensions/user_script_slave.cc @@ -8,10 +8,10 @@ #include "base/command_line.h" #include "base/logging.h" +#include "base/metrics/histogram.h" #include "base/perftimer.h" #include "base/pickle.h" #include "base/shared_memory.h" -#include "base/metrics/histogram.h" #include "base/stringprintf.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_set.h" @@ -27,9 +27,10 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.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/WebURLRequest.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.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; @@ -118,7 +119,7 @@ UserScriptSlave::UserScriptSlave(const ExtensionSet* extensions) script_deleter_(&scripts_), extensions_(extensions) { api_js_ = ResourceBundle::GetSharedInstance().GetRawDataResource( - IDR_GREASEMONKEY_API_JS); + IDR_GREASEMONKEY_API_JS, ui::SCALE_FACTOR_NONE); } UserScriptSlave::~UserScriptSlave() {} diff --git a/chrome/renderer/plugins/plugin_placeholder.cc b/chrome/renderer/plugins/plugin_placeholder.cc index e87bbea..cf85d24 100644 --- a/chrome/renderer/plugins/plugin_placeholder.cc +++ b/chrome/renderer/plugins/plugin_placeholder.cc @@ -12,8 +12,8 @@ #include "base/utf_string_conversions.h" #include "base/values.h" #include "chrome/common/jstemplate_builder.h" -#include "chrome/common/render_messages.h" #include "chrome/common/prerender_messages.h" +#include "chrome/common/render_messages.h" #include "chrome/renderer/chrome_content_renderer_client.h" #include "chrome/renderer/custom_menu_commands.h" #include "chrome/renderer/plugins/plugin_uma.h" @@ -22,9 +22,6 @@ #include "grit/generated_resources.h" #include "grit/renderer_resources.h" #include "grit/webkit_strings.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebData.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPoint.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" @@ -36,7 +33,11 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptSource.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebTextCaseSensitivity.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebData.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPoint.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/layout.h" #include "ui/base/resource/resource_bundle.h" #include "webkit/glue/webpreferences.h" #include "webkit/plugins/npapi/plugin_group.h" @@ -101,7 +102,7 @@ PluginPlaceholder* PluginPlaceholder::CreateMissingPlugin( const WebPluginParams& params) { const base::StringPiece template_html( ResourceBundle::GetSharedInstance().GetRawDataResource( - IDR_BLOCKED_PLUGIN_HTML)); + IDR_BLOCKED_PLUGIN_HTML, ui::SCALE_FACTOR_NONE)); DictionaryValue values; values.SetString("message", l10n_util::GetStringUTF8(IDS_PLUGIN_SEARCHING)); @@ -132,7 +133,7 @@ PluginPlaceholder* PluginPlaceholder::CreateErrorPlugin( const base::StringPiece template_html( ResourceBundle::GetSharedInstance().GetRawDataResource( - IDR_BLOCKED_PLUGIN_HTML)); + IDR_BLOCKED_PLUGIN_HTML, ui::SCALE_FACTOR_NONE)); std::string html_data = jstemplate_builder::GetI18nTemplateHtml(template_html, &values); @@ -162,7 +163,8 @@ PluginPlaceholder* PluginPlaceholder::CreateBlockedPlugin( values.SetString("hide", l10n_util::GetStringUTF8(IDS_PLUGIN_HIDE)); const base::StringPiece template_html( - ResourceBundle::GetSharedInstance().GetRawDataResource(template_id)); + ResourceBundle::GetSharedInstance().GetRawDataResource( + template_id, ui::SCALE_FACTOR_NONE)); DCHECK(!template_html.empty()) << "unable to load template. ID: " << template_id; @@ -185,7 +187,7 @@ PluginPlaceholder* PluginPlaceholder::CreateMobileYoutubePlugin( const WebPluginParams& params) { const base::StringPiece template_html( ResourceBundle::GetSharedInstance().GetRawDataResource( - IDR_YOUTUBE_PLUGIN_HTML)); + IDR_YOUTUBE_PLUGIN_HTML, ui::SCALE_FACTOR_NONE)); DictionaryValue values; values.SetString("video_id", GetYoutubeVideoId(params)); diff --git a/chrome/renderer/resource_bundle_source_map.cc b/chrome/renderer/resource_bundle_source_map.cc index 5a42582..86ee68d 100644 --- a/chrome/renderer/resource_bundle_source_map.cc +++ b/chrome/renderer/resource_bundle_source_map.cc @@ -4,6 +4,7 @@ #include "chrome/renderer/resource_bundle_source_map.h" +#include "ui/base/layout.h" #include "ui/base/resource/resource_bundle.h" ResourceBundleSourceMap::ResourceBundleSourceMap( @@ -24,7 +25,8 @@ v8::Handle<v8::Value> ResourceBundleSourceMap::GetSource( if (!Contains(name)) return v8::Undefined(); int resource_id = resource_id_map_[name]; - return ConvertString(resource_bundle_->GetRawDataResource(resource_id)); + return ConvertString(resource_bundle_->GetRawDataResource( + resource_id, ui::SCALE_FACTOR_NONE)); } bool ResourceBundleSourceMap::Contains(const std::string& name) { |