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

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 4 years, 11 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 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 source->AddLocalizedString( 360 source->AddLocalizedString(
361 "acceptForGroup", IDS_PRINT_PREVIEW_ACCEPT_GROUP_INVITE); 361 "acceptForGroup", IDS_PRINT_PREVIEW_ACCEPT_GROUP_INVITE);
362 source->AddLocalizedString("reject", IDS_PRINT_PREVIEW_REJECT_INVITE); 362 source->AddLocalizedString("reject", IDS_PRINT_PREVIEW_REJECT_INVITE);
363 source->AddLocalizedString( 363 source->AddLocalizedString(
364 "groupPrinterSharingInviteText", IDS_PRINT_PREVIEW_GROUP_INVITE_TEXT); 364 "groupPrinterSharingInviteText", IDS_PRINT_PREVIEW_GROUP_INVITE_TEXT);
365 source->AddLocalizedString( 365 source->AddLocalizedString(
366 "printerSharingInviteText", IDS_PRINT_PREVIEW_INVITE_TEXT); 366 "printerSharingInviteText", IDS_PRINT_PREVIEW_INVITE_TEXT);
367 367
368 source->SetJsonPath("strings.js"); 368 source->SetJsonPath("strings.js");
369 source->AddResourcePath("print_preview.js", IDR_PRINT_PREVIEW_JS); 369 source->AddResourcePath("print_preview.js", IDR_PRINT_PREVIEW_JS);
370 source->AddResourcePath("pdf_preview.html",
371 IDR_PRINT_PREVIEW_PDF_PREVIEW_HTML);
370 source->AddResourcePath("images/printer.png", 372 source->AddResourcePath("images/printer.png",
371 IDR_PRINT_PREVIEW_IMAGES_PRINTER); 373 IDR_PRINT_PREVIEW_IMAGES_PRINTER);
372 source->AddResourcePath("images/printer_shared.png", 374 source->AddResourcePath("images/printer_shared.png",
373 IDR_PRINT_PREVIEW_IMAGES_PRINTER_SHARED); 375 IDR_PRINT_PREVIEW_IMAGES_PRINTER_SHARED);
374 source->AddResourcePath("images/third_party.png", 376 source->AddResourcePath("images/third_party.png",
375 IDR_PRINT_PREVIEW_IMAGES_THIRD_PARTY); 377 IDR_PRINT_PREVIEW_IMAGES_THIRD_PARTY);
376 source->AddResourcePath("images/third_party_fedex.png", 378 source->AddResourcePath("images/third_party_fedex.png",
377 IDR_PRINT_PREVIEW_IMAGES_THIRD_PARTY_FEDEX); 379 IDR_PRINT_PREVIEW_IMAGES_THIRD_PARTY_FEDEX);
378 source->AddResourcePath("images/google_doc.png", 380 source->AddResourcePath("images/google_doc.png",
379 IDR_PRINT_PREVIEW_IMAGES_GOOGLE_DOC); 381 IDR_PRINT_PREVIEW_IMAGES_GOOGLE_DOC);
380 source->AddResourcePath("images/pdf.png", IDR_PRINT_PREVIEW_IMAGES_PDF); 382 source->AddResourcePath("images/pdf.png", IDR_PRINT_PREVIEW_IMAGES_PDF);
381 source->AddResourcePath("images/mobile.png", IDR_PRINT_PREVIEW_IMAGES_MOBILE); 383 source->AddResourcePath("images/mobile.png", IDR_PRINT_PREVIEW_IMAGES_MOBILE);
382 source->AddResourcePath("images/mobile_shared.png", 384 source->AddResourcePath("images/mobile_shared.png",
383 IDR_PRINT_PREVIEW_IMAGES_MOBILE_SHARED); 385 IDR_PRINT_PREVIEW_IMAGES_MOBILE_SHARED);
384 source->SetDefaultResource(IDR_PRINT_PREVIEW_HTML); 386 source->SetDefaultResource(IDR_PRINT_PREVIEW_HTML);
385 source->SetRequestFilter(base::Bind(&HandleRequestCallback)); 387 source->SetRequestFilter(base::Bind(&HandleRequestCallback));
388 source->OverrideContentSecurityPolicyFrameSrc("frame-src 'self';");
389 source->DisableDenyXFrameOptions();
386 source->OverrideContentSecurityPolicyObjectSrc("object-src 'self';"); 390 source->OverrideContentSecurityPolicyObjectSrc("object-src 'self';");
387 source->AddLocalizedString("moreOptionsLabel", IDS_MORE_OPTIONS_LABEL); 391 source->AddLocalizedString("moreOptionsLabel", IDS_MORE_OPTIONS_LABEL);
388 source->AddLocalizedString("lessOptionsLabel", IDS_LESS_OPTIONS_LABEL); 392 source->AddLocalizedString("lessOptionsLabel", IDS_LESS_OPTIONS_LABEL);
389 return source; 393 return source;
390 } 394 }
391 395
392 PrintPreviewUI::TestingDelegate* g_testing_delegate = NULL; 396 PrintPreviewUI::TestingDelegate* g_testing_delegate = NULL;
393 397
394 } // namespace 398 } // namespace
395 399
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
663 } 667 }
664 668
665 void PrintPreviewUI::SetPdfSavedClosureForTesting( 669 void PrintPreviewUI::SetPdfSavedClosureForTesting(
666 const base::Closure& closure) { 670 const base::Closure& closure) {
667 handler_->SetPdfSavedClosureForTesting(closure); 671 handler_->SetPdfSavedClosureForTesting(closure);
668 } 672 }
669 673
670 base::WeakPtr<PrintPreviewUI> PrintPreviewUI::GetWeakPtr() { 674 base::WeakPtr<PrintPreviewUI> PrintPreviewUI::GetWeakPtr() {
671 return weak_ptr_factory_.GetWeakPtr(); 675 return weak_ptr_factory_.GetWeakPtr();
672 } 676 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698