Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Unified Diff: chrome/browser/ui/webui/print_preview_data_source.cc

Issue 8872051: Print preview: Display a dummy page when a user visits chrome://print directly. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/webui/print_preview_data_source.h ('k') | chrome/browser/ui/webui/print_preview_ui.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/print_preview_data_source.cc
===================================================================
--- chrome/browser/ui/webui/print_preview_data_source.cc (revision 114056)
+++ chrome/browser/ui/webui/print_preview_data_source.cc (working copy)
@@ -36,9 +36,17 @@
}; // namespace
-PrintPreviewDataSource::PrintPreviewDataSource()
+PrintPreviewDataSource::PrintPreviewDataSource(bool is_dummy)
: ChromeWebUIDataSource(chrome::kChromeUIPrintHost) {
+ Init(is_dummy);
+}
+void PrintPreviewDataSource::Init(bool is_dummy) {
+ if (is_dummy) {
+ AddLocalizedString("intentionallyBlankText",
+ IDS_PRINT_PREVIEW_INTENTIONALLY_BLANK);
+ }
+
AddLocalizedString("title", IDS_PRINT_PREVIEW_TITLE);
AddLocalizedString("loading", IDS_PRINT_PREVIEW_LOADING);
#if defined(GOOGLE_CHROME_BUILD)
@@ -131,8 +139,13 @@
AddLocalizedString("right", IDS_PRINT_PREVIEW_RIGHT_MARGIN_LABEL);
set_json_path("strings.js");
- add_resource_path("print_preview.js", IDR_PRINT_PREVIEW_JS);
- set_default_resource(IDR_PRINT_PREVIEW_HTML);
+ if (is_dummy) {
+ add_resource_path("print_preview_dummy.js", IDR_PRINT_PREVIEW_DUMMY_JS);
+ set_default_resource(IDR_PRINT_PREVIEW_DUMMY_HTML);
+ } else {
+ add_resource_path("print_preview.js", IDR_PRINT_PREVIEW_JS);
+ set_default_resource(IDR_PRINT_PREVIEW_HTML);
+ }
}
PrintPreviewDataSource::~PrintPreviewDataSource() {
@@ -153,8 +166,8 @@
base::SplitString(path, '/', &url_substr);
int page_index = 0;
if (url_substr.size() == 3 && base::StringToInt(url_substr[1], &page_index)) {
- PrintPreviewDataService::GetInstance()->GetDataEntry(
- url_substr[0], page_index, &data);
+ PrintPreviewDataService::GetInstance()->GetDataEntry(
+ url_substr[0], page_index, &data);
}
if (data.get()) {
SendResponse(request_id, data);
« no previous file with comments | « chrome/browser/ui/webui/print_preview_data_source.h ('k') | chrome/browser/ui/webui/print_preview_ui.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698