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 CHROME_APP_INSTALLER_WIN_APP_INSTALLER_UTIL_H_ | |
6 #define CHROME_APP_INSTALLER_WIN_APP_INSTALLER_UTIL_H_ | |
7 | |
8 #include <map> | |
9 #include <string> | |
10 | |
11 #include "base/files/file_path.h" | |
12 | |
13 namespace app_installer { | |
14 | |
15 extern const char kInstallChromeApp[]; | |
16 | |
17 enum ExitCode { | |
18 SUCCESS = 0, | |
19 COULD_NOT_GET_FILE_PATH, | |
20 COULD_NOT_READ_TAG, | |
21 COULD_NOT_PARSE_TAG, | |
22 INVALID_APP_ID, | |
23 COULD_NOT_FETCH_INLINE_INSTALL_DATA, | |
24 COULD_NOT_PARSE_INLINE_INSTALL_DATA, | |
25 EULA_CANCELLED, | |
26 COULD_NOT_FIND_CHROME, | |
27 COULD_NOT_GET_TMP_FILE_PATH, | |
28 FAILED_TO_DOWNLOAD_CHROME_SETUP, | |
29 FAILED_TO_LAUNCH_CHROME_SETUP, | |
30 }; | |
31 | |
32 // Gets the tag attached to a file by dl.google.com. This uses the same format | |
33 // as Omaha. Returns the empty string on failure. | |
34 std::string GetTag(const base::FilePath& file_name_path); | |
35 | |
36 // Parses |tag| as key-value pairs and overwrites |parsed_pairs| with | |
37 // the result. |tag| should be a '&'-delimited list of '='-separated | |
38 // key-value pairs, e.g. "key1=value1&key2=value2". | |
39 // Returns true if the data could be parsed. | |
40 bool ParseTag(const std::string& tag, | |
41 std::map<std::string, std::string>* parsed_pairs); | |
42 | |
43 bool IsValidAppId(const std::string& app_id); | |
44 | |
45 // Uses WinHTTP to make a GET request. |server_port| can be zero to use the | |
46 // default port (80 or 443). | |
47 bool FetchUrl(const base::string16& user_agent, | |
48 const base::string16& server_name, | |
49 uint16_t server_port, | |
50 const base::string16& object_name, | |
51 std::vector<uint8_t>* response_data); | |
52 | |
53 // Shows UI to download and install Chrome. Returns a failure code, or SUCCESS | |
54 // if the installation completed successfully. | |
55 ExitCode GetChrome(bool is_canary, const std::string& inline_install_json); | |
56 | |
57 } // namespace app_installer | |
58 | |
59 #endif // CHROME_APP_INSTALLER_WIN_APP_INSTALLER_UTIL_H_ | |
OLD | NEW |