OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_UTILS_H_ | 5 #ifndef CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_UTILS_H_ |
6 #define CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_UTILS_H_ | 6 #define CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_UTILS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 class GURL; | 10 class GURL; |
11 | 11 |
| 12 namespace base { |
| 13 class FilePath; |
| 14 } |
| 15 |
12 namespace net { | 16 namespace net { |
13 class URLFetcher; | 17 class URLFetcher; |
14 class URLFetcherDelegate; | 18 class URLFetcherDelegate; |
15 class URLRequestContextGetter; | 19 class URLRequestContextGetter; |
16 } | 20 } |
17 | 21 |
18 namespace component_updater { | 22 namespace component_updater { |
19 | 23 |
20 // An update protocol request starts with a common preamble which includes | 24 // An update protocol request starts with a common preamble which includes |
21 // version and platform information for Chrome and the operating system, | 25 // version and platform information for Chrome and the operating system, |
(...skipping 26 matching lines...) Expand all Loading... |
48 | 52 |
49 // Returns the error code which occured during the fetch. The function returns 0 | 53 // Returns the error code which occured during the fetch. The function returns 0 |
50 // if the fetch was successful. If errors happen, the function could return a | 54 // if the fetch was successful. If errors happen, the function could return a |
51 // network error, an http response code, or the status of the fetch, if the | 55 // network error, an http response code, or the status of the fetch, if the |
52 // fetch is pending or canceled. | 56 // fetch is pending or canceled. |
53 int GetFetchError(const net::URLFetcher& fetcher); | 57 int GetFetchError(const net::URLFetcher& fetcher); |
54 | 58 |
55 // Returns true if the |status_code| represents a server error 5xx. | 59 // Returns true if the |status_code| represents a server error 5xx. |
56 bool IsHttpServerError(int status_code); | 60 bool IsHttpServerError(int status_code); |
57 | 61 |
| 62 // Deletes the file and its directory, if the directory is empty. If the |
| 63 // parent directory is not empty, the function ignores deleting the directory. |
| 64 // Returns true if the file and the empty directory are deleted. |
| 65 bool DeleteFileAndEmptyParentDirectory(const base::FilePath& filepath); |
| 66 |
58 } // namespace component_updater | 67 } // namespace component_updater |
59 | 68 |
60 #endif // CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_UTILS_H_ | 69 #endif // CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_UTILS_H_ |
61 | 70 |
OLD | NEW |