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 | |
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')
64 files changed, 264 insertions, 126 deletions
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc index c068a56..5f81728 100644 --- a/chrome/browser/chrome_browser_main.cc +++ b/chrome/browser/chrome_browser_main.cc @@ -427,7 +427,7 @@ void InitializeGpuDataManager(const CommandLine& parsed_command_line) { const base::StringPiece gpu_blacklist_json( ResourceBundle::GetSharedInstance().GetRawDataResource( - IDR_GPU_BLACKLIST)); + IDR_GPU_BLACKLIST, ui::SCALE_FACTOR_NONE)); GpuBlacklist* gpu_blacklist = GpuBlacklist::GetInstance(); bool succeed = gpu_blacklist->LoadGpuBlacklist( gpu_blacklist_json.as_string(), GpuBlacklist::kCurrentOsOnly); @@ -1303,7 +1303,7 @@ int ChromeBrowserMainParts::PreCreateThreadsImpl() { FilePath resources_pack_path; PathService::Get(chrome::FILE_RESOURCES_PACK, &resources_pack_path); ResourceBundle::GetSharedInstance().AddDataPack( - resources_pack_path, ui::ResourceHandle::kScaleFactor100x); + resources_pack_path, ui::SCALE_FACTOR_100P); #endif // defined(OS_MACOSX) } diff --git a/chrome/browser/chrome_browser_main_mac.mm b/chrome/browser/chrome_browser_main_mac.mm index 718c86f..54560b1 100644 --- a/chrome/browser/chrome_browser_main_mac.mm +++ b/chrome/browser/chrome_browser_main_mac.mm @@ -138,7 +138,7 @@ void ChromeBrowserMainPartsMac::PreMainMessageLoopStart() { FilePath resources_pack_path; PathService::Get(chrome::FILE_RESOURCES_PACK, &resources_pack_path); ResourceBundle::GetSharedInstance().AddDataPack( - resources_pack_path, ui::ResourceHandle::kScaleFactor100x); + resources_pack_path, ui::SCALE_FACTOR_100P); } // This is a no-op if the KeystoneRegistration framework is not present. diff --git a/chrome/browser/chromeos/offline/offline_load_page.cc b/chrome/browser/chromeos/offline/offline_load_page.cc index ac107da..126f6dd 100644 --- a/chrome/browser/chromeos/offline/offline_load_page.cc +++ b/chrome/browser/chromeos/offline/offline_load_page.cc @@ -33,6 +33,7 @@ #include "grit/generated_resources.h" #include "net/base/escape.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/layout.h" #include "ui/base/resource/resource_bundle.h" using content::BrowserThread; @@ -112,7 +113,7 @@ std::string OfflineLoadPage::GetHTMLContents() { base::StringPiece html( ResourceBundle::GetSharedInstance().GetRawDataResource( - IDR_OFFLINE_LOAD_HTML)); + IDR_OFFLINE_LOAD_HTML, ui::SCALE_FACTOR_NONE)); return jstemplate_builder::GetI18nTemplateHtml(html, &strings); } diff --git a/chrome/browser/debugger/browser_list_tabcontents_provider.cc b/chrome/browser/debugger/browser_list_tabcontents_provider.cc index 260eefa..f29c647 100644 --- a/chrome/browser/debugger/browser_list_tabcontents_provider.cc +++ b/chrome/browser/debugger/browser_list_tabcontents_provider.cc @@ -11,6 +11,7 @@ #include "content/public/browser/browser_thread.h" #include "grit/devtools_discovery_page_resources.h" #include "net/url_request/url_request_context_getter.h" +#include "ui/base/layout.h" #include "ui/base/resource/resource_bundle.h" using content::DevToolsHttpHandlerDelegate; @@ -41,7 +42,8 @@ std::string BrowserListTabContentsProvider::GetDiscoveryPageHTML() { } } return ResourceBundle::GetSharedInstance().GetRawDataResource( - IDR_DEVTOOLS_DISCOVERY_PAGE_HTML).as_string(); + IDR_DEVTOOLS_DISCOVERY_PAGE_HTML, + ui::SCALE_FACTOR_NONE).as_string(); } bool BrowserListTabContentsProvider::BundlesFrontendResources() { diff --git a/chrome/browser/extensions/component_loader.cc b/chrome/browser/extensions/component_loader.cc index b077315..36ee3e0 100644 --- a/chrome/browser/extensions/component_loader.cc +++ b/chrome/browser/extensions/component_loader.cc @@ -24,6 +24,7 @@ #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_source.h" #include "grit/browser_resources.h" +#include "ui/base/layout.h" #include "ui/base/resource/resource_bundle.h" #if defined(OFFICIAL_BUILD) @@ -89,7 +90,8 @@ const Extension* ComponentLoader::Add( const FilePath& root_directory) { std::string manifest_contents = ResourceBundle::GetSharedInstance().GetRawDataResource( - manifest_resource_id).as_string(); + manifest_resource_id, + ui::SCALE_FACTOR_NONE).as_string(); return Add(manifest_contents, root_directory); } @@ -249,7 +251,8 @@ void ComponentLoader::AddOrReloadEnterpriseWebStore() { if (!enterprise_webstore_url.empty()) { std::string manifest_contents = ResourceBundle::GetSharedInstance().GetRawDataResource( - IDR_ENTERPRISE_WEBSTORE_MANIFEST).as_string(); + IDR_ENTERPRISE_WEBSTORE_MANIFEST, + ui::SCALE_FACTOR_NONE).as_string(); // The manifest is missing some values that are provided by policy. DictionaryValue* manifest = ParseManifest(manifest_contents); diff --git a/chrome/browser/extensions/extension_host.cc b/chrome/browser/extensions/extension_host.cc index 722f279..a4582e5 100644 --- a/chrome/browser/extensions/extension_host.cc +++ b/chrome/browser/extensions/extension_host.cc @@ -49,6 +49,7 @@ #include "grit/generated_resources.h" #include "ui/base/keycodes/keyboard_codes.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/layout.h" #include "ui/base/resource/resource_bundle.h" #if defined(TOOLKIT_VIEWS) @@ -327,7 +328,7 @@ void ExtensionHost::InsertInfobarCSS() { static const base::StringPiece css( ResourceBundle::GetSharedInstance().GetRawDataResource( - IDR_EXTENSIONS_INFOBAR_CSS)); + IDR_EXTENSIONS_INFOBAR_CSS, ui::SCALE_FACTOR_NONE)); render_view_host()->InsertCSS(string16(), css.as_string()); } diff --git a/chrome/browser/extensions/extension_protocols.cc b/chrome/browser/extensions/extension_protocols.cc index 67e92a7..ed7416e 100644 --- a/chrome/browser/extensions/extension_protocols.cc +++ b/chrome/browser/extensions/extension_protocols.cc @@ -27,11 +27,12 @@ #include "grit/component_extension_resources_map.h" #include "net/base/mime_util.h" #include "net/base/net_errors.h" -#include "net/http/http_response_info.h" #include "net/http/http_response_headers.h" +#include "net/http/http_response_info.h" #include "net/url_request/url_request_error_job.h" #include "net/url_request/url_request_file_job.h" #include "net/url_request/url_request_simple_job.h" +#include "ui/base/layout.h" #include "ui/base/resource/resource_bundle.h" using content::ResourceRequestInfo; @@ -73,7 +74,8 @@ class URLRequestResourceBundleJob : public net::URLRequestSimpleJob { std::string* charset, std::string* data) const OVERRIDE { const ResourceBundle& rb = ResourceBundle::GetSharedInstance(); - *data = rb.GetRawDataResource(resource_id_).as_string(); + *data = rb.GetRawDataResource( + resource_id_, ui::SCALE_FACTOR_NONE).as_string(); // Requests should not block on the disk! On Windows this goes to the // registry. diff --git a/chrome/browser/first_run/first_run_win.cc b/chrome/browser/first_run/first_run_win.cc index bd3aafe..a66fd8c 100644 --- a/chrome/browser/first_run/first_run_win.cc +++ b/chrome/browser/first_run/first_run_win.cc @@ -48,6 +48,7 @@ #include "grit/generated_resources.h" #include "grit/locale_settings.h" #include "grit/theme_resources.h" +#include "ui/base/layout.h" #include "ui/base/resource/resource_bundle.h" #include "ui/base/ui_base_switches.h" @@ -174,7 +175,8 @@ bool LaunchSetupWithParam(const std::string& param, // true if successful. bool WriteEULAtoTempFile(FilePath* eula_path) { base::StringPiece terms = - ResourceBundle::GetSharedInstance().GetRawDataResource(IDR_TERMS_HTML); + ResourceBundle::GetSharedInstance().GetRawDataResource( + IDR_TERMS_HTML, ui::SCALE_FACTOR_NONE); if (terms.empty()) return false; FILE *file = file_util::CreateAndOpenTemporaryFile(eula_path); diff --git a/chrome/browser/history/top_sites.cc b/chrome/browser/history/top_sites.cc index 9dab604..779fe3b 100644 --- a/chrome/browser/history/top_sites.cc +++ b/chrome/browser/history/top_sites.cc @@ -39,6 +39,7 @@ #include "grit/locale_settings.h" #include "grit/theme_resources.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/layout.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/image/image_util.h" @@ -254,7 +255,8 @@ bool TopSites::GetPageThumbnail(const GURL& url, for (size_t i = 0; i < arraysize(kPrepopulatedPages); i++) { if (url.spec() == l10n_util::GetStringUTF8(kPrepopulatedPages[i].url_id)) { *bytes = ResourceBundle::GetSharedInstance().LoadDataResourceBytes( - kPrepopulatedPages[i].thumbnail_id); + kPrepopulatedPages[i].thumbnail_id, + ui::SCALE_FACTOR_100P); return true; } } diff --git a/chrome/browser/icon_loader_chromeos.cc b/chrome/browser/icon_loader_chromeos.cc index cc4739f..fbd87ad 100644 --- a/chrome/browser/icon_loader_chromeos.cc +++ b/chrome/browser/icon_loader_chromeos.cc @@ -16,6 +16,7 @@ #include "grit/component_extension_resources.h" #include "skia/ext/image_operations.h" #include "third_party/skia/include/core/SkBitmap.h" +#include "ui/base/layout.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/canvas.h" #include "ui/gfx/codec/png_codec.h" @@ -197,7 +198,7 @@ void IconLoader::ReadIcon() { int idr = icon_mapper.Get().Lookup(group_, icon_size_); ResourceBundle& rb = ResourceBundle::GetSharedInstance(); scoped_refptr<base::RefCountedStaticMemory> bytes( - rb.LoadDataResourceBytes(idr)); + rb.LoadDataResourceBytes(idr, ui::SCALE_FACTOR_100P)); DCHECK(bytes.get()); SkBitmap bitmap; if (!gfx::PNGCodec::Decode(bytes->front(), bytes->size(), &bitmap)) diff --git a/chrome/browser/notifications/desktop_notification_service.cc b/chrome/browser/notifications/desktop_notification_service.cc index ff35176..9ab605e 100644 --- a/chrome/browser/notifications/desktop_notification_service.cc +++ b/chrome/browser/notifications/desktop_notification_service.cc @@ -41,6 +41,7 @@ #include "net/base/escape.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/layout.h" #include "ui/base/resource/resource_bundle.h" using content::BrowserThread; @@ -205,7 +206,7 @@ string16 DesktopNotificationService::CreateDataUrl( int resource, const std::vector<std::string>& subst) { const base::StringPiece template_html( ResourceBundle::GetSharedInstance().GetRawDataResource( - resource)); + resource, ui::SCALE_FACTOR_NONE)); if (template_html.empty()) { NOTREACHED() << "unable to load template. ID: " << resource; diff --git a/chrome/browser/plugin_finder.cc b/chrome/browser/plugin_finder.cc index 2456169..6b3da59fa 100644 --- a/chrome/browser/plugin_finder.cc +++ b/chrome/browser/plugin_finder.cc @@ -16,6 +16,7 @@ #include "content/public/browser/browser_thread.h" #include "googleurl/src/gurl.h" #include "grit/browser_resources.h" +#include "ui/base/layout.h" #include "ui/base/resource/resource_bundle.h" using base::DictionaryValue; @@ -44,7 +45,7 @@ DictionaryValue* PluginFinder::LoadPluginList() { #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) base::StringPiece json_resource( ResourceBundle::GetSharedInstance().GetRawDataResource( - IDR_PLUGIN_DB_JSON)); + IDR_PLUGIN_DB_JSON, ui::SCALE_FACTOR_NONE)); std::string error_str; scoped_ptr<base::Value> value(base::JSONReader::ReadAndReturnError( json_resource.as_string(), diff --git a/chrome/browser/printing/cloud_print/cloud_print_setup_source.cc b/chrome/browser/printing/cloud_print/cloud_print_setup_source.cc index 9398bf8..e4f0b4e 100644 --- a/chrome/browser/printing/cloud_print/cloud_print_setup_source.cc +++ b/chrome/browser/printing/cloud_print/cloud_print_setup_source.cc @@ -17,6 +17,7 @@ #include "grit/locale_settings.h" #include "grit/ui_resources.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/layout.h" #include "ui/base/resource/resource_bundle.h" // Define the values of standard URLs. @@ -67,7 +68,8 @@ void CloudPrintSetupSource::StartDataRequest(const std::string& path_raw, AddString(dict, "sharingexplain", IDS_CLOUD_PRINT_SETUP_SHARING_EXPLAIN); static const base::StringPiece html(ResourceBundle::GetSharedInstance() - .GetRawDataResource(IDR_CLOUD_PRINT_SETUP_LOGIN_HTML)); + .GetRawDataResource(IDR_CLOUD_PRINT_SETUP_LOGIN_HTML, + ui::SCALE_FACTOR_NONE)); SetFontAndTextDirection(dict); response = jstemplate_builder::GetI18nTemplateHtml(html, dict); } else if (path_raw == kCloudPrintGaiaLoginPath) { @@ -103,7 +105,8 @@ void CloudPrintSetupSource::StartDataRequest(const std::string& path_raw, AddString(dict, "getaccesscodeurl", IDS_SYNC_GET_ACCESS_CODE_URL); static const base::StringPiece html(ResourceBundle::GetSharedInstance() - .GetRawDataResource(IDR_GAIA_LOGIN_HTML)); + .GetRawDataResource(IDR_GAIA_LOGIN_HTML, + ui::SCALE_FACTOR_NONE)); SetFontAndTextDirection(dict); response = jstemplate_builder::GetI18nTemplateHtml(html, dict); } else if (path_raw == kCloudPrintSetupDonePath) { @@ -111,13 +114,15 @@ void CloudPrintSetupSource::StartDataRequest(const std::string& path_raw, AddString(dict, "success", IDS_SYNC_SUCCESS); AddString(dict, "okay", IDS_SYNC_SETUP_OK_BUTTON_LABEL); static const base::StringPiece html(ResourceBundle::GetSharedInstance() - .GetRawDataResource(IDR_CLOUD_PRINT_SETUP_DONE_HTML)); + .GetRawDataResource(IDR_CLOUD_PRINT_SETUP_DONE_HTML, + ui::SCALE_FACTOR_NONE)); SetFontAndTextDirection(dict); response = jstemplate_builder::GetI18nTemplateHtml(html, dict); } else if (path_raw == kCloudPrintSetupFlowPath) { static const base::StringPiece html( ResourceBundle::GetSharedInstance() - .GetRawDataResource(IDR_CLOUD_PRINT_SETUP_FLOW_HTML)); + .GetRawDataResource(IDR_CLOUD_PRINT_SETUP_FLOW_HTML, + ui::SCALE_FACTOR_NONE)); response = html.as_string(); } diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc index dd3c3b2..1e9f7be 100644 --- a/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc +++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc @@ -38,6 +38,7 @@ #include "grit/locale_settings.h" #include "net/base/escape.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/layout.h" #include "ui/base/resource/resource_bundle.h" using content::BrowserThread; @@ -195,20 +196,23 @@ std::string SafeBrowsingBlockingPage::GetHTMLContents() { if (unsafe_resources_.size() > 1) { PopulateMultipleThreatStringDictionary(&strings); html = rb.GetRawDataResource( - IDR_SAFE_BROWSING_MULTIPLE_THREAT_BLOCK).as_string(); + IDR_SAFE_BROWSING_MULTIPLE_THREAT_BLOCK, + ui::SCALE_FACTOR_NONE).as_string(); } else { SafeBrowsingService::UrlCheckResult threat_type = unsafe_resources_[0].threat_type; if (threat_type == SafeBrowsingService::URL_MALWARE) { PopulateMalwareStringDictionary(&strings); html = rb.GetRawDataResource( - IDR_SAFE_BROWSING_MALWARE_BLOCK).as_string(); + IDR_SAFE_BROWSING_MALWARE_BLOCK, + ui::SCALE_FACTOR_NONE).as_string(); } else { // Phishing. DCHECK(threat_type == SafeBrowsingService::URL_PHISHING || threat_type == SafeBrowsingService::CLIENT_SIDE_PHISHING_URL); PopulatePhishingStringDictionary(&strings); html = rb.GetRawDataResource( - IDR_SAFE_BROWSING_PHISHING_BLOCK).as_string(); + IDR_SAFE_BROWSING_PHISHING_BLOCK, + ui::SCALE_FACTOR_NONE).as_string(); } } diff --git a/chrome/browser/ssl/ssl_blocking_page.cc b/chrome/browser/ssl/ssl_blocking_page.cc index 3b301be..e5bc81d 100644 --- a/chrome/browser/ssl/ssl_blocking_page.cc +++ b/chrome/browser/ssl/ssl_blocking_page.cc @@ -26,6 +26,7 @@ #include "grit/browser_resources.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/layout.h" #include "ui/base/resource/resource_bundle.h" using content::InterstitialPage; @@ -120,7 +121,8 @@ std::string SSLBlockingPage::GetHTMLContents() { strings.SetString("textdirection", base::i18n::IsRTL() ? "rtl" : "ltr"); base::StringPiece html( - ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id)); + ResourceBundle::GetSharedInstance().GetRawDataResource( + resource_id, ui::SCALE_FACTOR_NONE)); return jstemplate_builder::GetI18nTemplateHtml(html, &strings); } diff --git a/chrome/browser/themes/browser_theme_pack.cc b/chrome/browser/themes/browser_theme_pack.cc index b5f17eb..2e8e9bd 100644 --- a/chrome/browser/themes/browser_theme_pack.cc +++ b/chrome/browser/themes/browser_theme_pack.cc @@ -384,7 +384,7 @@ scoped_refptr<BrowserThemePack> BrowserThemePack::BuildFromDataPack( base::ThreadRestrictions::ScopedAllowIO allow_io; scoped_refptr<BrowserThemePack> pack(new BrowserThemePack); pack->data_pack_.reset( - new ui::DataPack(ui::ResourceHandle::kScaleFactor100x)); + new ui::DataPack(ui::SCALE_FACTOR_100P)); if (!pack->data_pack_->Load(path)) { LOG(ERROR) << "Failed to load theme data pack."; diff --git a/chrome/browser/themes/theme_service.cc b/chrome/browser/themes/theme_service.cc index f9be837..5a75aa6 100644 --- a/chrome/browser/themes/theme_service.cc +++ b/chrome/browser/themes/theme_service.cc @@ -21,6 +21,7 @@ #include "grit/theme_resources.h" #include "grit/theme_resources_standard.h" #include "grit/ui_resources.h" +#include "ui/base/layout.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/image/image_skia.h" @@ -324,7 +325,7 @@ base::RefCountedMemory* ThemeService::GetRawData(int id) const { if (theme_pack_.get()) data = theme_pack_->GetRawData(id); if (!data) - data = rb_.LoadDataResourceBytes(id); + data = rb_.LoadDataResourceBytes(id, ui::SCALE_FACTOR_100P); return data; } diff --git a/chrome/browser/translate/translate_manager.cc b/chrome/browser/translate/translate_manager.cc index 21565cf..acf05e0 100644 --- a/chrome/browser/translate/translate_manager.cc +++ b/chrome/browser/translate/translate_manager.cc @@ -50,6 +50,7 @@ #include "net/base/escape.h" #include "net/base/load_flags.h" #include "net/url_request/url_request_status.h" +#include "ui/base/layout.h" #include "ui/base/resource/resource_bundle.h" #ifdef FILE_MANAGER_EXTENSION @@ -427,7 +428,8 @@ void TranslateManager::OnURLFetchComplete(const net::URLFetcher* source) { translate_script_request_pending_.release()); if (!error) { base::StringPiece str = ResourceBundle::GetSharedInstance(). - GetRawDataResource(IDR_TRANSLATE_JS); + GetRawDataResource(IDR_TRANSLATE_JS, + ui::SCALE_FACTOR_NONE); DCHECK(translate_script_.empty()); str.CopyToString(&translate_script_); std::string data; diff --git a/chrome/browser/ui/pdf/pdf_unsupported_feature.cc b/chrome/browser/ui/pdf/pdf_unsupported_feature.cc index 340dba0..8924fcc 100644 --- a/chrome/browser/ui/pdf/pdf_unsupported_feature.cc +++ b/chrome/browser/ui/pdf/pdf_unsupported_feature.cc @@ -31,6 +31,7 @@ #include "grit/generated_resources.h" #include "grit/theme_resources_standard.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/layout.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/image/image.h" #include "webkit/plugins/npapi/plugin_group.h" @@ -204,7 +205,8 @@ class PDFUnsupportedFeatureInterstitial l10n_util::GetStringUTF16(IDS_READER_OUT_OF_DATE_BLOCKING_PAGE_CANCEL)); base::StringPiece html(ResourceBundle::GetSharedInstance(). - GetRawDataResource(IDR_READER_OUT_OF_DATE_HTML)); + GetRawDataResource(IDR_READER_OUT_OF_DATE_HTML, + ui::SCALE_FACTOR_NONE)); return jstemplate_builder::GetI18nTemplateHtml(html, &strings); } diff --git a/chrome/browser/ui/webui/about_ui.cc b/chrome/browser/ui/webui/about_ui.cc index 89fd4fa..6d7d77c 100644 --- a/chrome/browser/ui/webui/about_ui.cc +++ b/chrome/browser/ui/webui/about_ui.cc @@ -65,6 +65,7 @@ #include "net/base/escape.h" #include "net/base/net_util.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/layout.h" #include "ui/base/resource/resource_bundle.h" #include "v8/include/v8.h" #include "webkit/glue/user_agent.h" @@ -72,8 +73,8 @@ #include "webkit/plugins/webplugininfo.h" #if defined(OS_LINUX) || defined(OS_OPENBSD) -#include "content/public/common/sandbox_linux.h" #include "content/public/browser/zygote_host_linux.h" +#include "content/public/common/sandbox_linux.h" #endif #if defined(OS_WIN) @@ -246,7 +247,7 @@ class ChromeOSTermsHandler // Do nothing if OEM EULA load failed. if (contents_.empty() && path_ != chrome::kOemEulaURLPath) { contents_ = ResourceBundle::GetSharedInstance().GetRawDataResource( - IDR_TERMS_HTML).as_string(); + IDR_TERMS_HTML, ui::SCALE_FACTOR_NONE).as_string(); } source_->FinishDataRequest(contents_, request_id_); } @@ -839,7 +840,8 @@ void FinishMemoryDataRequest(const std::string& path, source->FinishDataRequest( ResourceBundle::GetSharedInstance().GetRawDataResource( path == kMemoryJsPath ? IDR_ABOUT_MEMORY_JS : - IDR_ABOUT_MEMORY_HTML).as_string(), request_id); + IDR_ABOUT_MEMORY_HTML, + ui::SCALE_FACTOR_NONE).as_string(), request_id); } } @@ -990,8 +992,8 @@ std::string AboutStats(const std::string& query) { } else { // Get about_stats.html/js from resource bundle. data = ResourceBundle::GetSharedInstance().GetRawDataResource( - (query == kStatsJsPath ? IDR_ABOUT_STATS_JS : IDR_ABOUT_STATS_HTML)). - as_string(); + (query == kStatsJsPath ? IDR_ABOUT_STATS_JS : IDR_ABOUT_STATS_HTML), + ui::SCALE_FACTOR_NONE).as_string(); if (query != kStatsJsPath) { // Clear the timer list since we stored the data in the timers list @@ -1086,7 +1088,7 @@ std::string AboutVersionStaticContent(const std::string& query) { return ResourceBundle::GetSharedInstance().GetRawDataResource( query == kVersionJsPath ? IDR_ABOUT_VERSION_JS : - IDR_ABOUT_VERSION_HTML).as_string(); + IDR_ABOUT_VERSION_HTML, ui::SCALE_FACTOR_NONE).as_string(); } std::string AboutVersionStrings(DictionaryValue* localized_strings, @@ -1387,7 +1389,7 @@ void AboutUIHTMLSource::StartDataRequest(const std::string& path, } else if (host == chrome::kChromeUICreditsHost) { int idr = (path == kCreditsJsPath) ? IDR_CREDITS_JS : IDR_CREDITS_HTML; response = ResourceBundle::GetSharedInstance().GetRawDataResource( - idr).as_string(); + idr, ui::SCALE_FACTOR_NONE).as_string(); #if defined(OS_CHROMEOS) } else if (host == chrome::kChromeUICryptohomeHost) { FinishCryptohomeDataRequest(this, path, request_id); @@ -1418,7 +1420,7 @@ void AboutUIHTMLSource::StartDataRequest(const std::string& path, response = AboutNetwork(path); } else if (host == chrome::kChromeUIOSCreditsHost) { response = ResourceBundle::GetSharedInstance().GetRawDataResource( - IDR_OS_CREDITS_HTML).as_string(); + IDR_OS_CREDITS_HTML, ui::SCALE_FACTOR_NONE).as_string(); #endif #if defined(OS_LINUX) || defined(OS_OPENBSD) } else if (host == chrome::kChromeUISandboxHost) { @@ -1432,7 +1434,7 @@ void AboutUIHTMLSource::StartDataRequest(const std::string& path, return; #else response = ResourceBundle::GetSharedInstance().GetRawDataResource( - IDR_TERMS_HTML).as_string(); + IDR_TERMS_HTML, ui::SCALE_FACTOR_NONE).as_string(); #endif } else if (host == chrome::kChromeUIVersionHost) { if (path == kStringsJsPath) { diff --git a/chrome/browser/ui/webui/bookmarks_ui.cc b/chrome/browser/ui/webui/bookmarks_ui.cc index 8154368..de67b3e 100644 --- a/chrome/browser/ui/webui/bookmarks_ui.cc +++ b/chrome/browser/ui/webui/bookmarks_ui.cc @@ -19,10 +19,11 @@ #include "chrome/common/url_constants.h" #include "content/public/browser/web_contents.h" #include "content/public/browser/web_ui.h" +#include "googleurl/src/gurl.h" #include "grit/theme_resources.h" #include "grit/theme_resources_standard.h" +#include "ui/base/layout.h" #include "ui/base/resource/resource_bundle.h" -#include "googleurl/src/gurl.h" using content::WebContents; @@ -70,5 +71,6 @@ BookmarksUI::BookmarksUI(content::WebUI* web_ui) : WebUIController(web_ui) { // static base::RefCountedMemory* BookmarksUI::GetFaviconResourceBytes() { return ResourceBundle::GetSharedInstance(). - LoadDataResourceBytes(IDR_BOOKMARKS_FAVICON); + LoadDataResourceBytes(IDR_BOOKMARKS_FAVICON, + ui::SCALE_FACTOR_100P); } 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 d4a1c67..1fa1457 100644 --- a/chrome/browser/ui/webui/chrome_web_ui_data_source.cc +++ b/chrome/browser/ui/webui/chrome_web_ui_data_source.cc @@ -10,6 +10,7 @@ #include "base/string_util.h" #include "chrome/common/jstemplate_builder.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/layout.h" #include "ui/base/resource/resource_bundle.h" ChromeWebUIDataSource::ChromeWebUIDataSource(const std::string& source_name) @@ -86,6 +87,7 @@ void ChromeWebUIDataSource::SendLocalizedStringsAsJSON(int request_id) { void ChromeWebUIDataSource::SendFromResourceBundle(int request_id, int idr) { scoped_refptr<base::RefCountedStaticMemory> response( - ResourceBundle::GetSharedInstance().LoadDataResourceBytes(idr)); + ResourceBundle::GetSharedInstance().LoadDataResourceBytes( + idr, ui::SCALE_FACTOR_NONE)); SendResponse(request_id, response); } diff --git a/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc b/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc index eda42a7..0b36cd9 100644 --- a/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc +++ b/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc @@ -35,6 +35,7 @@ #include "content/public/browser/web_contents.h" #include "content/public/browser/web_ui.h" #include "grit/browser_resources.h" +#include "ui/base/layout.h" #include "ui/base/resource/resource_bundle.h" using content::WebContents; @@ -107,7 +108,8 @@ void OobeUIHTMLSource::StartDataRequest(const std::string& path, std::string OobeUIHTMLSource::GetDataResource(int resource_id) const { const base::StringPiece html( - ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id)); + ResourceBundle::GetSharedInstance().GetRawDataResource( + resource_id, ui::SCALE_FACTOR_NONE)); return jstemplate_builder::GetI18nTemplateHtml(html, localized_strings_.get()); } diff --git a/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc b/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc index 98dd59a..bf875d7 100644 --- a/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc +++ b/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc @@ -44,6 +44,7 @@ #include "grit/generated_resources.h" #include "grit/locale_settings.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/layout.h" #include "ui/base/resource/resource_bundle.h" using content::BrowserThread; @@ -483,7 +484,7 @@ void MobileSetupUIHTMLSource::StartDataRequest(const std::string& path, static const base::StringPiece html( ResourceBundle::GetSharedInstance().GetRawDataResource( - IDR_MOBILE_SETUP_PAGE_HTML)); + IDR_MOBILE_SETUP_PAGE_HTML, ui::SCALE_FACTOR_NONE)); std::string full_html = jstemplate_builder::GetI18nTemplateHtml(html, &strings); diff --git a/chrome/browser/ui/webui/chromeos/proxy_settings_ui.cc b/chrome/browser/ui/webui/chromeos/proxy_settings_ui.cc index 4a4d7c9..ebd296b 100644 --- a/chrome/browser/ui/webui/chromeos/proxy_settings_ui.cc +++ b/chrome/browser/ui/webui/chromeos/proxy_settings_ui.cc @@ -20,6 +20,7 @@ #include "content/public/browser/web_ui.h" #include "content/public/browser/web_ui_message_handler.h" #include "grit/browser_resources.h" +#include "ui/base/layout.h" #include "ui/base/resource/resource_bundle.h" using content::WebContents; @@ -59,7 +60,7 @@ void ProxySettingsHTMLSource::StartDataRequest(const std::string& path, static const base::StringPiece html( ResourceBundle::GetSharedInstance().GetRawDataResource( - IDR_PROXY_SETTINGS_HTML)); + IDR_PROXY_SETTINGS_HTML, ui::SCALE_FACTOR_NONE)); std::string full_html = jstemplate_builder::GetI18nTemplateHtml( html, localized_strings_.get()); diff --git a/chrome/browser/ui/webui/chromeos/register_page_ui.cc b/chrome/browser/ui/webui/chromeos/register_page_ui.cc index 394a928..ca1889a 100644 --- a/chrome/browser/ui/webui/chromeos/register_page_ui.cc +++ b/chrome/browser/ui/webui/chromeos/register_page_ui.cc @@ -31,6 +31,7 @@ #include "content/public/browser/web_ui_message_handler.h" #include "googleurl/src/gurl.h" #include "grit/browser_resources.h" +#include "ui/base/layout.h" #include "ui/base/resource/resource_bundle.h" using content::WebContents; @@ -167,7 +168,8 @@ void RegisterPageUIHTMLSource::StartDataRequest(const std::string& path, scoped_refptr<base::RefCountedMemory> html_bytes( ResourceBundle::GetSharedInstance().LoadDataResourceBytes( - IDR_HOST_REGISTRATION_PAGE_HTML)); + IDR_HOST_REGISTRATION_PAGE_HTML, + ui::SCALE_FACTOR_NONE)); SendResponse(request_id, html_bytes); } diff --git a/chrome/browser/ui/webui/chromeos/sim_unlock_ui.cc b/chrome/browser/ui/webui/chromeos/sim_unlock_ui.cc index a097d71..ea7825e 100644 --- a/chrome/browser/ui/webui/chromeos/sim_unlock_ui.cc +++ b/chrome/browser/ui/webui/chromeos/sim_unlock_ui.cc @@ -30,6 +30,7 @@ #include "grit/browser_resources.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/layout.h" #include "ui/base/resource/resource_bundle.h" using content::BrowserThread; @@ -305,7 +306,7 @@ void SimUnlockUIHTMLSource::StartDataRequest(const std::string& path, static const base::StringPiece html( ResourceBundle::GetSharedInstance().GetRawDataResource( - IDR_SIM_UNLOCK_HTML)); + IDR_SIM_UNLOCK_HTML, ui::SCALE_FACTOR_NONE)); std::string full_html = jstemplate_builder::GetI18nTemplateHtml(html, &strings); diff --git a/chrome/browser/ui/webui/chromeos/system_info_ui.cc b/chrome/browser/ui/webui/chromeos/system_info_ui.cc index 0109bc4..8b3b599 100644 --- a/chrome/browser/ui/webui/chromeos/system_info_ui.cc +++ b/chrome/browser/ui/webui/chromeos/system_info_ui.cc @@ -34,6 +34,7 @@ #include "net/base/directory_lister.h" #include "net/base/escape.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/layout.h" #include "ui/base/resource/resource_bundle.h" using content::WebContents; @@ -146,7 +147,7 @@ void SystemInfoUIHTMLSource::SyslogsComplete( } static const base::StringPiece systeminfo_html( ResourceBundle::GetSharedInstance().GetRawDataResource( - IDR_ABOUT_SYS_HTML)); + IDR_ABOUT_SYS_HTML, ui::SCALE_FACTOR_NONE)); std::string full_html = jstemplate_builder::GetTemplatesHtml( systeminfo_html, &strings, "t" /* template root node id */); diff --git a/chrome/browser/ui/webui/conflicts_ui.cc b/chrome/browser/ui/webui/conflicts_ui.cc index 75c1816..d5e8ed9 100644 --- a/chrome/browser/ui/webui/conflicts_ui.cc +++ b/chrome/browser/ui/webui/conflicts_ui.cc @@ -33,6 +33,7 @@ #include "grit/theme_resources.h" #include "grit/theme_resources_standard.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/layout.h" #include "ui/base/resource/resource_bundle.h" using content::UserMetricsAction; @@ -174,7 +175,7 @@ ConflictsUI::ConflictsUI(content::WebUI* web_ui) : WebUIController(web_ui) { base::RefCountedMemory* ConflictsUI::GetFaviconResourceBytes() { return static_cast<base::RefCountedMemory*>( ResourceBundle::GetSharedInstance().LoadDataResourceBytes( - IDR_CONFLICT_FAVICON)); + IDR_CONFLICT_FAVICON, ui::SCALE_FACTOR_NONE)); } #endif diff --git a/chrome/browser/ui/webui/crashes_ui.cc b/chrome/browser/ui/webui/crashes_ui.cc index f8c5760..bf68b06 100644 --- a/chrome/browser/ui/webui/crashes_ui.cc +++ b/chrome/browser/ui/webui/crashes_ui.cc @@ -30,6 +30,7 @@ #include "grit/theme_resources.h" #include "grit/theme_resources_standard.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/layout.h" #include "ui/base/resource/resource_bundle.h" #if defined(OS_CHROMEOS) @@ -172,7 +173,8 @@ CrashesUI::CrashesUI(content::WebUI* web_ui) : WebUIController(web_ui) { // static base::RefCountedMemory* CrashesUI::GetFaviconResourceBytes() { return ResourceBundle::GetSharedInstance(). - LoadDataResourceBytes(IDR_SAD_FAVICON); + LoadDataResourceBytes(IDR_SAD_FAVICON, + ui::SCALE_FACTOR_NONE); } // static diff --git a/chrome/browser/ui/webui/devtools_ui.cc b/chrome/browser/ui/webui/devtools_ui.cc index 14b04f4..a58de6a 100644 --- a/chrome/browser/ui/webui/devtools_ui.cc +++ b/chrome/browser/ui/webui/devtools_ui.cc @@ -19,6 +19,7 @@ #include "content/public/browser/render_view_host.h" #include "content/public/browser/web_contents.h" #include "content/public/browser/web_ui.h" +#include "ui/base/layout.h" #include "ui/base/resource/resource_bundle.h" using content::BrowserThread; @@ -66,7 +67,7 @@ void DevToolsDataSource::StartDataRequest(const std::string& path, " with --debug-devtools."; const ResourceBundle& rb = ResourceBundle::GetSharedInstance(); scoped_refptr<base::RefCountedStaticMemory> bytes(rb.LoadDataResourceBytes( - resource_id)); + resource_id, ui::SCALE_FACTOR_NONE)); SendResponse(request_id, bytes); } diff --git a/chrome/browser/ui/webui/downloads_ui.cc b/chrome/browser/ui/webui/downloads_ui.cc index efc035b..57b7f7a 100644 --- a/chrome/browser/ui/webui/downloads_ui.cc +++ b/chrome/browser/ui/webui/downloads_ui.cc @@ -24,6 +24,7 @@ #include "grit/generated_resources.h" #include "grit/theme_resources.h" #include "grit/theme_resources_standard.h" +#include "ui/base/layout.h" #include "ui/base/resource/resource_bundle.h" using content::DownloadManager; @@ -103,5 +104,6 @@ DownloadsUI::DownloadsUI(content::WebUI* web_ui) : WebUIController(web_ui) { // static base::RefCountedMemory* DownloadsUI::GetFaviconResourceBytes() { return ResourceBundle::GetSharedInstance(). - LoadDataResourceBytes(IDR_DOWNLOADS_FAVICON); + LoadDataResourceBytes(IDR_DOWNLOADS_FAVICON, + ui::SCALE_FACTOR_NONE); } diff --git a/chrome/browser/ui/webui/extensions/extension_icon_source.cc b/chrome/browser/ui/webui/extensions/extension_icon_source.cc index a8bbec6..519832d 100644 --- a/chrome/browser/ui/webui/extensions/extension_icon_source.cc +++ b/chrome/browser/ui/webui/extensions/extension_icon_source.cc @@ -19,10 +19,11 @@ #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_resource.h" #include "chrome/common/url_constants.h" +#include "googleurl/src/gurl.h" #include "grit/component_extension_resources_map.h" #include "grit/theme_resources.h" -#include "googleurl/src/gurl.h" #include "skia/ext/image_operations.h" +#include "ui/base/layout.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/codec/png_codec.h" #include "ui/gfx/color_utils.h" @@ -90,7 +91,8 @@ GURL ExtensionIconSource::GetIconURL(const Extension* extension, // static SkBitmap* ExtensionIconSource::LoadImageByResourceId(int resource_id) { std::string contents = ResourceBundle::GetSharedInstance() - .GetRawDataResource(resource_id).as_string(); + .GetRawDataResource(resource_id, + ui::SCALE_FACTOR_100P).as_string(); // Convert and return it. const unsigned char* data = diff --git a/chrome/browser/ui/webui/favicon_source.cc b/chrome/browser/ui/webui/favicon_source.cc index 4a1b3c0..6fa19b9 100644 --- a/chrome/browser/ui/webui/favicon_source.cc +++ b/chrome/browser/ui/webui/favicon_source.cc @@ -12,6 +12,7 @@ #include "grit/locale_settings.h" #include "grit/ui_resources.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/layout.h" #include "ui/base/resource/resource_bundle.h" FaviconSource::FaviconSource(Profile* profile, IconType type) @@ -96,7 +97,8 @@ void FaviconSource::StartDataRequest(const std::string& path, request_size_map_.erase(request_id); SendResponse(request_id, ResourceBundle::GetSharedInstance().LoadDataResourceBytes( - history::kPrepopulatedPages[i].favicon_id)); + history::kPrepopulatedPages[i].favicon_id, + ui::SCALE_FACTOR_100P)); return; } } @@ -148,14 +150,14 @@ void FaviconSource::SendDefaultResponse(int request_id) { if (!default_favicon_large_.get()) { default_favicon_large_ = ResourceBundle::GetSharedInstance().LoadDataResourceBytes( - IDR_DEFAULT_LARGE_FAVICON); + IDR_DEFAULT_LARGE_FAVICON, ui::SCALE_FACTOR_100P); } bytes = default_favicon_large_; } else { if (!default_favicon_.get()) { default_favicon_ = ResourceBundle::GetSharedInstance().LoadDataResourceBytes( - IDR_DEFAULT_FAVICON); + IDR_DEFAULT_FAVICON, ui::SCALE_FACTOR_100P); } bytes = default_favicon_; } diff --git a/chrome/browser/ui/webui/flags_ui.cc b/chrome/browser/ui/webui/flags_ui.cc index 2e7da67..42bf58b 100644 --- a/chrome/browser/ui/webui/flags_ui.cc +++ b/chrome/browser/ui/webui/flags_ui.cc @@ -26,9 +26,10 @@ #include "grit/browser_resources.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" -#include "grit/theme_resources_standard.h" #include "grit/theme_resources.h" +#include "grit/theme_resources_standard.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/layout.h" #include "ui/base/resource/resource_bundle.h" #if defined(OS_CHROMEOS) @@ -169,7 +170,7 @@ FlagsUI::FlagsUI(content::WebUI* web_ui) : WebUIController(web_ui) { // static base::RefCountedMemory* FlagsUI::GetFaviconResourceBytes() { return ResourceBundle::GetSharedInstance(). - LoadDataResourceBytes(IDR_FLAGS); + LoadDataResourceBytes(IDR_FLAGS, ui::SCALE_FACTOR_100P); } // static diff --git a/chrome/browser/ui/webui/history_ui.cc b/chrome/browser/ui/webui/history_ui.cc index 1f3c0fa..158e976 100644 --- a/chrome/browser/ui/webui/history_ui.cc +++ b/chrome/browser/ui/webui/history_ui.cc @@ -45,6 +45,7 @@ #include "grit/theme_resources_standard.h" #include "net/base/escape.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/layout.h" #include "ui/base/resource/resource_bundle.h" using content::UserMetricsAction; @@ -485,5 +486,6 @@ const GURL HistoryUI::GetHistoryURLWithSearchText(const string16& text) { // static base::RefCountedMemory* HistoryUI::GetFaviconResourceBytes() { return ResourceBundle::GetSharedInstance(). - LoadDataResourceBytes(IDR_HISTORY_FAVICON); + LoadDataResourceBytes(IDR_HISTORY_FAVICON, + ui::SCALE_FACTOR_100P); } diff --git a/chrome/browser/ui/webui/ntp/new_tab_ui.cc b/chrome/browser/ui/webui/ntp/new_tab_ui.cc index 2ad684e..1a4f5e8 100644 --- a/chrome/browser/ui/webui/ntp/new_tab_ui.cc +++ b/chrome/browser/ui/webui/ntp/new_tab_ui.cc @@ -53,6 +53,8 @@ #include "grit/generated_resources.h" #include "grit/theme_resources.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/layout.h" +#include "ui/base/resource/resource_bundle.h" #if !defined(OS_ANDROID) #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" @@ -355,7 +357,7 @@ void NewTabUI::NewTabHTMLSource::StartDataRequest(const std::string& path, scoped_refptr<base::RefCountedStaticMemory> resource_bytes( it->second.second ? ResourceBundle::GetSharedInstance().LoadDataResourceBytes( - it->second.second) : + it->second.second, ui::SCALE_FACTOR_NONE) : new base::RefCountedStaticMemory); SendResponse(request_id, resource_bytes); return; diff --git a/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc b/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc index fd46886..034fc9f 100644 --- a/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc +++ b/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc @@ -45,6 +45,7 @@ #include "grit/theme_resources.h" #include "ui/base/animation/animation.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/layout.h" #include "ui/base/resource/resource_bundle.h" #include "ui/base/theme_provider.h" #include "ui/gfx/color_utils.h" @@ -291,7 +292,7 @@ void NTPResourceCache::CreateNewTabIncognitoHTML() { static const base::StringPiece incognito_tab_html( ResourceBundle::GetSharedInstance().GetRawDataResource( - new_tab_html_idr)); + new_tab_html_idr, ui::SCALE_FACTOR_NONE)); std::string full_html = jstemplate_builder::GetI18nTemplateHtml( incognito_tab_html, &localized_strings); @@ -427,7 +428,8 @@ void NTPResourceCache::CreateNewTabHTML() { // Load the new tab page appropriate for this build base::StringPiece new_tab_html(ResourceBundle::GetSharedInstance(). - GetRawDataResource(IDR_NEW_TAB_4_HTML)); + GetRawDataResource(IDR_NEW_TAB_4_HTML, + ui::SCALE_FACTOR_NONE)); jstemplate_builder::UseVersion2 version2; std::string full_html = jstemplate_builder::GetI18nTemplateHtml(new_tab_html, &load_time_data); @@ -458,7 +460,7 @@ void NTPResourceCache::CreateNewTabIncognitoCSS() { // Get our template. static const base::StringPiece new_tab_theme_css( ResourceBundle::GetSharedInstance().GetRawDataResource( - IDR_NEW_INCOGNITO_TAB_THEME_CSS)); + IDR_NEW_INCOGNITO_TAB_THEME_CSS, ui::SCALE_FACTOR_NONE)); // Create the string from our template and the replacements. std::string full_css = ReplaceStringPlaceholders( @@ -553,7 +555,7 @@ void NTPResourceCache::CreateNewTabCSS() { // Get our template. static const base::StringPiece new_tab_theme_css( ResourceBundle::GetSharedInstance().GetRawDataResource( - IDR_NEW_TAB_4_THEME_CSS)); + IDR_NEW_TAB_4_THEME_CSS, ui::SCALE_FACTOR_NONE)); // Create the string from our template and the replacements. std::string css_string; diff --git a/chrome/browser/ui/webui/ntp/ntp_resource_cache_android.cc b/chrome/browser/ui/webui/ntp/ntp_resource_cache_android.cc index db8d468..61d6230 100644 --- a/chrome/browser/ui/webui/ntp/ntp_resource_cache_android.cc +++ b/chrome/browser/ui/webui/ntp/ntp_resource_cache_android.cc @@ -4,11 +4,11 @@ #include "chrome/browser/ui/webui/ntp/ntp_resource_cache.h" +#include "base/memory/ref_counted_memory.h" #include "base/string16.h" #include "base/string_piece.h" #include "base/utf_string_conversions.h" #include "base/values.h" -#include "base/memory/ref_counted_memory.h" #include "chrome/browser/google/google_util.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/webui/chrome_url_data_manager.h" @@ -19,6 +19,7 @@ #include "grit/browser_resources.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/layout.h" #include "ui/base/resource/resource_bundle.h" using content::BrowserThread; @@ -73,7 +74,8 @@ void NTPResourceCache::CreateNewTabHTML() { ChromeURLDataManager::DataSource::SetFontAndTextDirection(&localized_strings); base::StringPiece new_tab_html(ResourceBundle::GetSharedInstance(). - GetRawDataResource(IDR_NEW_TAB_4_HTML)); + GetRawDataResource(IDR_NEW_TAB_4_HTML, + ui::SCALE_FACTOR_NONE)); const char* new_tab_link = kLearnMoreIncognitoUrl; string16 learnMoreLink = ASCIIToUTF16( diff --git a/chrome/browser/ui/webui/options2/chromeos/wallpaper_thumbnail_source2.cc b/chrome/browser/ui/webui/options2/chromeos/wallpaper_thumbnail_source2.cc index bc38e2d..73f7e3f 100644 --- a/chrome/browser/ui/webui/options2/chromeos/wallpaper_thumbnail_source2.cc +++ b/chrome/browser/ui/webui/options2/chromeos/wallpaper_thumbnail_source2.cc @@ -19,6 +19,7 @@ #include "content/public/browser/browser_thread.h" #include "grit/ui_resources.h" #include "net/base/mime_util.h" +#include "ui/base/layout.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/codec/png_codec.h" @@ -107,7 +108,8 @@ void WallpaperThumbnailSource::StartDataRequest(const std::string& path, if (idr != -1) { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); const ResourceBundle& rb = ResourceBundle::GetSharedInstance(); - SendResponse(request_id, rb.LoadDataResourceBytes(idr)); + SendResponse(request_id, rb.LoadDataResourceBytes(idr, + ui::SCALE_FACTOR_100P)); } } diff --git a/chrome/browser/ui/webui/options2/options_ui2.cc b/chrome/browser/ui/webui/options2/options_ui2.cc index 33b13b7..8edd569 100644 --- a/chrome/browser/ui/webui/options2/options_ui2.cc +++ b/chrome/browser/ui/webui/options2/options_ui2.cc @@ -57,6 +57,7 @@ #include "grit/theme_resources.h" #include "grit/theme_resources_standard.h" #include "net/base/escape.h" +#include "ui/base/layout.h" #include "ui/base/resource/resource_bundle.h" #if defined(OS_CHROMEOS) @@ -149,11 +150,11 @@ void OptionsUIHTMLSource::StartDataRequest(const std::string& path, } else if (path == kOptionsBundleJsFile) { // Return (and cache) the options javascript code. response_bytes = ResourceBundle::GetSharedInstance().LoadDataResourceBytes( - IDR_OPTIONS2_BUNDLE_JS); + IDR_OPTIONS2_BUNDLE_JS, ui::SCALE_FACTOR_NONE); } else { // Return (and cache) the main options html page as the default. response_bytes = ResourceBundle::GetSharedInstance().LoadDataResourceBytes( - IDR_OPTIONS2_HTML); + IDR_OPTIONS2_HTML, ui::SCALE_FACTOR_NONE); } SendResponse(request_id, response_bytes); @@ -355,7 +356,8 @@ void OptionsUI::ProcessAutocompleteSuggestions( // static base::RefCountedMemory* OptionsUI::GetFaviconResourceBytes() { return ResourceBundle::GetSharedInstance(). - LoadDataResourceBytes(IDR_SETTINGS_FAVICON); + LoadDataResourceBytes(IDR_SETTINGS_FAVICON, + ui::SCALE_FACTOR_100P); } void OptionsUI::InitializeHandlers() { diff --git a/chrome/browser/ui/webui/plugins_ui.cc b/chrome/browser/ui/webui/plugins_ui.cc index 34aef3c..901ff58 100644 --- a/chrome/browser/ui/webui/plugins_ui.cc +++ b/chrome/browser/ui/webui/plugins_ui.cc @@ -19,9 +19,9 @@ #include "base/values.h" #include "chrome/browser/content_settings/host_content_settings_map.h" #include "chrome/browser/plugin_prefs.h" -#include "chrome/browser/prefs/scoped_user_pref_update.h" #include "chrome/browser/prefs/pref_member.h" #include "chrome/browser/prefs/pref_service.h" +#include "chrome/browser/prefs/scoped_user_pref_update.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_window.h" @@ -42,6 +42,7 @@ #include "grit/theme_resources.h" #include "grit/theme_resources_standard.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_group.h" @@ -483,7 +484,7 @@ PluginsUI::PluginsUI(content::WebUI* web_ui) : WebUIController(web_ui) { // static base::RefCountedMemory* PluginsUI::GetFaviconResourceBytes() { return ResourceBundle::GetSharedInstance(). - LoadDataResourceBytes(IDR_PLUGIN); + LoadDataResourceBytes(IDR_PLUGIN, ui::SCALE_FACTOR_100P); } // static diff --git a/chrome/browser/ui/webui/sessions_ui.cc b/chrome/browser/ui/webui/sessions_ui.cc index 3743b31..cb68200 100644 --- a/chrome/browser/ui/webui/sessions_ui.cc +++ b/chrome/browser/ui/webui/sessions_ui.cc @@ -28,6 +28,7 @@ #include "grit/theme_resources.h" #include "grit/theme_resources_standard.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/layout.h" #include "ui/base/resource/resource_bundle.h" using content::WebContents; @@ -270,5 +271,6 @@ SessionsUI::SessionsUI(content::WebUI* web_ui) : WebUIController(web_ui) { // static base::RefCountedMemory* SessionsUI::GetFaviconResourceBytes() { return ResourceBundle::GetSharedInstance(). - LoadDataResourceBytes(IDR_HISTORY_FAVICON); + LoadDataResourceBytes(IDR_HISTORY_FAVICON, + ui::SCALE_FACTOR_100P); } diff --git a/chrome/browser/ui/webui/shared_resources_data_source.cc b/chrome/browser/ui/webui/shared_resources_data_source.cc index 378b8e3..2d6630b 100644 --- a/chrome/browser/ui/webui/shared_resources_data_source.cc +++ b/chrome/browser/ui/webui/shared_resources_data_source.cc @@ -76,7 +76,7 @@ void SharedResourcesDataSource::StartDataRequest(const std::string& path, DCHECK_NE(-1, idr) << " path: " << path; const ResourceBundle& rb = ResourceBundle::GetSharedInstance(); scoped_refptr<base::RefCountedStaticMemory> bytes( - rb.LoadDataResourceBytes(idr)); + rb.LoadDataResourceBytes(idr, ui::SCALE_FACTOR_NONE)); SendResponse(request_id, bytes); } diff --git a/chrome/browser/ui/webui/theme_source.cc b/chrome/browser/ui/webui/theme_source.cc index 2c2a59b..b51c05d 100644 --- a/chrome/browser/ui/webui/theme_source.cc +++ b/chrome/browser/ui/webui/theme_source.cc @@ -6,6 +6,7 @@ #include "base/memory/ref_counted_memory.h" #include "base/message_loop.h" +#include "base/string_number_conversions.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/resources_util.h" #include "chrome/browser/themes/theme_service.h" @@ -15,21 +16,60 @@ #include "chrome/common/url_constants.h" #include "content/public/browser/browser_thread.h" #include "googleurl/src/gurl.h" +#include "ui/base/layout.h" #include "ui/base/resource/resource_bundle.h" #include "ui/base/theme_provider.h" using content::BrowserThread; +namespace { + // use a resource map rather than hard-coded strings. static const char* kNewTabCSSPath = "css/new_tab_theme.css"; static const char* kNewIncognitoTabCSSPath = "css/incognito_new_tab_theme.css"; -static std::string StripQueryParams(const std::string& path) { +struct ScaleFactorMap { + const char* name; + ui::ScaleFactor scale_factor; +}; + +const ScaleFactorMap kScaleFactorMap[] = { + { "1x", ui::SCALE_FACTOR_100P }, + { "2x", ui::SCALE_FACTOR_200P }, +}; + +std::string StripQueryParams(const std::string& path) { GURL path_url = GURL(std::string(chrome::kChromeUIScheme) + "://" + std::string(chrome::kChromeUIThemePath) + "/" + path); return path_url.path().substr(1); // path() always includes a leading '/'. } +std::string ParsePathAndScale(const std::string& path, + ui::ScaleFactor* scale_factor) { + // Our path may include cachebuster arguments, so trim them off. + std::string uncached_path = StripQueryParams(path); + if (scale_factor) + *scale_factor = ui::SCALE_FACTOR_100P; + + // Detect and parse resource string ending in @<scale>x. + std::size_t pos = uncached_path.rfind('@'); + if (pos != std::string::npos) { + if (scale_factor) { + for (size_t i = 0; i < arraysize(kScaleFactorMap); i++) { + if (uncached_path.compare(pos + 1, uncached_path.length() - pos - 1, + kScaleFactorMap[i].name) == 0) { + *scale_factor = kScaleFactorMap[i].scale_factor; + } + } + } + // Strip scale factor specification from path. + uncached_path = uncached_path.substr(0, pos); + } + return uncached_path; +} + +} // namespace + //////////////////////////////////////////////////////////////////////////////// // ThemeSource, public: @@ -46,8 +86,9 @@ ThemeSource::~ThemeSource() { void ThemeSource::StartDataRequest(const std::string& path, bool is_incognito, int request_id) { - // Our path may include cachebuster arguments, so trim them off. - std::string uncached_path = StripQueryParams(path); + // Default scale factor if not specified. + ui::ScaleFactor scale_factor; + std::string uncached_path = ParsePathAndScale(path, &scale_factor); if (uncached_path == kNewTabCSSPath || uncached_path == kNewIncognitoTabCSSPath) { @@ -60,7 +101,7 @@ void ThemeSource::StartDataRequest(const std::string& path, } else { int resource_id = ResourcesUtil::GetThemeResourceId(uncached_path); if (resource_id != -1) { - SendThemeBitmap(request_id, resource_id); + SendThemeBitmap(request_id, resource_id, scale_factor); return; } } @@ -69,7 +110,7 @@ void ThemeSource::StartDataRequest(const std::string& path, } std::string ThemeSource::GetMimeType(const std::string& path) const { - std::string uncached_path = StripQueryParams(path); + std::string uncached_path = ParsePathAndScale(path, NULL); if (uncached_path == kNewTabCSSPath || uncached_path == kNewIncognitoTabCSSPath) { @@ -81,7 +122,7 @@ std::string ThemeSource::GetMimeType(const std::string& path) const { MessageLoop* ThemeSource::MessageLoopForRequestPath( const std::string& path) const { - std::string uncached_path = StripQueryParams(path); + std::string uncached_path = ParsePathAndScale(path, NULL); if (uncached_path == kNewTabCSSPath || uncached_path == kNewIncognitoTabCSSPath) { @@ -107,18 +148,22 @@ bool ThemeSource::ShouldReplaceExistingSource() const { //////////////////////////////////////////////////////////////////////////////// // ThemeSource, private: -void ThemeSource::SendThemeBitmap(int request_id, int resource_id) { +void ThemeSource::SendThemeBitmap(int request_id, + int resource_id, + ui::ScaleFactor scale_factor) { if (ThemeService::IsThemeableImage(resource_id)) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); ui::ThemeProvider* tp = ThemeServiceFactory::GetForProfile(profile_); DCHECK(tp); + // TODO(flackr): Pass scale factor when fetching themeable images. scoped_refptr<base::RefCountedMemory> image_data(tp->GetRawData( resource_id)); SendResponse(request_id, image_data); } else { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); const ResourceBundle& rb = ResourceBundle::GetSharedInstance(); - SendResponse(request_id, rb.LoadDataResourceBytes(resource_id)); + SendResponse(request_id, + rb.LoadDataResourceBytes(resource_id, scale_factor)); } } diff --git a/chrome/browser/ui/webui/theme_source.h b/chrome/browser/ui/webui/theme_source.h index 9e6c30e..5b58d1c 100644 --- a/chrome/browser/ui/webui/theme_source.h +++ b/chrome/browser/ui/webui/theme_source.h @@ -9,6 +9,7 @@ #include <string> #include "chrome/browser/ui/webui/chrome_url_data_manager.h" +#include "ui/base/layout.h" class Profile; @@ -38,7 +39,9 @@ class ThemeSource : public ChromeURLDataManager::DataSource { private: // Fetch and send the theme bitmap. - void SendThemeBitmap(int request_id, int resource_id); + void SendThemeBitmap(int request_id, + int resource_id, + ui::ScaleFactor scale_factor); // The original profile (never an OTR profile). Profile* profile_; diff --git a/chrome/browser/ui/webui/web_ui_browsertest.cc b/chrome/browser/ui/webui/web_ui_browsertest.cc index 2a7e0bf..ac95ea2 100644 --- a/chrome/browser/ui/webui/web_ui_browsertest.cc +++ b/chrome/browser/ui/webui/web_ui_browsertest.cc @@ -322,7 +322,7 @@ void WebUIBrowserTest::SetUpInProcessBrowserTestFixture() { FilePath resources_pack_path; PathService::Get(chrome::FILE_RESOURCES_PACK, &resources_pack_path); ResourceBundle::GetSharedInstance().AddDataPack( - resources_pack_path, ui::ResourceHandle::kScaleFactor100x); + resources_pack_path, ui::SCALE_FACTOR_100P); FilePath mockPath; ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &mockPath)); diff --git a/chrome/browser/ui/webui/web_ui_util.cc b/chrome/browser/ui/webui/web_ui_util.cc index 4ef88e0..46d2824 100644 --- a/chrome/browser/ui/webui/web_ui_util.cc +++ b/chrome/browser/ui/webui/web_ui_util.cc @@ -11,6 +11,7 @@ #include "base/memory/ref_counted_memory.h" #include "base/values.h" #include "chrome/browser/disposition_utils.h" +#include "ui/base/layout.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/codec/png_codec.h" @@ -30,7 +31,8 @@ std::string GetImageDataUrl(const SkBitmap& bitmap) { std::string GetImageDataUrlFromResource(int res) { // Load resource icon and covert to base64 encoded data url base::RefCountedStaticMemory* icon_data = - ResourceBundle::GetSharedInstance().LoadDataResourceBytes(res); + ResourceBundle::GetSharedInstance().LoadDataResourceBytes(res, + ui::SCALE_FACTOR_100P); if (!icon_data) return std::string(); scoped_refptr<base::RefCountedMemory> raw_icon(icon_data); diff --git a/chrome/common/chrome_content_client.cc b/chrome/common/chrome_content_client.cc index 369bc0a..040c8b0 100644 --- a/chrome/common/chrome_content_client.cc +++ b/chrome/common/chrome_content_client.cc @@ -9,9 +9,9 @@ #include "base/path_service.h" #include "base/process_util.h" #include "base/string_number_conversions.h" -#include "base/stringprintf.h" #include "base/string_split.h" #include "base/string_util.h" +#include "base/stringprintf.h" #include "base/utf_string_conversions.h" #include "chrome/common/child_process_logging.h" #include "chrome/common/chrome_paths.h" @@ -25,6 +25,7 @@ #include "grit/common_resources.h" #include "remoting/client/plugin/pepper_entrypoints.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/layout.h" #include "ui/base/resource/resource_bundle.h" #include "webkit/glue/user_agent.h" #include "webkit/plugins/npapi/plugin_list.h" @@ -415,16 +416,11 @@ string16 ChromeContentClient::GetLocalizedString(int message_id) const { return l10n_util::GetStringUTF16(message_id); } -base::StringPiece ChromeContentClient::GetDataResource(int resource_id) const { - return ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id); -} - -base::StringPiece ChromeContentClient::GetImageResource( +base::StringPiece ChromeContentClient::GetDataResource( 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); + ui::ScaleFactor scale_factor) const { + return ResourceBundle::GetSharedInstance().GetRawDataResource( + resource_id, scale_factor); } #if defined(OS_WIN) diff --git a/chrome/common/chrome_content_client.h b/chrome/common/chrome_content_client.h index a69cd87..e6074d5 100644 --- a/chrome/common/chrome_content_client.h +++ b/chrome/common/chrome_content_client.h @@ -33,9 +33,9 @@ class ChromeContentClient : 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) const OVERRIDE; - virtual base::StringPiece GetImageResource(int resource_id, - float scale_factor) const OVERRIDE; + virtual base::StringPiece GetDataResource( + int resource_id, + ui::ScaleFactor scale_factor) const OVERRIDE; #if defined(OS_WIN) virtual bool SandboxPlugin(CommandLine* command_line, diff --git a/chrome/common/extensions/api/extension_api.cc b/chrome/common/extensions/api/extension_api.cc index b713a27..16458f8 100644 --- a/chrome/common/extensions/api/extension_api.cc +++ b/chrome/common/extensions/api/extension_api.cc @@ -23,6 +23,7 @@ #include "googleurl/src/gurl.h" #include "grit/common_resources.h" #include "grit/extensions_api_resources.h" +#include "ui/base/layout.h" #include "ui/base/resource/resource_bundle.h" using base::DictionaryValue; @@ -61,7 +62,8 @@ bool HasUnprivilegedChild(const DictionaryValue* name_space_node, } base::StringPiece ReadFromResource(int resource_id) { - return ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id); + return ResourceBundle::GetSharedInstance().GetRawDataResource( + resource_id, ui::SCALE_FACTOR_NONE); } scoped_ptr<ListValue> LoadSchemaList(const std::string& name, diff --git a/chrome/common/extensions/simple_feature_provider.cc b/chrome/common/extensions/simple_feature_provider.cc index 08bed31..d17c360 100644 --- a/chrome/common/extensions/simple_feature_provider.cc +++ b/chrome/common/extensions/simple_feature_provider.cc @@ -9,6 +9,7 @@ #include "chrome/common/extensions/manifest_feature.h" #include "chrome/common/extensions/permission_feature.h" #include "grit/common_resources.h" +#include "ui/base/layout.h" #include "ui/base/resource/resource_bundle.h" namespace extensions { @@ -42,7 +43,7 @@ struct Static { int resource_id) { std::string manifest_features = ResourceBundle::GetSharedInstance().GetRawDataResource( - resource_id).as_string(); + resource_id, ui::SCALE_FACTOR_NONE).as_string(); int error_code = 0; std::string error_message; Value* value = base::JSONReader::ReadAndReturnError( diff --git a/chrome/common/jstemplate_builder.cc b/chrome/common/jstemplate_builder.cc index 9d0d46b..31c0c4d 100644 --- a/chrome/common/jstemplate_builder.cc +++ b/chrome/common/jstemplate_builder.cc @@ -12,6 +12,7 @@ #include "base/logging.h" #include "base/string_util.h" #include "grit/common_resources.h" +#include "ui/base/layout.h" #include "ui/base/resource/resource_bundle.h" namespace { @@ -91,7 +92,7 @@ void AppendJsTemplateSourceHtml(std::string* output) { // fetch and cache the pointer of the jstemplate resource source text. static const base::StringPiece jstemplate_src( ResourceBundle::GetSharedInstance().GetRawDataResource( - IDR_JSTEMPLATE_JS)); + IDR_JSTEMPLATE_JS, ui::SCALE_FACTOR_NONE)); if (jstemplate_src.empty()) { NOTREACHED() << "Unable to get jstemplate src"; @@ -117,10 +118,10 @@ void AppendI18nTemplateSourceHtml(std::string* output) { // fetch and cache the pointer of the jstemplate resource source text. static const base::StringPiece i18n_template_src( ResourceBundle::GetSharedInstance().GetRawDataResource( - IDR_I18N_TEMPLATE_JS)); + IDR_I18N_TEMPLATE_JS, ui::SCALE_FACTOR_NONE)); static const base::StringPiece i18n_template2_src( ResourceBundle::GetSharedInstance().GetRawDataResource( - IDR_I18N_TEMPLATE2_JS)); + IDR_I18N_TEMPLATE2_JS, ui::SCALE_FACTOR_NONE)); const base::StringPiece* template_src = g_version2 ? &i18n_template2_src : &i18n_template_src; @@ -140,7 +141,7 @@ void AppendI18nTemplateProcessHtml(std::string* output) { static const base::StringPiece i18n_process_src( ResourceBundle::GetSharedInstance().GetRawDataResource( - IDR_I18N_PROCESS_JS)); + IDR_I18N_PROCESS_JS, ui::SCALE_FACTOR_NONE)); if (i18n_process_src.empty()) { NOTREACHED() << "Unable to get i18n process src"; diff --git a/chrome/common/net/net_resource_provider.cc b/chrome/common/net/net_resource_provider.cc index abea5f4..db1a8ba 100644 --- a/chrome/common/net/net_resource_provider.cc +++ b/chrome/common/net/net_resource_provider.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. @@ -13,6 +13,7 @@ #include "grit/generated_resources.h" #include "grit/net_resources.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/layout.h" #include "ui/base/resource/resource_bundle.h" namespace { @@ -40,7 +41,7 @@ struct LazyDirectoryListerCacher { l10n_util::GetStringUTF16(IDS_PRODUCT_NAME))); html_data = jstemplate_builder::GetI18nTemplateHtml( ResourceBundle::GetSharedInstance().GetRawDataResource( - IDR_DIR_HEADER_HTML), + IDR_DIR_HEADER_HTML, ui::SCALE_FACTOR_NONE), &value); } @@ -57,7 +58,8 @@ base::StringPiece NetResourceProvider(int key) { if (IDR_DIR_HEADER_HTML == key) return base::StringPiece(lazy_dir_lister.html_data); - return ResourceBundle::GetSharedInstance().GetRawDataResource(key); + return ResourceBundle::GetSharedInstance().GetRawDataResource( + key, ui::SCALE_FACTOR_NONE); } } // namespace chrome_common_net diff --git a/chrome/common/web_apps.cc b/chrome/common/web_apps.cc index bfcf199..1564754 100644 --- a/chrome/common/web_apps.cc +++ b/chrome/common/web_apps.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. @@ -25,6 +25,7 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/layout.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/size.h" #include "webkit/glue/dom_operations.h" @@ -216,7 +217,8 @@ bool ParseWebAppFromDefinitionFile(Value* definition_value, scoped_ptr<Value> schema( base::JSONReader::ReadAndReturnError( ResourceBundle::GetSharedInstance().GetRawDataResource( - IDR_WEB_APP_SCHEMA).as_string(), + IDR_WEB_APP_SCHEMA, + ui::SCALE_FACTOR_NONE).as_string(), base::JSON_PARSE_RFC, // options &error_code, &error_message)); 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) { diff --git a/chrome/test/base/chrome_test_suite.cc b/chrome/test/base/chrome_test_suite.cc index 842e58c..3795306 100644 --- a/chrome/test/base/chrome_test_suite.cc +++ b/chrome/test/base/chrome_test_suite.cc @@ -201,7 +201,7 @@ void ChromeTestSuite::Initialize() { resources_pack_path = resources_pack_path.Append(FILE_PATH_LITERAL("resources.pak")); ResourceBundle::GetSharedInstance().AddDataPack( - resources_pack_path, ui::ResourceHandle::kScaleFactor100x); + resources_pack_path, ui::SCALE_FACTOR_100P); // Mock out the compositor on platforms that use it. ui::SetupTestCompositor(); diff --git a/chrome/test/base/module_system_test.cc b/chrome/test/base/module_system_test.cc index ce77a20..d6bb6d3 100644 --- a/chrome/test/base/module_system_test.cc +++ b/chrome/test/base/module_system_test.cc @@ -8,6 +8,7 @@ #include "base/memory/scoped_ptr.h" #include "base/string_piece.h" #include "chrome/renderer/native_handler.h" +#include "ui/base/layout.h" #include "ui/base/resource/resource_bundle.h" #include <map> @@ -98,7 +99,8 @@ void ModuleSystemTest::RegisterModule(const std::string& name, void ModuleSystemTest::RegisterModule(const std::string& name, int resource_id) { const std::string& code = ResourceBundle::GetSharedInstance(). - GetRawDataResource(resource_id).as_string(); + GetRawDataResource(resource_id, + ui::SCALE_FACTOR_NONE).as_string(); source_map_->RegisterModule(name, code); } diff --git a/chrome/tools/mac_helpers/infoplist_strings_util.mm b/chrome/tools/mac_helpers/infoplist_strings_util.mm index 270e07f..051013b 100644 --- a/chrome/tools/mac_helpers/infoplist_strings_util.mm +++ b/chrome/tools/mac_helpers/infoplist_strings_util.mm @@ -60,7 +60,7 @@ ui::DataPack* LoadResourceDataPack(const char* dir_path, dir_path, branding_strings_name, locale_name]; if (resource_path) { FilePath resources_pak_path([resource_path fileSystemRepresentation]); - resource_pack = new ui::DataPack(ui::ResourceHandle::kScaleFactor100x); + resource_pack = new ui::DataPack(ui::SCALE_FACTOR_100P); bool success = resource_pack->Load(resources_pak_path); if (!success) { delete resource_pack; |