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

Unified Diff: chrome/browser/chromeos/extensions/extension_tab_util_delegate_chromeos.cc

Issue 2830903003: PS - Scrub URL down to origin in Public Sessions (Closed)
Patch Set: Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/extensions/extension_tab_util_delegate_chromeos.cc
diff --git a/chrome/browser/chromeos/extensions/extension_tab_util_delegate_chromeos.cc b/chrome/browser/chromeos/extensions/extension_tab_util_delegate_chromeos.cc
new file mode 100644
index 0000000000000000000000000000000000000000..824c9c044354421b5f9ad23035f18520115ea7f5
--- /dev/null
+++ b/chrome/browser/chromeos/extensions/extension_tab_util_delegate_chromeos.cc
@@ -0,0 +1,31 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/chromeos/extensions/extension_tab_util_delegate_chromeos.h"
+
+#include <string>
+
+#include "chrome/browser/profiles/profiles_state.h"
+#include "chrome/common/extensions/api/tabs.h"
+
+namespace extensions {
+
+ExtensionTabUtilDelegateChromeOS::ExtensionTabUtilDelegateChromeOS() {}
+
+ExtensionTabUtilDelegateChromeOS::~ExtensionTabUtilDelegateChromeOS() {}
+
+void ExtensionTabUtilDelegateChromeOS::ScrubTabForExtension(
+ const Extension* extension,
+ content::WebContents* contents,
+ api::tabs::Tab* tab) {
+ if (!profiles::IsPublicSession() || !tab->url) {
+ return;
+ }
+ // Scrub URL down to the origin (security reasons inside Public Sessions).
+ GURL gurl(*tab->url);
+ std::string scrubbed_url = gurl.GetOrigin().spec();
+ tab->url.reset(new std::string(scrubbed_url));
Devlin 2017/04/20 16:33:18 could even one-line this: tab->url = base::MakeUni
Ivan Šandrk 2017/04/20 16:44:10 Roger. I did it this way because that's how it was
+}
+
+} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698