Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(489)

Side by Side Diff: components/update_client/utils.h

Issue 2835803002: Refactor the UpdateEngine and its actions in the component updater. (Closed)
Patch Set: feedback up to #6 Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/update_client/update_engine.cc ('k') | components/update_client/utils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef COMPONENTS_UPDATE_CLIENT_UTILS_H_ 5 #ifndef COMPONENTS_UPDATE_CLIENT_UTILS_H_
6 #define COMPONENTS_UPDATE_CLIENT_UTILS_H_ 6 #define COMPONENTS_UPDATE_CLIENT_UTILS_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 10 matching lines...) Expand all
21 } 21 }
22 22
23 namespace net { 23 namespace net {
24 class URLFetcher; 24 class URLFetcher;
25 class URLFetcherDelegate; 25 class URLFetcherDelegate;
26 class URLRequestContextGetter; 26 class URLRequestContextGetter;
27 } 27 }
28 28
29 namespace update_client { 29 namespace update_client {
30 30
31 class Component;
31 struct CrxComponent; 32 struct CrxComponent;
32 struct CrxUpdateItem;
33 33
34 // Defines a name-value pair that represents an installer attribute. 34 // Defines a name-value pair that represents an installer attribute.
35 // Installer attributes are component-specific metadata, which may be serialized 35 // Installer attributes are component-specific metadata, which may be serialized
36 // in an update check request. 36 // in an update check request.
37 using InstallerAttribute = std::pair<std::string, std::string>; 37 using InstallerAttribute = std::pair<std::string, std::string>;
38 38
39 // An update protocol request starts with a common preamble which includes 39 // An update protocol request starts with a common preamble which includes
40 // version and platform information for Chrome and the operating system, 40 // version and platform information for Chrome and the operating system,
41 // followed by a request body, which is the actual payload of the request. 41 // followed by a request body, which is the actual payload of the request.
42 // For example: 42 // For example:
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 82
83 // Returns true if the url request of |fetcher| was succesful. 83 // Returns true if the url request of |fetcher| was succesful.
84 bool FetchSuccess(const net::URLFetcher& fetcher); 84 bool FetchSuccess(const net::URLFetcher& fetcher);
85 85
86 // Returns the error code which occured during the fetch. The function returns 0 86 // Returns the error code which occured during the fetch. The function returns 0
87 // if the fetch was successful. If errors happen, the function could return a 87 // if the fetch was successful. If errors happen, the function could return a
88 // network error, an http response code, or the status of the fetch, if the 88 // network error, an http response code, or the status of the fetch, if the
89 // fetch is pending or canceled. 89 // fetch is pending or canceled.
90 int GetFetchError(const net::URLFetcher& fetcher); 90 int GetFetchError(const net::URLFetcher& fetcher);
91 91
92 // Returns true if the |update_item| contains a valid differential update url. 92 // Returns true if the |component| contains a valid differential update url.
93 bool HasDiffUpdate(const CrxUpdateItem* update_item); 93 bool HasDiffUpdate(const Component& component);
94 94
95 // Returns true if the |status_code| represents a server error 5xx. 95 // Returns true if the |status_code| represents a server error 5xx.
96 bool IsHttpServerError(int status_code); 96 bool IsHttpServerError(int status_code);
97 97
98 // Deletes the file and its directory, if the directory is empty. If the 98 // Deletes the file and its directory, if the directory is empty. If the
99 // parent directory is not empty, the function ignores deleting the directory. 99 // parent directory is not empty, the function ignores deleting the directory.
100 // Returns true if the file and the empty directory are deleted. 100 // Returns true if the file and the empty directory are deleted.
101 bool DeleteFileAndEmptyParentDirectory(const base::FilePath& filepath); 101 bool DeleteFileAndEmptyParentDirectory(const base::FilePath& filepath);
102 102
103 // Returns the component id of the |component|. The component id is in a 103 // Returns the component id of the |component|. The component id is in a
(...skipping 16 matching lines...) Expand all
120 // Removes the unsecure urls in the |urls| parameter. 120 // Removes the unsecure urls in the |urls| parameter.
121 void RemoveUnsecureUrls(std::vector<GURL>* urls); 121 void RemoveUnsecureUrls(std::vector<GURL>* urls);
122 122
123 // Adapter function for the old definitions of CrxInstaller::Install until the 123 // Adapter function for the old definitions of CrxInstaller::Install until the
124 // component installer code is migrated to use a REsult instead of bool. 124 // component installer code is migrated to use a REsult instead of bool.
125 CrxInstaller::Result InstallFunctionWrapper(base::Callback<bool()> callback); 125 CrxInstaller::Result InstallFunctionWrapper(base::Callback<bool()> callback);
126 126
127 } // namespace update_client 127 } // namespace update_client
128 128
129 #endif // COMPONENTS_UPDATE_CLIENT_UTILS_H_ 129 #endif // COMPONENTS_UPDATE_CLIENT_UTILS_H_
OLDNEW
« no previous file with comments | « components/update_client/update_engine.cc ('k') | components/update_client/utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698