| 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/drive_sync_client.h" | 5 #include "chrome/browser/chromeos/drive/drive_sync_client.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/message_loop_proxy.h" | 11 #include "base/message_loop_proxy.h" |
| 12 #include "chrome/browser/api/prefs/pref_change_registrar.h" | 12 #include "chrome/browser/api/prefs/pref_change_registrar.h" |
| 13 #include "chrome/browser/chromeos/drive/drive.pb.h" | 13 #include "chrome/browser/chromeos/drive/drive.pb.h" |
| 14 #include "chrome/browser/chromeos/drive/drive_file_system_interface.h" | 14 #include "chrome/browser/chromeos/drive/drive_file_system_interface.h" |
| 15 #include "chrome/browser/chromeos/drive/drive_file_system_util.h" | |
| 16 #include "chrome/browser/chromeos/drive/drive_sync_client_observer.h" | 15 #include "chrome/browser/chromeos/drive/drive_sync_client_observer.h" |
| 17 #include "chrome/browser/prefs/pref_service.h" | 16 #include "chrome/browser/prefs/pref_service.h" |
| 18 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 19 #include "chrome/common/pref_names.h" | 18 #include "chrome/common/pref_names.h" |
| 20 #include "content/public/browser/browser_thread.h" | 19 #include "content/public/browser/browser_thread.h" |
| 21 | 20 |
| 22 using content::BrowserThread; | 21 using content::BrowserThread; |
| 23 | 22 |
| 24 namespace drive { | 23 namespace drive { |
| 25 | 24 |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 if (profile_->GetPrefs()->GetBoolean(prefs::kDisableDrive)) | 197 if (profile_->GetPrefs()->GetBoolean(prefs::kDisableDrive)) |
| 199 return true; | 198 return true; |
| 200 | 199 |
| 201 // Should stop if the network is not online. | 200 // Should stop if the network is not online. |
| 202 if (net::NetworkChangeNotifier::IsOffline()) | 201 if (net::NetworkChangeNotifier::IsOffline()) |
| 203 return true; | 202 return true; |
| 204 | 203 |
| 205 // Should stop if the current connection is on cellular network, and | 204 // Should stop if the current connection is on cellular network, and |
| 206 // fetching is disabled over cellular. | 205 // fetching is disabled over cellular. |
| 207 if (profile_->GetPrefs()->GetBoolean(prefs::kDisableDriveOverCellular) && | 206 if (profile_->GetPrefs()->GetBoolean(prefs::kDisableDriveOverCellular) && |
| 208 util::IsConnectionTypeCellular()) | 207 net::NetworkChangeNotifier::IsConnectionCellular( |
| 208 net::NetworkChangeNotifier::GetConnectionType())) |
| 209 return true; | 209 return true; |
| 210 | 210 |
| 211 return false; | 211 return false; |
| 212 } | 212 } |
| 213 | 213 |
| 214 void DriveSyncClient::OnInitialLoadFinished(DriveFileError error) { | 214 void DriveSyncClient::OnInitialLoadFinished(DriveFileError error) { |
| 215 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 215 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 216 | 216 |
| 217 StartProcessingBacklog(); | 217 StartProcessingBacklog(); |
| 218 } | 218 } |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 447 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 448 | 448 |
| 449 // Resume the sync loop if the network is back online. Note that we don't | 449 // Resume the sync loop if the network is back online. Note that we don't |
| 450 // need to check the type of the network as it will be checked in | 450 // need to check the type of the network as it will be checked in |
| 451 // ShouldStopSyncLoop() as soon as the loop is resumed. | 451 // ShouldStopSyncLoop() as soon as the loop is resumed. |
| 452 if (!net::NetworkChangeNotifier::IsOffline()) | 452 if (!net::NetworkChangeNotifier::IsOffline()) |
| 453 StartSyncLoop(); | 453 StartSyncLoop(); |
| 454 } | 454 } |
| 455 | 455 |
| 456 } // namespace drive | 456 } // namespace drive |
| OLD | NEW |