diff options
author | tony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-15 04:21:36 +0000 |
---|---|---|
committer | tony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-15 04:21:36 +0000 |
commit | 02e24270eaa44c166ae89be7cb85b09f262f399b (patch) | |
tree | 13f4f6ed3994a2a0a2ad28625f92ff549eca4f70 /chrome/browser | |
parent | b2872394ad921258f724f16c63cceb635ea740d5 (diff) | |
download | chromium_src-02e24270eaa44c166ae89be7cb85b09f262f399b.zip chromium_src-02e24270eaa44c166ae89be7cb85b09f262f399b.tar.gz chromium_src-02e24270eaa44c166ae89be7cb85b09f262f399b.tar.bz2 |
Remove a ResourceBundle::GetDataResource and convert people to
the StringPiece version. In most cases, I didn't bother trying
to make the calling code more efficient since nothing seems to
be in time sensitive code.
Review URL: http://codereview.chromium.org/2827001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49766 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/browser_about_handler.cc | 37 | ||||
-rw-r--r-- | chrome/browser/extensions/extensions_ui.cc | 4 | ||||
-rw-r--r-- | chrome/browser/first_run_win.cc | 6 | ||||
-rw-r--r-- | chrome/browser/privacy_blacklist/blacklist_interceptor.cc | 2 | ||||
-rw-r--r-- | chrome/browser/safe_browsing/safe_browsing_blocking_page.cc | 7 |
5 files changed, 18 insertions, 38 deletions
diff --git a/chrome/browser/browser_about_handler.cc b/chrome/browser/browser_about_handler.cc index a7a0538..0b744ed 100644 --- a/chrome/browser/browser_about_handler.cc +++ b/chrome/browser/browser_about_handler.cc @@ -208,23 +208,7 @@ class ChromeOSAboutVersionHandler { // Individual about handlers --------------------------------------------------- -std::string AboutCredits() { - static const std::string credits_html = - ResourceBundle::GetSharedInstance().GetDataResource( - IDR_CREDITS_HTML); - - return credits_html; -} - #if defined(OS_CHROMEOS) -std::string AboutOSCredits() { - static const std::string os_credits_html = - ResourceBundle::GetSharedInstance().GetDataResource( - IDR_OS_CREDITS_HTML); - - return os_credits_html; -} - std::string AboutNetwork(const std::string& query) { int refresh; StringToInt(query, &refresh); @@ -487,14 +471,6 @@ std::string AboutLinuxProxyConfig() { } #endif -std::string AboutTerms() { - static const std::string terms_html = - ResourceBundle::GetSharedInstance().GetDataResource( - IDR_TERMS_HTML); - - return terms_html; -} - std::string AboutVersion(DictionaryValue* localized_strings) { localized_strings->SetString(L"title", l10n_util::GetString(IDS_ABOUT_VERSION_TITLE)); @@ -552,8 +528,8 @@ std::string AboutVersion(DictionaryValue* localized_strings) { localized_strings->SetString(L"command_line", command_line); #endif - static const std::string version_html( - ResourceBundle::GetSharedInstance().GetDataResource( + base::StringPiece version_html( + ResourceBundle::GetSharedInstance().GetRawDataResource( IDR_ABOUT_VERSION_HTML)); return jstemplate_builder::GetTemplatesHtml( @@ -765,15 +741,18 @@ void AboutSource::StartDataRequest(const std::string& path_raw, response = AboutVersion(&value); #endif } else if (path == kCreditsPath) { - response = AboutCredits(); + response = ResourceBundle::GetSharedInstance().GetRawDataResource( + IDR_CREDITS_HTML).as_string(); #if defined(OS_CHROMEOS) } else if (path == kOSCreditsPath) { - response = AboutOSCredits(); + response = ResourceBundle::GetSharedInstance().GetRawDataResource( + IDR_OS_CREDITS_HTML).as_string(); } else if (path == kNetworkPath) { response = AboutNetwork(info); #endif } else if (path == kTermsPath) { - response = AboutTerms(); + response = ResourceBundle::GetSharedInstance().GetRawDataResource( + IDR_TERMS_HTML).as_string(); #if defined(OS_LINUX) } else if (path == kLinuxProxyConfigPath) { response = AboutLinuxProxyConfig(); diff --git a/chrome/browser/extensions/extensions_ui.cc b/chrome/browser/extensions/extensions_ui.cc index ca5c656..9155705 100644 --- a/chrome/browser/extensions/extensions_ui.cc +++ b/chrome/browser/extensions/extensions_ui.cc @@ -208,8 +208,8 @@ void ExtensionsDOMHandler::IconLoader::LoadIconsOnFileThread( &file_contents)) { // If there's no icon, default to the puzzle icon. This is safe to do from // the file thread. - file_contents = ResourceBundle::GetSharedInstance().GetDataResource( - IDR_EXTENSION_DEFAULT_ICON); + file_contents = ResourceBundle::GetSharedInstance().GetRawDataResource( + IDR_EXTENSION_DEFAULT_ICON).as_string(); } // If the extension is disabled, we desaturate the icon to add to the diff --git a/chrome/browser/first_run_win.cc b/chrome/browser/first_run_win.cc index 4858871..fc1e0cc 100644 --- a/chrome/browser/first_run_win.cc +++ b/chrome/browser/first_run_win.cc @@ -147,15 +147,15 @@ bool LaunchSetupWithParam(const std::string& param, const std::wstring& value, } bool WriteEULAtoTempFile(FilePath* eula_path) { - std::string terms = - ResourceBundle::GetSharedInstance().GetDataResource(IDR_TERMS_HTML); + base::StringPiece terms = + ResourceBundle::GetSharedInstance().GetRawDataResource(IDR_TERMS_HTML); if (terms.empty()) return false; FilePath temp_dir; if (!file_util::GetTempDir(&temp_dir)) return false; *eula_path = temp_dir.Append(L"chrome_eula_iframe.html"); - return (file_util::WriteFile(*eula_path, terms.c_str(), terms.size()) > 0); + return (file_util::WriteFile(*eula_path, terms.data(), terms.size()) > 0); } // Helper class that performs delayed first-run tasks that need more of the diff --git a/chrome/browser/privacy_blacklist/blacklist_interceptor.cc b/chrome/browser/privacy_blacklist/blacklist_interceptor.cc index b187141..f950d17 100644 --- a/chrome/browser/privacy_blacklist/blacklist_interceptor.cc +++ b/chrome/browser/privacy_blacklist/blacklist_interceptor.cc @@ -56,7 +56,7 @@ class URLRequestBlacklistJob : public URLRequestSimpleJob { static std::string GetImage() { return ResourceBundle::GetSharedInstance(). - GetDataResource(IDR_BLACKLIST_IMAGE); + GetRawDataResource(IDR_BLACKLIST_IMAGE).as_string(); } std::string GetHTML() const { diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc index c3481fc..0e0cf4b 100644 --- a/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc +++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc @@ -122,16 +122,17 @@ std::string SafeBrowsingBlockingPage::GetHTMLContents() { if (unsafe_resources_.size() > 1) { PopulateMultipleThreatStringDictionary(&strings); - html = rb.GetDataResource(IDR_SAFE_BROWSING_MULTIPLE_THREAT_BLOCK); + html = rb.GetRawDataResource( + IDR_SAFE_BROWSING_MULTIPLE_THREAT_BLOCK).as_string(); } else if (unsafe_resources_[0].threat_type == SafeBrowsingService::URL_MALWARE) { PopulateMalwareStringDictionary(&strings); - html = rb.GetDataResource(IDR_SAFE_BROWSING_MALWARE_BLOCK); + html = rb.GetRawDataResource(IDR_SAFE_BROWSING_MALWARE_BLOCK).as_string(); } else { // Phishing. DCHECK(unsafe_resources_[0].threat_type == SafeBrowsingService::URL_PHISHING); PopulatePhishingStringDictionary(&strings); - html = rb.GetDataResource(IDR_SAFE_BROWSING_PHISHING_BLOCK); + html = rb.GetRawDataResource(IDR_SAFE_BROWSING_PHISHING_BLOCK).as_string(); } return jstemplate_builder::GetTemplatesHtml(html, &strings, "template_root"); |