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

Side by Side Diff: chrome/browser/extensions/api/cryptotoken_private/cryptotoken_private_api.cc

Issue 2476493003: Remove FundamentalValue
Patch Set: Fix Created 4 years, 1 month 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/api/cryptotoken_private/cryptotoken_private_ api.h" 5 #include "chrome/browser/extensions/api/cryptotoken_private/cryptotoken_private_ api.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "extensions/common/error_utils.h" 10 #include "extensions/common/error_utils.h"
(...skipping 25 matching lines...) Expand all
36 "Security origin * is not a valid URL", params->security_origin))); 36 "Security origin * is not a valid URL", params->security_origin)));
37 } 37 }
38 const GURL app_id_url(params->app_id_url); 38 const GURL app_id_url(params->app_id_url);
39 if (!app_id_url.is_valid()) { 39 if (!app_id_url.is_valid()) {
40 return RespondNow(Error(extensions::ErrorUtils::FormatErrorMessage( 40 return RespondNow(Error(extensions::ErrorUtils::FormatErrorMessage(
41 "appId * is not a valid URL", params->app_id_url))); 41 "appId * is not a valid URL", params->app_id_url)));
42 } 42 }
43 43
44 if (origin_url == app_id_url) { 44 if (origin_url == app_id_url) {
45 return RespondNow( 45 return RespondNow(
46 OneArgument(base::MakeUnique<base::FundamentalValue>(true))); 46 OneArgument(base::MakeUnique<base::Value>(true)));
47 } 47 }
48 48
49 // Fetch the eTLD+1 of both. 49 // Fetch the eTLD+1 of both.
50 const std::string origin_etldp1 = 50 const std::string origin_etldp1 =
51 net::registry_controlled_domains::GetDomainAndRegistry( 51 net::registry_controlled_domains::GetDomainAndRegistry(
52 origin_url, 52 origin_url,
53 net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES); 53 net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES);
54 if (origin_etldp1.empty()) { 54 if (origin_etldp1.empty()) {
55 return RespondNow(Error(extensions::ErrorUtils::FormatErrorMessage( 55 return RespondNow(Error(extensions::ErrorUtils::FormatErrorMessage(
56 "Could not find an eTLD for origin *", params->security_origin))); 56 "Could not find an eTLD for origin *", params->security_origin)));
57 } 57 }
58 const std::string app_id_etldp1 = 58 const std::string app_id_etldp1 =
59 net::registry_controlled_domains::GetDomainAndRegistry( 59 net::registry_controlled_domains::GetDomainAndRegistry(
60 app_id_url, 60 app_id_url,
61 net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES); 61 net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES);
62 if (app_id_etldp1.empty()) { 62 if (app_id_etldp1.empty()) {
63 return RespondNow(Error(extensions::ErrorUtils::FormatErrorMessage( 63 return RespondNow(Error(extensions::ErrorUtils::FormatErrorMessage(
64 "Could not find an eTLD for appId *", params->app_id_url))); 64 "Could not find an eTLD for appId *", params->app_id_url)));
65 } 65 }
66 if (origin_etldp1 == app_id_etldp1) { 66 if (origin_etldp1 == app_id_etldp1) {
67 return RespondNow( 67 return RespondNow(
68 OneArgument(base::MakeUnique<base::FundamentalValue>(true))); 68 OneArgument(base::MakeUnique<base::Value>(true)));
69 } 69 }
70 // For legacy purposes, allow google.com origins to assert certain 70 // For legacy purposes, allow google.com origins to assert certain
71 // gstatic.com appIds. 71 // gstatic.com appIds.
72 // TODO(juanlang): remove when legacy constraints are removed. 72 // TODO(juanlang): remove when legacy constraints are removed.
73 if (origin_etldp1 == kGoogleDotCom) { 73 if (origin_etldp1 == kGoogleDotCom) {
74 for (size_t i = 0; 74 for (size_t i = 0;
75 i < sizeof(kGoogleGstaticAppIds) / sizeof(kGoogleGstaticAppIds[0]); 75 i < sizeof(kGoogleGstaticAppIds) / sizeof(kGoogleGstaticAppIds[0]);
76 i++) { 76 i++) {
77 if (params->app_id_url == kGoogleGstaticAppIds[i]) { 77 if (params->app_id_url == kGoogleGstaticAppIds[i]) {
78 return RespondNow( 78 return RespondNow(
79 OneArgument(base::MakeUnique<base::FundamentalValue>(true))); 79 OneArgument(base::MakeUnique<base::Value>(true)));
80 } 80 }
81 } 81 }
82 } 82 }
83 return RespondNow( 83 return RespondNow(
84 OneArgument(base::MakeUnique<base::FundamentalValue>(false))); 84 OneArgument(base::MakeUnique<base::Value>(false)));
85 } 85 }
86 86
87 } // namespace api 87 } // namespace api
88 } // namespace extensions 88 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698