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

Side by Side Diff: chrome/browser/chromeos/drive/file_system_util.cc

Issue 14643006: [chromeos] Remove dependencies of StatisticsProvider on chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: trybots Created 7 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/chromeos/drive/file_system_util.h" 5 #include "chrome/browser/chromeos/drive/file_system_util.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/bind_helpers.h" 11 #include "base/bind_helpers.h"
12 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/message_loop_proxy.h" 14 #include "base/message_loop_proxy.h"
15 #include "base/string_util.h" 15 #include "base/string_util.h"
16 #include "base/stringprintf.h" 16 #include "base/stringprintf.h"
17 #include "base/strings/string_number_conversions.h" 17 #include "base/strings/string_number_conversions.h"
18 #include "chrome/browser/chromeos/drive/drive.pb.h" 18 #include "chrome/browser/chromeos/drive/drive.pb.h"
19 #include "chrome/browser/chromeos/drive/drive_system_service.h" 19 #include "chrome/browser/chromeos/drive/drive_system_service.h"
20 #include "chrome/browser/chromeos/drive/file_system_interface.h" 20 #include "chrome/browser/chromeos/drive/file_system_interface.h"
21 #include "chrome/browser/chromeos/drive/file_write_helper.h" 21 #include "chrome/browser/chromeos/drive/file_write_helper.h"
22 #include "chrome/browser/profiles/profile.h" 22 #include "chrome/browser/profiles/profile.h"
23 #include "chrome/common/chrome_constants.h" 23 #include "chrome/common/chrome_constants.h"
24 #include "chrome/common/chrome_paths_internal.h" 24 #include "chrome/common/chrome_paths_internal.h"
25 #include "chrome/common/url_constants.h" 25 #include "chrome/common/url_constants.h"
26 #include "chromeos/chromeos_constants.h"
26 #include "content/public/browser/browser_thread.h" 27 #include "content/public/browser/browser_thread.h"
27 #include "net/base/escape.h" 28 #include "net/base/escape.h"
28 #include "webkit/fileapi/file_system_url.h" 29 #include "webkit/fileapi/file_system_url.h"
29 30
30 using content::BrowserThread; 31 using content::BrowserThread;
31 32
32 namespace drive { 33 namespace drive {
33 namespace util { 34 namespace util {
34 35
35 namespace { 36 namespace {
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 const fileapi::FileSystemURL& url) { 216 const fileapi::FileSystemURL& url) {
216 if (!url.is_valid() || url.type() != fileapi::kFileSystemTypeDrive) 217 if (!url.is_valid() || url.type() != fileapi::kFileSystemTypeDrive)
217 return base::FilePath(); 218 return base::FilePath();
218 return ExtractDrivePath(url.path()); 219 return ExtractDrivePath(url.path());
219 } 220 }
220 221
221 base::FilePath GetCacheRootPath(Profile* profile) { 222 base::FilePath GetCacheRootPath(Profile* profile) {
222 base::FilePath cache_base_path; 223 base::FilePath cache_base_path;
223 chrome::GetUserCacheDirectory(profile->GetPath(), &cache_base_path); 224 chrome::GetUserCacheDirectory(profile->GetPath(), &cache_base_path);
224 base::FilePath cache_root_path = 225 base::FilePath cache_root_path =
225 cache_base_path.Append(chrome::kDriveCacheDirname); 226 cache_base_path.Append(chromeos::kDriveCacheDirname);
226 return cache_root_path.Append(kFileCacheVersionDir); 227 return cache_root_path.Append(kFileCacheVersionDir);
227 } 228 }
228 229
229 std::string EscapeCacheFileName(const std::string& filename) { 230 std::string EscapeCacheFileName(const std::string& filename) {
230 // This is based on net/base/escape.cc: net::(anonymous namespace)::Escape 231 // This is based on net/base/escape.cc: net::(anonymous namespace)::Escape
231 std::string escaped; 232 std::string escaped;
232 for (size_t i = 0; i < filename.size(); ++i) { 233 for (size_t i = 0; i < filename.size(); ++i) {
233 char c = filename[i]; 234 char c = filename[i];
234 if (c == '%' || c == '.' || c == '/') { 235 if (c == '%' || c == '.' || c == '/') {
235 base::StringAppendF(&escaped, "%%%02X", c); 236 base::StringAppendF(&escaped, "%%%02X", c);
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 entry->set_last_modified(file_info.last_modified.ToInternalValue()); 387 entry->set_last_modified(file_info.last_modified.ToInternalValue());
387 entry->set_last_accessed(file_info.last_accessed.ToInternalValue()); 388 entry->set_last_accessed(file_info.last_accessed.ToInternalValue());
388 entry->set_creation_time(file_info.creation_time.ToInternalValue()); 389 entry->set_creation_time(file_info.creation_time.ToInternalValue());
389 } 390 }
390 391
391 void EmptyFileOperationCallback(FileError error) { 392 void EmptyFileOperationCallback(FileError error) {
392 } 393 }
393 394
394 } // namespace util 395 } // namespace util
395 } // namespace drive 396 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698