| 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 } | 114 } |
| 115 | 115 |
| 116 base::FilePath GetDriveMountPointPath(Profile* profile) { | 116 base::FilePath GetDriveMountPointPath(Profile* profile) { |
| 117 std::string id = chromeos::ProfileHelper::GetUserIdHashFromProfile(profile); | 117 std::string id = chromeos::ProfileHelper::GetUserIdHashFromProfile(profile); |
| 118 if (id.empty() || id == chrome::kLegacyProfileDir) { | 118 if (id.empty() || id == chrome::kLegacyProfileDir) { |
| 119 // ProfileHelper::GetUserIdHashFromProfile works only when multi-profile is | 119 // ProfileHelper::GetUserIdHashFromProfile works only when multi-profile is |
| 120 // enabled. In that case, we fall back to use UserManager (it basically just | 120 // enabled. In that case, we fall back to use UserManager (it basically just |
| 121 // returns currently active users's hash in such a case.) I still try | 121 // returns currently active users's hash in such a case.) I still try |
| 122 // ProfileHelper first because it works better in tests. | 122 // ProfileHelper first because it works better in tests. |
| 123 user_manager::User* const user = | 123 user_manager::User* const user = |
| 124 chromeos::UserManager::IsInitialized() | 124 user_manager::UserManager::IsInitialized() |
| 125 ? chromeos::ProfileHelper::Get()->GetUserByProfile( | 125 ? chromeos::ProfileHelper::Get()->GetUserByProfile( |
| 126 profile->GetOriginalProfile()) | 126 profile->GetOriginalProfile()) |
| 127 : NULL; | 127 : NULL; |
| 128 if (user) | 128 if (user) |
| 129 id = user->username_hash(); | 129 id = user->username_hash(); |
| 130 } | 130 } |
| 131 return GetDriveMountPointPathForUserIdHash(id); | 131 return GetDriveMountPointPathForUserIdHash(id); |
| 132 } | 132 } |
| 133 | 133 |
| 134 FileSystemInterface* GetFileSystemByProfile(Profile* profile) { | 134 FileSystemInterface* GetFileSystemByProfile(Profile* profile) { |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 const bool disable_sync_over_celluar = | 382 const bool disable_sync_over_celluar = |
| 383 profile->GetPrefs()->GetBoolean(prefs::kDisableDriveOverCellular); | 383 profile->GetPrefs()->GetBoolean(prefs::kDisableDriveOverCellular); |
| 384 | 384 |
| 385 if (is_connection_cellular && disable_sync_over_celluar) | 385 if (is_connection_cellular && disable_sync_over_celluar) |
| 386 return DRIVE_CONNECTED_METERED; | 386 return DRIVE_CONNECTED_METERED; |
| 387 return DRIVE_CONNECTED; | 387 return DRIVE_CONNECTED; |
| 388 } | 388 } |
| 389 | 389 |
| 390 } // namespace util | 390 } // namespace util |
| 391 } // namespace drive | 391 } // namespace drive |
| OLD | NEW |