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

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

Issue 2056203002: Remove credentials from URL in printed page footer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_handler.h" 5 #include "chrome/browser/ui/webui/print_preview/print_preview_handler.h"
6 6
7 #include <ctype.h> 7 #include <ctype.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 if (!settings->GetBoolean(printing::kSettingHeaderFooterEnabled, 807 if (!settings->GetBoolean(printing::kSettingHeaderFooterEnabled,
808 &display_header_footer)) { 808 &display_header_footer)) {
809 NOTREACHED(); 809 NOTREACHED();
810 } 810 }
811 if (display_header_footer) { 811 if (display_header_footer) {
812 settings->SetString(printing::kSettingHeaderFooterTitle, 812 settings->SetString(printing::kSettingHeaderFooterTitle,
813 initiator->GetTitle()); 813 initiator->GetTitle());
814 std::string url; 814 std::string url;
815 content::NavigationEntry* entry = 815 content::NavigationEntry* entry =
816 initiator->GetController().GetLastCommittedEntry(); 816 initiator->GetController().GetLastCommittedEntry();
817 if (entry) 817 if (entry) {
818 url = entry->GetVirtualURL().spec(); 818 url::Replacements<char> url_sanitizer;
819 url_sanitizer.ClearUsername();
820 url_sanitizer.ClearPassword();
821
822 url = entry->GetVirtualURL().ReplaceComponents(url_sanitizer).spec();
823 }
819 settings->SetString(printing::kSettingHeaderFooterURL, url); 824 settings->SetString(printing::kSettingHeaderFooterURL, url);
820 } 825 }
821 826
822 bool generate_draft_data = false; 827 bool generate_draft_data = false;
823 bool success = settings->GetBoolean(printing::kSettingGenerateDraftData, 828 bool success = settings->GetBoolean(printing::kSettingGenerateDraftData,
824 &generate_draft_data); 829 &generate_draft_data);
825 DCHECK(success); 830 DCHECK(success);
826 831
827 if (!generate_draft_data) { 832 if (!generate_draft_data) {
828 double draft_page_count_double = -1; 833 double draft_page_count_double = -1;
(...skipping 965 matching lines...) Expand 10 before | Expand all | Expand 10 after
1794 1799
1795 void PrintPreviewHandler::UnregisterForGaiaCookieChanges() { 1800 void PrintPreviewHandler::UnregisterForGaiaCookieChanges() {
1796 if (gaia_cookie_manager_service_) 1801 if (gaia_cookie_manager_service_)
1797 gaia_cookie_manager_service_->RemoveObserver(this); 1802 gaia_cookie_manager_service_->RemoveObserver(this);
1798 } 1803 }
1799 1804
1800 void PrintPreviewHandler::SetPdfSavedClosureForTesting( 1805 void PrintPreviewHandler::SetPdfSavedClosureForTesting(
1801 const base::Closure& closure) { 1806 const base::Closure& closure) {
1802 pdf_file_saved_closure_ = closure; 1807 pdf_file_saved_closure_ = closure;
1803 } 1808 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698