| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/chromeos/extensions/extension_tab_util_delegate_chromeo
s.h" | 5 #include "chrome/browser/chromeos/extensions/extension_tab_util_delegate_chromeo
s.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "chrome/browser/chromeos/extensions/device_local_account_management_pol
icy_provider.h" |
| 10 #include "chrome/browser/profiles/profiles_state.h" | 11 #include "chrome/browser/profiles/profiles_state.h" |
| 11 #include "chrome/common/extensions/api/tabs.h" | 12 #include "chrome/common/extensions/api/tabs.h" |
| 12 #include "url/gurl.h" | 13 #include "url/gurl.h" |
| 13 | 14 |
| 14 namespace extensions { | 15 namespace extensions { |
| 15 | 16 |
| 16 ExtensionTabUtilDelegateChromeOS::ExtensionTabUtilDelegateChromeOS() {} | 17 ExtensionTabUtilDelegateChromeOS::ExtensionTabUtilDelegateChromeOS() {} |
| 17 | 18 |
| 18 ExtensionTabUtilDelegateChromeOS::~ExtensionTabUtilDelegateChromeOS() {} | 19 ExtensionTabUtilDelegateChromeOS::~ExtensionTabUtilDelegateChromeOS() {} |
| 19 | 20 |
| 20 void ExtensionTabUtilDelegateChromeOS::ScrubTabForExtension( | 21 void ExtensionTabUtilDelegateChromeOS::ScrubTabForExtension( |
| 21 const Extension* extension, | 22 const std::string& extension_id, |
| 22 content::WebContents* contents, | |
| 23 api::tabs::Tab* tab) { | 23 api::tabs::Tab* tab) { |
| 24 if (!profiles::IsPublicSession() || !tab->url) { | 24 if (!profiles::IsPublicSession() || !tab->url || |
| 25 chromeos::DeviceLocalAccountManagementPolicyProvider::IsWhitelisted( |
| 26 extension_id)) { |
| 25 return; | 27 return; |
| 26 } | 28 } |
| 27 // Scrub URL down to the origin (security reasons inside Public Sessions). | 29 // Scrub URL down to the origin (security reasons inside Public Sessions). |
| 28 tab->url = base::MakeUnique<std::string>(GURL(*tab->url).GetOrigin().spec()); | 30 tab->url = base::MakeUnique<std::string>(GURL(*tab->url).GetOrigin().spec()); |
| 29 } | 31 } |
| 30 | 32 |
| 31 } // namespace extensions | 33 } // namespace extensions |
| OLD | NEW |