| 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 (user_id_hash.empty() ? "" : "-" + user_id_hash), false)); | 114 (user_id_hash.empty() ? "" : "-" + user_id_hash), false)); |
| 115 } | 115 } |
| 116 | 116 |
| 117 base::FilePath GetDriveMountPointPath(Profile* profile) { | 117 base::FilePath GetDriveMountPointPath(Profile* profile) { |
| 118 std::string id = chromeos::ProfileHelper::GetUserIdHashFromProfile(profile); | 118 std::string id = chromeos::ProfileHelper::GetUserIdHashFromProfile(profile); |
| 119 if (id.empty() || id == chrome::kLegacyProfileDir) { | 119 if (id.empty() || id == chrome::kLegacyProfileDir) { |
| 120 // ProfileHelper::GetUserIdHashFromProfile works only when multi-profile is | 120 // ProfileHelper::GetUserIdHashFromProfile works only when multi-profile is |
| 121 // enabled. In that case, we fall back to use UserManager (it basically just | 121 // enabled. In that case, we fall back to use UserManager (it basically just |
| 122 // returns currently active users's hash in such a case.) I still try | 122 // returns currently active users's hash in such a case.) I still try |
| 123 // ProfileHelper first because it works better in tests. | 123 // ProfileHelper first because it works better in tests. |
| 124 user_manager::User* const user = | 124 const user_manager::User* const user = |
| 125 user_manager::UserManager::IsInitialized() | 125 user_manager::UserManager::IsInitialized() |
| 126 ? chromeos::ProfileHelper::Get()->GetUserByProfile( | 126 ? chromeos::ProfileHelper::Get()->GetUserByProfile( |
| 127 profile->GetOriginalProfile()) | 127 profile->GetOriginalProfile()) |
| 128 : NULL; | 128 : NULL; |
| 129 if (user) | 129 if (user) |
| 130 id = user->username_hash(); | 130 id = user->username_hash(); |
| 131 } | 131 } |
| 132 return GetDriveMountPointPathForUserIdHash(id); | 132 return GetDriveMountPointPathForUserIdHash(id); |
| 133 } | 133 } |
| 134 | 134 |
| (...skipping 220 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 |