| 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" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 std::string ReadStringFromGDocFile(const base::FilePath& file_path, | 51 std::string ReadStringFromGDocFile(const base::FilePath& file_path, |
| 52 const std::string& key) { | 52 const std::string& key) { |
| 53 const int64 kMaxGDocSize = 4096; | 53 const int64 kMaxGDocSize = 4096; |
| 54 int64 file_size = 0; | 54 int64 file_size = 0; |
| 55 if (!base::GetFileSize(file_path, &file_size) || | 55 if (!base::GetFileSize(file_path, &file_size) || |
| 56 file_size > kMaxGDocSize) { | 56 file_size > kMaxGDocSize) { |
| 57 LOG(WARNING) << "File too large to be a GDoc file " << file_path.value(); | 57 LOG(WARNING) << "File too large to be a GDoc file " << file_path.value(); |
| 58 return std::string(); | 58 return std::string(); |
| 59 } | 59 } |
| 60 | 60 |
| 61 JSONFileValueSerializer reader(file_path); | 61 JSONFileValueDeserializer reader(file_path); |
| 62 std::string error_message; | 62 std::string error_message; |
| 63 scoped_ptr<base::Value> root_value(reader.Deserialize(NULL, &error_message)); | 63 scoped_ptr<base::Value> root_value(reader.Deserialize(NULL, &error_message)); |
| 64 if (!root_value) { | 64 if (!root_value) { |
| 65 LOG(WARNING) << "Failed to parse " << file_path.value() << " as JSON." | 65 LOG(WARNING) << "Failed to parse " << file_path.value() << " as JSON." |
| 66 << " error = " << error_message; | 66 << " error = " << error_message; |
| 67 return std::string(); | 67 return std::string(); |
| 68 } | 68 } |
| 69 | 69 |
| 70 base::DictionaryValue* dictionary_value = NULL; | 70 base::DictionaryValue* dictionary_value = NULL; |
| 71 std::string result; | 71 std::string result; |
| (...skipping 283 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 |