| 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 { | 12 namespace base { |
| 13 class FilePath; | 13 class FilePath; |
| 14 } | 14 } |
| 15 | 15 |
| 16 namespace net { | 16 namespace net { |
| 17 class URLFetcher; | 17 class URLFetcher; |
| 18 class URLFetcherDelegate; | 18 class URLFetcherDelegate; |
| 19 class URLRequestContextGetter; | 19 class URLRequestContextGetter; |
| 20 } | 20 } |
| 21 | 21 |
| 22 namespace component_updater { | 22 namespace component_updater { |
| 23 | 23 |
| 24 struct CrxUpdateItem; |
| 25 |
| 24 // An update protocol request starts with a common preamble which includes | 26 // An update protocol request starts with a common preamble which includes |
| 25 // version and platform information for Chrome and the operating system, | 27 // version and platform information for Chrome and the operating system, |
| 26 // followed by a request body, which is the actual payload of the request. | 28 // followed by a request body, which is the actual payload of the request. |
| 27 // For example: | 29 // For example: |
| 28 // | 30 // |
| 29 // <?xml version="1.0" encoding="UTF-8"?> | 31 // <?xml version="1.0" encoding="UTF-8"?> |
| 30 // <request protocol="3.0" version="chrome-32.0.1.0" prodversion="32.0.1.0" | 32 // <request protocol="3.0" version="chrome-32.0.1.0" prodversion="32.0.1.0" |
| 31 // requestid="{7383396D-B4DD-46E1-9104-AAC6B918E792}" | 33 // requestid="{7383396D-B4DD-46E1-9104-AAC6B918E792}" |
| 32 // updaterchannel="canary" arch="x86" nacl_arch="x86-64" | 34 // updaterchannel="canary" arch="x86" nacl_arch="x86-64" |
| 33 // ADDITIONAL ATTRIBUTES> | 35 // ADDITIONAL ATTRIBUTES> |
| (...skipping 19 matching lines...) Expand all Loading... |
| 53 | 55 |
| 54 // Returns true if the url request of |fetcher| was succesful. | 56 // Returns true if the url request of |fetcher| was succesful. |
| 55 bool FetchSuccess(const net::URLFetcher& fetcher); | 57 bool FetchSuccess(const net::URLFetcher& fetcher); |
| 56 | 58 |
| 57 // Returns the error code which occured during the fetch. The function returns 0 | 59 // Returns the error code which occured during the fetch. The function returns 0 |
| 58 // if the fetch was successful. If errors happen, the function could return a | 60 // if the fetch was successful. If errors happen, the function could return a |
| 59 // network error, an http response code, or the status of the fetch, if the | 61 // network error, an http response code, or the status of the fetch, if the |
| 60 // fetch is pending or canceled. | 62 // fetch is pending or canceled. |
| 61 int GetFetchError(const net::URLFetcher& fetcher); | 63 int GetFetchError(const net::URLFetcher& fetcher); |
| 62 | 64 |
| 65 // Returns true if the |update_item| contains a valid differential update url. |
| 66 bool HasDiffUpdate(const CrxUpdateItem* update_item); |
| 67 |
| 63 // Returns true if the |status_code| represents a server error 5xx. | 68 // Returns true if the |status_code| represents a server error 5xx. |
| 64 bool IsHttpServerError(int status_code); | 69 bool IsHttpServerError(int status_code); |
| 65 | 70 |
| 66 // Deletes the file and its directory, if the directory is empty. If the | 71 // Deletes the file and its directory, if the directory is empty. If the |
| 67 // parent directory is not empty, the function ignores deleting the directory. | 72 // parent directory is not empty, the function ignores deleting the directory. |
| 68 // Returns true if the file and the empty directory are deleted. | 73 // Returns true if the file and the empty directory are deleted. |
| 69 bool DeleteFileAndEmptyParentDirectory(const base::FilePath& filepath); | 74 bool DeleteFileAndEmptyParentDirectory(const base::FilePath& filepath); |
| 70 | 75 |
| 71 } // namespace component_updater | 76 } // namespace component_updater |
| 72 | 77 |
| 73 #endif // CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_UTILS_H_ | 78 #endif // CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_UPDATER_UTILS_H_ |
| 74 | 79 |
| OLD | NEW |