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

Side by Side Diff: chrome/browser/ui/webui/print_preview/print_preview_ui.cc

Issue 1217503012: Avoid cross-origin iframe issues when loading PDF in print preview (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 months 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/webui/print_preview/print_preview_ui.h" 5 #include "chrome/browser/ui/webui/print_preview/print_preview_ui.h"
6 6
7 #include <map> 7 #include <map>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/id_map.h" 10 #include "base/id_map.h"
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 source->AddLocalizedString( 356 source->AddLocalizedString(
357 "acceptForGroup", IDS_PRINT_PREVIEW_ACCEPT_GROUP_INVITE); 357 "acceptForGroup", IDS_PRINT_PREVIEW_ACCEPT_GROUP_INVITE);
358 source->AddLocalizedString("reject", IDS_PRINT_PREVIEW_REJECT_INVITE); 358 source->AddLocalizedString("reject", IDS_PRINT_PREVIEW_REJECT_INVITE);
359 source->AddLocalizedString( 359 source->AddLocalizedString(
360 "groupPrinterSharingInviteText", IDS_PRINT_PREVIEW_GROUP_INVITE_TEXT); 360 "groupPrinterSharingInviteText", IDS_PRINT_PREVIEW_GROUP_INVITE_TEXT);
361 source->AddLocalizedString( 361 source->AddLocalizedString(
362 "printerSharingInviteText", IDS_PRINT_PREVIEW_INVITE_TEXT); 362 "printerSharingInviteText", IDS_PRINT_PREVIEW_INVITE_TEXT);
363 363
364 source->SetJsonPath("strings.js"); 364 source->SetJsonPath("strings.js");
365 source->AddResourcePath("print_preview.js", IDR_PRINT_PREVIEW_JS); 365 source->AddResourcePath("print_preview.js", IDR_PRINT_PREVIEW_JS);
366 source->AddResourcePath("pdf_preview.html",
367 IDR_PRINT_PREVIEW_PDF_PREVIEW_HTML);
366 source->AddResourcePath("images/printer.png", 368 source->AddResourcePath("images/printer.png",
367 IDR_PRINT_PREVIEW_IMAGES_PRINTER); 369 IDR_PRINT_PREVIEW_IMAGES_PRINTER);
368 source->AddResourcePath("images/printer_shared.png", 370 source->AddResourcePath("images/printer_shared.png",
369 IDR_PRINT_PREVIEW_IMAGES_PRINTER_SHARED); 371 IDR_PRINT_PREVIEW_IMAGES_PRINTER_SHARED);
370 source->AddResourcePath("images/third_party.png", 372 source->AddResourcePath("images/third_party.png",
371 IDR_PRINT_PREVIEW_IMAGES_THIRD_PARTY); 373 IDR_PRINT_PREVIEW_IMAGES_THIRD_PARTY);
372 source->AddResourcePath("images/third_party_fedex.png", 374 source->AddResourcePath("images/third_party_fedex.png",
373 IDR_PRINT_PREVIEW_IMAGES_THIRD_PARTY_FEDEX); 375 IDR_PRINT_PREVIEW_IMAGES_THIRD_PARTY_FEDEX);
374 source->AddResourcePath("images/google_doc.png", 376 source->AddResourcePath("images/google_doc.png",
375 IDR_PRINT_PREVIEW_IMAGES_GOOGLE_DOC); 377 IDR_PRINT_PREVIEW_IMAGES_GOOGLE_DOC);
376 source->AddResourcePath("images/pdf.png", IDR_PRINT_PREVIEW_IMAGES_PDF); 378 source->AddResourcePath("images/pdf.png", IDR_PRINT_PREVIEW_IMAGES_PDF);
377 source->AddResourcePath("images/mobile.png", IDR_PRINT_PREVIEW_IMAGES_MOBILE); 379 source->AddResourcePath("images/mobile.png", IDR_PRINT_PREVIEW_IMAGES_MOBILE);
378 source->AddResourcePath("images/mobile_shared.png", 380 source->AddResourcePath("images/mobile_shared.png",
379 IDR_PRINT_PREVIEW_IMAGES_MOBILE_SHARED); 381 IDR_PRINT_PREVIEW_IMAGES_MOBILE_SHARED);
380 source->SetDefaultResource(IDR_PRINT_PREVIEW_HTML); 382 source->SetDefaultResource(IDR_PRINT_PREVIEW_HTML);
381 source->SetRequestFilter(base::Bind(&HandleRequestCallback)); 383 source->SetRequestFilter(base::Bind(&HandleRequestCallback));
384 source->OverrideContentSecurityPolicyFrameSrc("frame-src 'self';");
385 source->DisableDenyXFrameOptions();
382 source->OverrideContentSecurityPolicyObjectSrc("object-src 'self';"); 386 source->OverrideContentSecurityPolicyObjectSrc("object-src 'self';");
383 source->AddLocalizedString("moreOptionsLabel", IDS_MORE_OPTIONS_LABEL); 387 source->AddLocalizedString("moreOptionsLabel", IDS_MORE_OPTIONS_LABEL);
384 source->AddLocalizedString("lessOptionsLabel", IDS_LESS_OPTIONS_LABEL); 388 source->AddLocalizedString("lessOptionsLabel", IDS_LESS_OPTIONS_LABEL);
385 return source; 389 return source;
386 } 390 }
387 391
388 PrintPreviewUI::TestingDelegate* g_testing_delegate = NULL; 392 PrintPreviewUI::TestingDelegate* g_testing_delegate = NULL;
389 393
390 } // namespace 394 } // namespace
391 395
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 } 658 }
655 659
656 void PrintPreviewUI::SetSelectedFileForTesting(const base::FilePath& path) { 660 void PrintPreviewUI::SetSelectedFileForTesting(const base::FilePath& path) {
657 handler_->FileSelected(path, 0, NULL); 661 handler_->FileSelected(path, 0, NULL);
658 } 662 }
659 663
660 void PrintPreviewUI::SetPdfSavedClosureForTesting( 664 void PrintPreviewUI::SetPdfSavedClosureForTesting(
661 const base::Closure& closure) { 665 const base::Closure& closure) {
662 handler_->SetPdfSavedClosureForTesting(closure); 666 handler_->SetPdfSavedClosureForTesting(closure);
663 } 667 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698