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 #include "chrome/browser/component_updater/component_updater_utils.h" | 5 #include "chrome/browser/component_updater/component_updater_utils.h" |
6 #include "base/file_util.h" | |
7 #include "base/files/file_path.h" | |
6 #include "base/guid.h" | 8 #include "base/guid.h" |
7 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
8 #include "base/sys_info.h" | 10 #include "base/sys_info.h" |
9 #include "base/win/windows_version.h" | 11 #include "base/win/windows_version.h" |
10 #include "chrome/common/chrome_version_info.h" | 12 #include "chrome/common/chrome_version_info.h" |
11 #include "chrome/common/omaha_query_params/omaha_query_params.h" | 13 #include "chrome/common/omaha_query_params/omaha_query_params.h" |
12 #include "net/base/load_flags.h" | 14 #include "net/base/load_flags.h" |
13 #include "net/url_request/url_fetcher.h" | 15 #include "net/url_request/url_fetcher.h" |
14 #include "net/url_request/url_request_context_getter.h" | 16 #include "net/url_request/url_request_context_getter.h" |
15 #include "net/url_request/url_request_status.h" | 17 #include "net/url_request/url_request_status.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
95 // Network errors are small negative numbers. | 97 // Network errors are small negative numbers. |
96 const int error = fetcher.GetStatus().error(); | 98 const int error = fetcher.GetStatus().error(); |
97 return error ? error : -1; | 99 return error ? error : -1; |
98 } | 100 } |
99 | 101 |
100 default: | 102 default: |
101 return -1; | 103 return -1; |
102 } | 104 } |
103 } | 105 } |
104 | 106 |
105 | |
106 bool IsHttpServerError(int status_code) { | 107 bool IsHttpServerError(int status_code) { |
107 return 500 <= status_code && status_code < 600; | 108 return 500 <= status_code && status_code < 600; |
108 } | 109 } |
109 | 110 |
111 bool DeleteFileAndEmptyParentDirectory(const base::FilePath& filepath) { | |
112 if (!base::DeleteFile(filepath, false)) | |
113 return false; | |
114 | |
115 const base::FilePath dirname(filepath.DirName()); | |
116 if (!base::IsDirectoryEmpty(dirname)) | |
117 return true; | |
118 | |
119 return base::DeleteFile(dirname, false); | |
120 } | |
121 | |
cpu_(ooo_6.6-7.5)
2013/12/17 00:48:38
I hope we don't end up deleting %temp% but i guess
Sorin Jianu
2013/12/17 01:19:40
I thought about it but what's the fix? My naive th
| |
110 } // namespace component_updater | 122 } // namespace component_updater |
111 | 123 |
OLD | NEW |