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

Side by Side Diff: chrome/browser/chromeos/gdata/gdata_util.cc

Issue 10874028: Rename GDataFileSystem* to DriveFileSystem* (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase. Created 8 years, 4 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/gdata/gdata_util.h" 5 #include "chrome/browser/chromeos/gdata/gdata_util.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 #include <utility> 9 #include <utility>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/bind_helpers.h" 13 #include "base/bind_helpers.h"
14 #include "base/command_line.h" 14 #include "base/command_line.h"
15 #include "base/file_path.h" 15 #include "base/file_path.h"
16 #include "base/file_util.h" 16 #include "base/file_util.h"
17 #include "base/json/json_reader.h" 17 #include "base/json/json_reader.h"
18 #include "base/logging.h" 18 #include "base/logging.h"
19 #include "base/string_number_conversions.h" 19 #include "base/string_number_conversions.h"
20 #include "base/string_util.h" 20 #include "base/string_util.h"
21 #include "base/stringprintf.h" 21 #include "base/stringprintf.h"
22 #include "base/threading/sequenced_worker_pool.h" 22 #include "base/threading/sequenced_worker_pool.h"
23 #include "base/time.h" 23 #include "base/time.h"
24 #include "base/tracked_objects.h" 24 #include "base/tracked_objects.h"
25 #include "chrome/browser/chromeos/gdata/drive.pb.h" 25 #include "chrome/browser/chromeos/gdata/drive.pb.h"
26 #include "chrome/browser/chromeos/gdata/drive_file_system_interface.h"
26 #include "chrome/browser/chromeos/gdata/file_write_helper.h" 27 #include "chrome/browser/chromeos/gdata/file_write_helper.h"
27 #include "chrome/browser/chromeos/gdata/gdata_file_system_interface.h"
28 #include "chrome/browser/chromeos/gdata/gdata_system_service.h" 28 #include "chrome/browser/chromeos/gdata/gdata_system_service.h"
29 #include "chrome/browser/chromeos/login/user.h" 29 #include "chrome/browser/chromeos/login/user.h"
30 #include "chrome/browser/chromeos/login/user_manager.h" 30 #include "chrome/browser/chromeos/login/user_manager.h"
31 #include "chrome/browser/prefs/pref_service.h" 31 #include "chrome/browser/prefs/pref_service.h"
32 #include "chrome/browser/profiles/profile.h" 32 #include "chrome/browser/profiles/profile.h"
33 #include "chrome/browser/ui/browser.h" 33 #include "chrome/browser/ui/browser.h"
34 #include "chrome/browser/ui/browser_finder.h" 34 #include "chrome/browser/ui/browser_finder.h"
35 #include "chrome/common/chrome_switches.h" 35 #include "chrome/common/chrome_switches.h"
36 #include "chrome/common/chrome_version_info.h" 36 #include "chrome/common/chrome_version_info.h"
37 #include "chrome/common/pref_names.h" 37 #include "chrome/common/pref_names.h"
(...skipping 16 matching lines...) Expand all
54 54
55 const FilePath::CharType* kGDataMountPointPathComponents[] = { 55 const FilePath::CharType* kGDataMountPointPathComponents[] = {
56 "/", "special", "drive" 56 "/", "special", "drive"
57 }; 57 };
58 58
59 const int kReadOnlyFilePermissions = base::PLATFORM_FILE_OPEN | 59 const int kReadOnlyFilePermissions = base::PLATFORM_FILE_OPEN |
60 base::PLATFORM_FILE_READ | 60 base::PLATFORM_FILE_READ |
61 base::PLATFORM_FILE_EXCLUSIVE_READ | 61 base::PLATFORM_FILE_EXCLUSIVE_READ |
62 base::PLATFORM_FILE_ASYNC; 62 base::PLATFORM_FILE_ASYNC;
63 63
64 GDataFileSystemInterface* GetGDataFileSystem(Profile* profile) { 64 DriveFileSystemInterface* GetDriveFileSystem(Profile* profile) {
65 GDataSystemService* system_service = 65 GDataSystemService* system_service =
66 GDataSystemServiceFactory::GetForProfile(profile); 66 GDataSystemServiceFactory::GetForProfile(profile);
67 return system_service ? system_service->file_system() : NULL; 67 return system_service ? system_service->file_system() : NULL;
68 } 68 }
69 69
70 DriveCache* GetDriveCache(Profile* profile) { 70 DriveCache* GetDriveCache(Profile* profile) {
71 GDataSystemService* system_service = 71 GDataSystemService* system_service =
72 GDataSystemServiceFactory::GetForProfile(profile); 72 GDataSystemServiceFactory::GetForProfile(profile);
73 return system_service ? system_service->cache() : NULL; 73 return system_service ? system_service->cache() : NULL;
74 } 74 }
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 chrome::kDriveScheme, 231 chrome::kDriveScheme,
232 net::EscapePath(resource_id).c_str())); 232 net::EscapePath(resource_id).c_str()));
233 return GURL(url); 233 return GURL(url);
234 } 234 }
235 235
236 void ModifyGDataFileResourceUrl(Profile* profile, 236 void ModifyGDataFileResourceUrl(Profile* profile,
237 const FilePath& drive_cache_path, 237 const FilePath& drive_cache_path,
238 GURL* url) { 238 GURL* url) {
239 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 239 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
240 240
241 GDataFileSystemInterface* file_system = GetGDataFileSystem(profile); 241 DriveFileSystemInterface* file_system = GetDriveFileSystem(profile);
242 if (!file_system) 242 if (!file_system)
243 return; 243 return;
244 DriveCache* cache = GetDriveCache(profile); 244 DriveCache* cache = GetDriveCache(profile);
245 if (!cache) 245 if (!cache)
246 return; 246 return;
247 247
248 if (cache->GetCacheDirectoryPath(DriveCache::CACHE_TYPE_TMP_DOCUMENTS). 248 if (cache->GetCacheDirectoryPath(DriveCache::CACHE_TYPE_TMP_DOCUMENTS).
249 IsParent(drive_cache_path)) { 249 IsParent(drive_cache_path)) {
250 // Handle hosted documents. The edit url is in the temporary file, so we 250 // Handle hosted documents. The edit url is in the temporary file, so we
251 // read it on a blocking thread. 251 // read it on a blocking thread.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 void InsertDriveCachePathsPermissions( 295 void InsertDriveCachePathsPermissions(
296 Profile* profile, 296 Profile* profile,
297 scoped_ptr<std::vector<FilePath> > gdata_paths, 297 scoped_ptr<std::vector<FilePath> > gdata_paths,
298 std::vector<std::pair<FilePath, int> >* cache_paths, 298 std::vector<std::pair<FilePath, int> >* cache_paths,
299 const base::Closure& callback) { 299 const base::Closure& callback) {
300 DCHECK(profile); 300 DCHECK(profile);
301 DCHECK(gdata_paths.get()); 301 DCHECK(gdata_paths.get());
302 DCHECK(cache_paths); 302 DCHECK(cache_paths);
303 DCHECK(!callback.is_null()); 303 DCHECK(!callback.is_null());
304 304
305 GDataFileSystemInterface* file_system = GetGDataFileSystem(profile); 305 DriveFileSystemInterface* file_system = GetDriveFileSystem(profile);
306 if (!file_system || gdata_paths->empty()) { 306 if (!file_system || gdata_paths->empty()) {
307 callback.Run(); 307 callback.Run();
308 return; 308 return;
309 } 309 }
310 310
311 // Remove one file path entry from the back of the input vector |gdata_paths|. 311 // Remove one file path entry from the back of the input vector |gdata_paths|.
312 FilePath gdata_path = gdata_paths->back(); 312 FilePath gdata_path = gdata_paths->back();
313 gdata_paths->pop_back(); 313 gdata_paths->pop_back();
314 314
315 // Call GetEntryInfoByPath() to get file info for |gdata_path| then insert 315 // Call GetEntryInfoByPath() to get file info for |gdata_path| then insert
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 const base::Closure& reply_task) { 652 const base::Closure& reply_task) {
653 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 653 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
654 654
655 const bool posted = blocking_task_runner->PostTaskAndReply( 655 const bool posted = blocking_task_runner->PostTaskAndReply(
656 from_here, request_task, reply_task); 656 from_here, request_task, reply_task);
657 DCHECK(posted); 657 DCHECK(posted);
658 } 658 }
659 659
660 } // namespace util 660 } // namespace util
661 } // namespace gdata 661 } // namespace gdata
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_system_service.cc ('k') | chrome/browser/chromeos/gdata/gdata_wapi_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698