OLD | NEW |
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 "extensions/common/error_utils.h" | 9 #include "extensions/common/error_utils.h" |
10 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | 10 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
11 | 11 |
12 namespace extensions { | 12 namespace extensions { |
13 namespace api { | 13 namespace api { |
14 | 14 |
15 const char kGoogleDotCom[] = "google.com"; | 15 const char kGoogleDotCom[] = "google.com"; |
16 const char* kGoogleGstaticAppIds[] = { | 16 const char* kGoogleGstaticAppIds[] = { |
17 "https://www.gstatic.com/securitykey/origins.json", | 17 "https://www.gstatic.com/securitykey/origins.json", |
18 "https://www.gstatic.com/securitykey/a/google.com/origins.json" | 18 "https://www.gstatic.com/securitykey/a/google.com/origins.json" |
19 }; | 19 }; |
20 | 20 |
21 CryptotokenPrivateCanOriginAssertAppIdFunction:: | 21 CryptotokenPrivateCanOriginAssertAppIdFunction:: |
22 CryptotokenPrivateCanOriginAssertAppIdFunction() | 22 CryptotokenPrivateCanOriginAssertAppIdFunction() |
23 : chrome_details_(this) { | 23 : chrome_details_(this) { |
24 } | 24 } |
25 | 25 |
26 ExtensionFunction::ResponseAction | 26 ExtensionFunction::ResponseAction |
27 CryptotokenPrivateCanOriginAssertAppIdFunction::Run() { | 27 CryptotokenPrivateCanOriginAssertAppIdFunction::Run() { |
28 scoped_ptr<cryptotoken_private::CanOriginAssertAppId::Params> params = | 28 std::unique_ptr<cryptotoken_private::CanOriginAssertAppId::Params> params = |
29 cryptotoken_private::CanOriginAssertAppId::Params::Create(*args_); | 29 cryptotoken_private::CanOriginAssertAppId::Params::Create(*args_); |
30 EXTENSION_FUNCTION_VALIDATE(params); | 30 EXTENSION_FUNCTION_VALIDATE(params); |
31 | 31 |
32 const GURL origin_url(params->security_origin); | 32 const GURL origin_url(params->security_origin); |
33 if (!origin_url.is_valid()) { | 33 if (!origin_url.is_valid()) { |
34 return RespondNow(Error(extensions::ErrorUtils::FormatErrorMessage( | 34 return RespondNow(Error(extensions::ErrorUtils::FormatErrorMessage( |
35 "Security origin * is not a valid URL", params->security_origin))); | 35 "Security origin * is not a valid URL", params->security_origin))); |
36 } | 36 } |
37 const GURL app_id_url(params->app_id_url); | 37 const GURL app_id_url(params->app_id_url); |
38 if (!app_id_url.is_valid()) { | 38 if (!app_id_url.is_valid()) { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 if (params->app_id_url == kGoogleGstaticAppIds[i]) { | 74 if (params->app_id_url == kGoogleGstaticAppIds[i]) { |
75 return RespondNow(OneArgument(new base::FundamentalValue(true))); | 75 return RespondNow(OneArgument(new base::FundamentalValue(true))); |
76 } | 76 } |
77 } | 77 } |
78 } | 78 } |
79 return RespondNow(OneArgument(new base::FundamentalValue(false))); | 79 return RespondNow(OneArgument(new base::FundamentalValue(false))); |
80 } | 80 } |
81 | 81 |
82 } // namespace api | 82 } // namespace api |
83 } // namespace extensions | 83 } // namespace extensions |
OLD | NEW |