#include "chrome/common/url_constants.h"
#include "grit/browser_resources.h"
#include "grit/generated_resources.h"
+#include "grit/theme_resources.h"
#include "grit/ui_resources.h"
#include "net/url_request/url_request.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/webui/jstemplate_builder.h"
+#include "ui/base/webui/web_ui_util.h"
#include "url/gurl.h"
namespace {
{ "images/close_2_hover.png", IDR_CLOSE_2_H, "image/png" },
{ "images/close_2_active.png", IDR_CLOSE_2_P, "image/png" },
{ "images/close_2_white.png", IDR_CLOSE_2_MASK, "image/png" },
- { "images/2x/google_logo.png",
- IDR_LOCAL_NTP_IMAGES_2X_LOGO_PNG, "image/png" },
- { "images/2x/white_google_logo.png",
- IDR_LOCAL_NTP_IMAGES_2X_WHITE_LOGO_PNG, "image/png" },
+ { "images/google_logo.png", IDR_LOCAL_NTP_IMAGES_LOGO_PNG, "image/png" },
+ { "images/white_google_logo.png",
+ IDR_LOCAL_NTP_IMAGES_WHITE_LOGO_PNG, "image/png" },
};
// Strips any query parameters from the specified path.
return config_data_js;
}
+std::string GetLocalNtpPath() {
+ return std::string(chrome::kChromeSearchScheme) + "://" +
+ std::string(chrome::kChromeSearchLocalNtpHost) + "/";
+}
+
} // namespace
LocalNtpSource::LocalNtpSource(Profile* profile) : profile_(profile) {
callback.Run(base::RefCountedString::TakeString(&config_data_js));
return;
}
+ ui::ScaleFactor scale_factor;
+ std::string filename;
+ webui::ParsePathAndScale(
+ GURL(GetLocalNtpPath() + stripped_path), &filename, &scale_factor);
for (size_t i = 0; i < arraysize(kResources); ++i) {
- if (stripped_path == kResources[i].filename) {
+ if (filename == kResources[i].filename) {
scoped_refptr<base::RefCountedStaticMemory> response(
- ResourceBundle::GetSharedInstance().LoadDataResourceBytes(
- kResources[i].identifier));
+ ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale(
+ kResources[i].identifier, scale_factor));
callback.Run(response.get());
return;
}
return false;
if (request->url().SchemeIs(chrome::kChromeSearchScheme)) {
- DCHECK(StartsWithASCII(request->url().path(), "/", true));
- std::string filename = request->url().path().substr(1);
+ std::string filename;
+ webui::ParsePathAndScale(request->url(), &filename, NULL);
for (size_t i = 0; i < arraysize(kResources); ++i) {
if (filename == kResources[i].filename)
return true;