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 (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 chromeos::User* const user = | 124 user_manager::User* const user = |
125 chromeos::UserManager::IsInitialized() | 125 chromeos::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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 const bool disable_sync_over_celluar = | 388 const bool disable_sync_over_celluar = |
389 profile->GetPrefs()->GetBoolean(prefs::kDisableDriveOverCellular); | 389 profile->GetPrefs()->GetBoolean(prefs::kDisableDriveOverCellular); |
390 | 390 |
391 if (is_connection_cellular && disable_sync_over_celluar) | 391 if (is_connection_cellular && disable_sync_over_celluar) |
392 return DRIVE_CONNECTED_METERED; | 392 return DRIVE_CONNECTED_METERED; |
393 return DRIVE_CONNECTED; | 393 return DRIVE_CONNECTED; |
394 } | 394 } |
395 | 395 |
396 } // namespace util | 396 } // namespace util |
397 } // namespace drive | 397 } // namespace drive |
OLD | NEW |