| 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 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 | 358 |
| 359 void EmptyFileOperationCallback(FileError error) { | 359 void EmptyFileOperationCallback(FileError error) { |
| 360 } | 360 } |
| 361 | 361 |
| 362 bool CreateGDocFile(const base::FilePath& file_path, | 362 bool CreateGDocFile(const base::FilePath& file_path, |
| 363 const GURL& url, | 363 const GURL& url, |
| 364 const std::string& resource_id) { | 364 const std::string& resource_id) { |
| 365 std::string content = base::StringPrintf( | 365 std::string content = base::StringPrintf( |
| 366 "{\"url\": \"%s\", \"resource_id\": \"%s\"}", | 366 "{\"url\": \"%s\", \"resource_id\": \"%s\"}", |
| 367 url.spec().c_str(), resource_id.c_str()); | 367 url.spec().c_str(), resource_id.c_str()); |
| 368 return file_util::WriteFile(file_path, content.data(), content.size()) == | 368 return base::WriteFile(file_path, content.data(), content.size()) == |
| 369 static_cast<int>(content.size()); | 369 static_cast<int>(content.size()); |
| 370 } | 370 } |
| 371 | 371 |
| 372 bool HasGDocFileExtension(const base::FilePath& file_path) { | 372 bool HasGDocFileExtension(const base::FilePath& file_path) { |
| 373 return google_apis::ResourceEntry::ClassifyEntryKindByFileExtension( | 373 return google_apis::ResourceEntry::ClassifyEntryKindByFileExtension( |
| 374 file_path) & | 374 file_path) & |
| 375 google_apis::ResourceEntry::KIND_OF_HOSTED_DOCUMENT; | 375 google_apis::ResourceEntry::KIND_OF_HOSTED_DOCUMENT; |
| 376 } | 376 } |
| 377 | 377 |
| 378 GURL ReadUrlFromGDocFile(const base::FilePath& file_path) { | 378 GURL ReadUrlFromGDocFile(const base::FilePath& file_path) { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 const bool disable_sync_over_celluar = | 414 const bool disable_sync_over_celluar = |
| 415 profile->GetPrefs()->GetBoolean(prefs::kDisableDriveOverCellular); | 415 profile->GetPrefs()->GetBoolean(prefs::kDisableDriveOverCellular); |
| 416 | 416 |
| 417 if (is_connection_cellular && disable_sync_over_celluar) | 417 if (is_connection_cellular && disable_sync_over_celluar) |
| 418 return DRIVE_CONNECTED_METERED; | 418 return DRIVE_CONNECTED_METERED; |
| 419 return DRIVE_CONNECTED; | 419 return DRIVE_CONNECTED; |
| 420 } | 420 } |
| 421 | 421 |
| 422 } // namespace util | 422 } // namespace util |
| 423 } // namespace drive | 423 } // namespace drive |
| OLD | NEW |