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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "components/proximity_auth/cryptauth/cryptauth_access_token_fetcher.h" | 7 #include "components/proximity_auth/cryptauth/cryptauth_access_token_fetcher.h" |
8 #include "components/proximity_auth/cryptauth/cryptauth_api_call_flow.h" | 8 #include "components/proximity_auth/cryptauth/cryptauth_api_call_flow.h" |
9 #include "components/proximity_auth/cryptauth/cryptauth_client.h" | 9 #include "components/proximity_auth/cryptauth/cryptauth_client.h" |
10 #include "components/proximity_auth/cryptauth/proto/cryptauth_api.pb.h" | 10 #include "components/proximity_auth/cryptauth/proto/cryptauth_api.pb.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 const char kToggleEasyUnlockPath[] = "deviceSync/toggleeasyunlock"; | 29 const char kToggleEasyUnlockPath[] = "deviceSync/toggleeasyunlock"; |
30 const char kSetupEnrollmentPath[] = "enrollment/setupenrollment"; | 30 const char kSetupEnrollmentPath[] = "enrollment/setupenrollment"; |
31 const char kFinishEnrollmentPath[] = "enrollment/finishenrollment"; | 31 const char kFinishEnrollmentPath[] = "enrollment/finishenrollment"; |
32 | 32 |
33 // Query string of the API URL indicating that the response should be in a | 33 // Query string of the API URL indicating that the response should be in a |
34 // serialized protobuf format. | 34 // serialized protobuf format. |
35 const char kQueryProtobuf[] = "?alt=proto"; | 35 const char kQueryProtobuf[] = "?alt=proto"; |
36 | 36 |
37 // Creates the full CryptAuth URL for endpoint to the API with |request_path|. | 37 // Creates the full CryptAuth URL for endpoint to the API with |request_path|. |
38 GURL CreateRequestUrl(const std::string& request_path) { | 38 GURL CreateRequestUrl(const std::string& request_path) { |
39 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 39 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
40 GURL google_apis_url = | 40 GURL google_apis_url = |
41 GURL(command_line->HasSwitch(switches::kCryptAuthHTTPHost) | 41 GURL(command_line->HasSwitch(switches::kCryptAuthHTTPHost) |
42 ? command_line->GetSwitchValueASCII(switches::kCryptAuthHTTPHost) | 42 ? command_line->GetSwitchValueASCII(switches::kCryptAuthHTTPHost) |
43 : kDefaultCryptAuthHTTPHost); | 43 : kDefaultCryptAuthHTTPHost); |
44 return google_apis_url.Resolve(kCryptAuthPath + request_path + | 44 return google_apis_url.Resolve(kCryptAuthPath + request_path + |
45 kQueryProtobuf); | 45 kQueryProtobuf); |
46 } | 46 } |
47 | 47 |
48 } // namespace | 48 } // namespace |
49 | 49 |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 return; | 160 return; |
161 } | 161 } |
162 result_callback.Run(response); | 162 result_callback.Run(response); |
163 }; | 163 }; |
164 | 164 |
165 void CryptAuthClient::OnApiCallFailed(const std::string& error_message) { | 165 void CryptAuthClient::OnApiCallFailed(const std::string& error_message) { |
166 error_callback_.Run(error_message); | 166 error_callback_.Run(error_message); |
167 } | 167 } |
168 | 168 |
169 } // proximity_auth | 169 } // proximity_auth |
OLD | NEW |