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

Side by Side Diff: chrome/browser/extensions/webstore_installer.cc

Issue 898613004: Sanitize referrers before we create them (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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/extensions/webstore_installer.h" 5 #include "chrome/browser/extensions/webstore_installer.h"
6 6
7 #include <set> 7 #include <set>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after
642 contents->GetRenderViewHost()->GetRoutingID(); 642 contents->GetRenderViewHost()->GetRoutingID();
643 content::ResourceContext* resource_context = 643 content::ResourceContext* resource_context =
644 controller.GetBrowserContext()->GetResourceContext(); 644 controller.GetBrowserContext()->GetResourceContext();
645 scoped_ptr<DownloadUrlParameters> params(new DownloadUrlParameters( 645 scoped_ptr<DownloadUrlParameters> params(new DownloadUrlParameters(
646 download_url_, 646 download_url_,
647 render_process_host_id, 647 render_process_host_id,
648 render_view_host_routing_id , 648 render_view_host_routing_id ,
649 resource_context)); 649 resource_context));
650 params->set_file_path(file); 650 params->set_file_path(file);
651 if (controller.GetVisibleEntry()) 651 if (controller.GetVisibleEntry())
652 params->set_referrer( 652 params->set_referrer(content::Referrer::SanitizeForRequest(
653 content::Referrer(controller.GetVisibleEntry()->GetURL(), 653 download_url_, content::Referrer(controller.GetVisibleEntry()->GetURL(),
654 blink::WebReferrerPolicyDefault)); 654 blink::WebReferrerPolicyDefault)));
655 params->set_callback(base::Bind(&WebstoreInstaller::OnDownloadStarted, 655 params->set_callback(base::Bind(&WebstoreInstaller::OnDownloadStarted,
656 this, 656 this,
657 extension_id)); 657 extension_id));
658 download_manager->DownloadUrl(params.Pass()); 658 download_manager->DownloadUrl(params.Pass());
659 } 659 }
660 660
661 void WebstoreInstaller::UpdateDownloadProgress() { 661 void WebstoreInstaller::UpdateDownloadProgress() {
662 // If the download has gone away, or isn't in progress (in which case we can't 662 // If the download has gone away, or isn't in progress (in which case we can't
663 // give a good progress estimate), stop any running timers and return. 663 // give a good progress estimate), stop any running timers and return.
664 if (!download_item_ || 664 if (!download_item_ ||
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
761 1, 761 1,
762 kMaxSizeKb, 762 kMaxSizeKb,
763 kNumBuckets); 763 kNumBuckets);
764 } 764 }
765 UMA_HISTOGRAM_BOOLEAN( 765 UMA_HISTOGRAM_BOOLEAN(
766 "Extensions.WebstoreDownload.InterruptTotalSizeUnknown", 766 "Extensions.WebstoreDownload.InterruptTotalSizeUnknown",
767 total_bytes <= 0); 767 total_bytes <= 0);
768 } 768 }
769 769
770 } // namespace extensions 770 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698