| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/site_settings_helper.h" | 5 #include "chrome/browser/ui/webui/site_settings_helper.h" |
| 6 | 6 |
| 7 #include <functional> | 7 #include <functional> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 exception->SetBoolean(kIncognito, incognito); | 225 exception->SetBoolean(kIncognito, incognito); |
| 226 return exception; | 226 return exception; |
| 227 } | 227 } |
| 228 | 228 |
| 229 // Takes |url| and converts it into an individual origin string or retrieves | 229 // Takes |url| and converts it into an individual origin string or retrieves |
| 230 // name of the extension it belongs to. | 230 // name of the extension it belongs to. |
| 231 std::string GetDisplayNameForGURL( | 231 std::string GetDisplayNameForGURL( |
| 232 const GURL& url, | 232 const GURL& url, |
| 233 const extensions::ExtensionRegistry* extension_registry) { | 233 const extensions::ExtensionRegistry* extension_registry) { |
| 234 const url::Origin origin(url); | 234 const url::Origin origin(url); |
| 235 if (origin.unique()) | 235 if (origin.opaque()) |
| 236 return url.spec(); | 236 return url.spec(); |
| 237 | 237 |
| 238 if (extension_registry && origin.scheme() == extensions::kExtensionScheme) { | 238 if (extension_registry && origin.scheme() == extensions::kExtensionScheme) { |
| 239 const extensions::Extension* extension = | 239 const extensions::Extension* extension = |
| 240 extension_registry->GetExtensionById( | 240 extension_registry->GetExtensionById( |
| 241 origin.host(), extensions::ExtensionRegistry::EVERYTHING); | 241 origin.host(), extensions::ExtensionRegistry::EVERYTHING); |
| 242 if (extension) | 242 if (extension) |
| 243 return extension->name(); | 243 return extension->name(); |
| 244 } | 244 } |
| 245 | 245 |
| 246 // Note that using Serialize() here will chop off any default port numbers | 246 // Note that using Serialize() here will chop off any default port numbers |
| 247 // which may be confusing to users. | 247 // which may be confusing to users. |
| 248 return origin.Serialize(); | 248 return origin.Serialize(); |
| 249 } | 249 } |
| 250 | 250 |
| 251 // If the given |pattern| represents an individual origin or extension, retrieve | 251 // If the given |pattern| represents an individual origin or extension, retrieve |
| 252 // a string to display it as such. If not, return the pattern as a string. | 252 // a string to display it as such. If not, return the pattern as a string. |
| 253 std::string GetDisplayNameForPattern( | 253 std::string GetDisplayNameForPattern( |
| 254 const ContentSettingsPattern& pattern, | 254 const ContentSettingsPattern& pattern, |
| 255 const extensions::ExtensionRegistry* extension_registry) { | 255 const extensions::ExtensionRegistry* extension_registry) { |
| 256 const GURL url(pattern.ToString()); | 256 const GURL url(pattern.ToString()); |
| 257 url::Origin origin(url); | 257 url::Origin origin(url); |
| 258 if (!origin.unique()) | 258 if (!origin.opaque()) |
| 259 return GetDisplayNameForGURL(url, extension_registry); | 259 return GetDisplayNameForGURL(url, extension_registry); |
| 260 return pattern.ToString(); | 260 return pattern.ToString(); |
| 261 } | 261 } |
| 262 | 262 |
| 263 void GetExceptionsFromHostContentSettingsMap( | 263 void GetExceptionsFromHostContentSettingsMap( |
| 264 const HostContentSettingsMap* map, | 264 const HostContentSettingsMap* map, |
| 265 ContentSettingsType type, | 265 ContentSettingsType type, |
| 266 const extensions::ExtensionRegistry* extension_registry, | 266 const extensions::ExtensionRegistry* extension_registry, |
| 267 content::WebUI* web_ui, | 267 content::WebUI* web_ui, |
| 268 bool incognito, | 268 bool incognito, |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 } | 580 } |
| 581 } | 581 } |
| 582 | 582 |
| 583 for (auto& one_provider_exceptions : all_provider_exceptions) { | 583 for (auto& one_provider_exceptions : all_provider_exceptions) { |
| 584 for (auto& exception : one_provider_exceptions) | 584 for (auto& exception : one_provider_exceptions) |
| 585 exceptions->Append(std::move(exception)); | 585 exceptions->Append(std::move(exception)); |
| 586 } | 586 } |
| 587 } | 587 } |
| 588 | 588 |
| 589 } // namespace site_settings | 589 } // namespace site_settings |
| OLD | NEW |