| Index: chrome/browser/chromeos/drive/file_system_util.cc
|
| diff --git a/chrome/browser/chromeos/drive/file_system_util.cc b/chrome/browser/chromeos/drive/file_system_util.cc
|
| index f9b56fadc2e8ec9e731ae1f57bb66fb7c9ff9192..dfb867202b73a348f8a25c8d0964d99d8875a221 100644
|
| --- a/chrome/browser/chromeos/drive/file_system_util.cc
|
| +++ b/chrome/browser/chromeos/drive/file_system_util.cc
|
| @@ -389,5 +389,27 @@ bool IsDriveEnabledForProfile(Profile* profile) {
|
| return true;
|
| }
|
|
|
| +ConnectionStatusType GetDriveConnectionStatus(Profile* profile) {
|
| + drive::DriveServiceInterface* const drive_service =
|
| + drive::util::GetDriveServiceByProfile(profile);
|
| +
|
| + if (!drive_service)
|
| + return DRIVE_DISCONNECTED_NOSERVICE;
|
| + if (net::NetworkChangeNotifier::IsOffline())
|
| + return DRIVE_DISCONNECTED_NONETWORK;
|
| + if (!drive_service->CanSendRequest())
|
| + return DRIVE_DISCONNECTED_NOTREADY;
|
| +
|
| + const bool is_connection_cellular =
|
| + net::NetworkChangeNotifier::IsConnectionCellular(
|
| + net::NetworkChangeNotifier::GetConnectionType());
|
| + const bool disable_sync_over_celluar =
|
| + profile->GetPrefs()->GetBoolean(prefs::kDisableDriveOverCellular);
|
| +
|
| + if (is_connection_cellular && disable_sync_over_celluar)
|
| + return DRIVE_CONNECTED_METERED;
|
| + return DRIVE_CONNECTED;
|
| +}
|
| +
|
| } // namespace util
|
| } // namespace drive
|
|
|