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

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

Powered by Google App Engine
This is Rietveld 408576698