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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 const base::FilePath& GetDriveMyDriveMountPointPath() { | 65 const base::FilePath& GetDriveMyDriveMountPointPath() { |
66 CR_DEFINE_STATIC_LOCAL(base::FilePath, drive_mydrive_mount_path, | 66 CR_DEFINE_STATIC_LOCAL(base::FilePath, drive_mydrive_mount_path, |
67 (kDriveMyDriveMountPointPath)); | 67 (kDriveMyDriveMountPointPath)); |
68 return drive_mydrive_mount_path; | 68 return drive_mydrive_mount_path; |
69 } | 69 } |
70 | 70 |
71 std::string ReadStringFromGDocFile(const base::FilePath& file_path, | 71 std::string ReadStringFromGDocFile(const base::FilePath& file_path, |
72 const std::string& key) { | 72 const std::string& key) { |
73 const int64 kMaxGDocSize = 4096; | 73 const int64 kMaxGDocSize = 4096; |
74 int64 file_size = 0; | 74 int64 file_size = 0; |
75 if (!file_util::GetFileSize(file_path, &file_size) || | 75 if (!base::GetFileSize(file_path, &file_size) || |
76 file_size > kMaxGDocSize) { | 76 file_size > kMaxGDocSize) { |
77 LOG(WARNING) << "File too large to be a GDoc file " << file_path.value(); | 77 LOG(WARNING) << "File too large to be a GDoc file " << file_path.value(); |
78 return std::string(); | 78 return std::string(); |
79 } | 79 } |
80 | 80 |
81 JSONFileValueSerializer reader(file_path); | 81 JSONFileValueSerializer reader(file_path); |
82 std::string error_message; | 82 std::string error_message; |
83 scoped_ptr<base::Value> root_value(reader.Deserialize(NULL, &error_message)); | 83 scoped_ptr<base::Value> root_value(reader.Deserialize(NULL, &error_message)); |
84 if (!root_value) { | 84 if (!root_value) { |
85 LOG(WARNING) << "Failed to parse " << file_path.value() << " as JSON." | 85 LOG(WARNING) << "Failed to parse " << file_path.value() << " as JSON." |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 const bool disable_sync_over_celluar = | 406 const bool disable_sync_over_celluar = |
407 profile->GetPrefs()->GetBoolean(prefs::kDisableDriveOverCellular); | 407 profile->GetPrefs()->GetBoolean(prefs::kDisableDriveOverCellular); |
408 | 408 |
409 if (is_connection_cellular && disable_sync_over_celluar) | 409 if (is_connection_cellular && disable_sync_over_celluar) |
410 return DRIVE_CONNECTED_METERED; | 410 return DRIVE_CONNECTED_METERED; |
411 return DRIVE_CONNECTED; | 411 return DRIVE_CONNECTED; |
412 } | 412 } |
413 | 413 |
414 } // namespace util | 414 } // namespace util |
415 } // namespace drive | 415 } // namespace drive |
OLD | NEW |