OLD | NEW |
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 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
14 #include "base/files/file_util.h" | 14 #include "base/files/file_util.h" |
15 #include "base/i18n/icu_string_conversions.h" | 15 #include "base/i18n/icu_string_conversions.h" |
16 #include "base/json/json_file_value_serializer.h" | 16 #include "base/json/json_file_value_serializer.h" |
17 #include "base/logging.h" | 17 #include "base/logging.h" |
18 #include "base/memory/scoped_ptr.h" | 18 #include "base/memory/scoped_ptr.h" |
19 #include "base/message_loop/message_loop_proxy.h" | |
20 #include "base/prefs/pref_service.h" | 19 #include "base/prefs/pref_service.h" |
21 #include "base/strings/string_number_conversions.h" | 20 #include "base/strings/string_number_conversions.h" |
22 #include "base/strings/string_util.h" | 21 #include "base/strings/string_util.h" |
23 #include "base/strings/stringprintf.h" | 22 #include "base/strings/stringprintf.h" |
| 23 #include "base/thread_task_runner_handle.h" |
24 #include "base/threading/sequenced_worker_pool.h" | 24 #include "base/threading/sequenced_worker_pool.h" |
25 #include "chrome/browser/browser_process.h" | 25 #include "chrome/browser/browser_process.h" |
26 #include "chrome/browser/chromeos/drive/drive.pb.h" | 26 #include "chrome/browser/chromeos/drive/drive.pb.h" |
27 #include "chrome/browser/chromeos/drive/drive_integration_service.h" | 27 #include "chrome/browser/chromeos/drive/drive_integration_service.h" |
28 #include "chrome/browser/chromeos/drive/file_system_interface.h" | 28 #include "chrome/browser/chromeos/drive/file_system_interface.h" |
29 #include "chrome/browser/chromeos/drive/job_list.h" | 29 #include "chrome/browser/chromeos/drive/job_list.h" |
30 #include "chrome/browser/chromeos/drive/write_on_cache_file.h" | 30 #include "chrome/browser/chromeos/drive/write_on_cache_file.h" |
31 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 31 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
32 #include "chrome/browser/chromeos/profiles/profile_util.h" | 32 #include "chrome/browser/chromeos/profiles/profile_util.h" |
33 #include "chrome/browser/profiles/profile.h" | 33 #include "chrome/browser/profiles/profile.h" |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 DCHECK(!callback.is_null()); | 291 DCHECK(!callback.is_null()); |
292 if (IsUnderDriveMountPoint(directory)) { | 292 if (IsUnderDriveMountPoint(directory)) { |
293 FileSystemInterface* file_system = GetFileSystemByProfile(profile); | 293 FileSystemInterface* file_system = GetFileSystemByProfile(profile); |
294 DCHECK(file_system); | 294 DCHECK(file_system); |
295 file_system->CreateDirectory( | 295 file_system->CreateDirectory( |
296 ExtractDrivePath(directory), | 296 ExtractDrivePath(directory), |
297 true /* is_exclusive */, | 297 true /* is_exclusive */, |
298 true /* is_recursive */, | 298 true /* is_recursive */, |
299 callback); | 299 callback); |
300 } else { | 300 } else { |
301 base::MessageLoopProxy::current()->PostTask( | 301 base::ThreadTaskRunnerHandle::Get()->PostTask( |
302 FROM_HERE, base::Bind(callback, FILE_ERROR_OK)); | 302 FROM_HERE, base::Bind(callback, FILE_ERROR_OK)); |
303 } | 303 } |
304 } | 304 } |
305 | 305 |
306 void EmptyFileOperationCallback(FileError error) { | 306 void EmptyFileOperationCallback(FileError error) { |
307 } | 307 } |
308 | 308 |
309 bool CreateGDocFile(const base::FilePath& file_path, | 309 bool CreateGDocFile(const base::FilePath& file_path, |
310 const GURL& url, | 310 const GURL& url, |
311 const std::string& resource_id) { | 311 const std::string& resource_id) { |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 const bool disable_sync_over_celluar = | 355 const bool disable_sync_over_celluar = |
356 profile->GetPrefs()->GetBoolean(prefs::kDisableDriveOverCellular); | 356 profile->GetPrefs()->GetBoolean(prefs::kDisableDriveOverCellular); |
357 | 357 |
358 if (is_connection_cellular && disable_sync_over_celluar) | 358 if (is_connection_cellular && disable_sync_over_celluar) |
359 return DRIVE_CONNECTED_METERED; | 359 return DRIVE_CONNECTED_METERED; |
360 return DRIVE_CONNECTED; | 360 return DRIVE_CONNECTED; |
361 } | 361 } |
362 | 362 |
363 } // namespace util | 363 } // namespace util |
364 } // namespace drive | 364 } // namespace drive |
OLD | NEW |