OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef REMOTING_HOST_GNUBBY_UTILS_H_ | |
6 #define REMOTING_HOST_GNUBBY_UTILS_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "base/basictypes.h" | |
11 | |
12 namespace base { | |
13 | |
14 class DictionaryValue; | |
15 | |
16 } // namespace base | |
17 | |
18 namespace remoting { | |
19 | |
20 // Utility methods for gnubby processing. | |
21 | |
22 class GnubbyUtils { | |
23 public: | |
24 // Get a gnubbyd sign request json string from a request blob. | |
25 static bool GetJsonFromRequest(const char* data, | |
26 int data_len, | |
27 std::string* json); | |
28 | |
29 // Get response blob data from a gnubbyd sign reply json string. | |
30 static void GetResponseFromJson(std::string json, std::string* data); | |
Sergey Ulanov
2014/02/09 22:29:54
const-ref for the first argument please.
psj
2014/02/10 22:57:22
Done.
| |
31 | |
32 private: | |
33 // No construction - all methods are static. | |
Sergey Ulanov
2014/02/09 22:29:54
Don't really need a class in this case - just decl
psj
2014/02/10 22:57:22
Done.
| |
34 GnubbyUtils(); | |
35 | |
36 // Create a "web safe" base64 encoding of |data|. Replaces + with -, / with _ | |
37 // and strips trailing = characters. | |
38 static void WebSafeBase64Encode(const std::string& data, | |
Sergey Ulanov
2014/02/09 22:29:54
Since these are all private they don't need to be
psj
2014/02/10 22:57:22
Done.
| |
39 std::string* encoded_data); | |
40 | |
41 // Decode a "web safe" base64 encoded string. | |
42 static void WebSafeBase64Decode(const std::string& encoded_data, | |
43 std::string* data); | |
44 | |
45 // Get and decode a "web safe" base64 encoded string from a JSON dictionary. | |
46 static bool DecodeDataFromDictionary(const base::DictionaryValue& dictionary, | |
47 const std::string& path, | |
48 std::string* data); | |
49 | |
50 DISALLOW_COPY_AND_ASSIGN(GnubbyUtils); | |
51 }; | |
52 | |
53 } // namespace remoting | |
54 | |
55 #endif // REMOTING_HOST_GNUBBY_UTILS_H_ | |
OLD | NEW |