Chromium Code Reviews| 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/sync_file_system/drive_file_sync_util.h" | 5 #include "chrome/browser/sync_file_system/drive_file_sync_util.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "chrome/browser/sync_file_system/logger.h" | |
| 9 | 10 |
| 10 namespace sync_file_system { | 11 namespace sync_file_system { |
| 11 | 12 |
| 12 namespace { | 13 namespace { |
| 13 | 14 |
| 14 // A command switch to enable Drive API instead of WAPI in Sync FileSystem API. | 15 // A command switch to enable Drive API instead of WAPI in Sync FileSystem API. |
| 15 // (http://crbug.com/234557) | 16 // (http://crbug.com/234557) |
| 16 // TODO(nhiroki): this command-line switch should be temporary. | 17 // TODO(nhiroki): this command-line switch should be temporary. |
| 17 const char kEnableDriveAPI[] = "enable-drive-api-for-syncfs"; | 18 const char kEnableDriveAPI[] = "enable-drive-api-for-syncfs"; |
| 18 | 19 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 69 return SYNC_FILE_ERROR_NO_SPACE; | 70 return SYNC_FILE_ERROR_NO_SPACE; |
| 70 } | 71 } |
| 71 | 72 |
| 72 // There's a case where DriveService layer returns GDataErrorCode==-1 | 73 // There's a case where DriveService layer returns GDataErrorCode==-1 |
| 73 // when network is unavailable. (http://crbug.com/223042) | 74 // when network is unavailable. (http://crbug.com/223042) |
| 74 // TODO(kinuko,nhiroki): We should identify from where this undefined error | 75 // TODO(kinuko,nhiroki): We should identify from where this undefined error |
| 75 // code is coming. | 76 // code is coming. |
| 76 if (error == -1) | 77 if (error == -1) |
| 77 return SYNC_STATUS_NETWORK_ERROR; | 78 return SYNC_STATUS_NETWORK_ERROR; |
| 78 | 79 |
| 79 LOG(WARNING) << "Got unexpected error: " << error; | 80 LOG(WARNING) << "Got unexpected error: " << error; |
|
nhiroki
2013/05/22 05:42:40
Can you also change this logging code?
calvinlo
2013/05/22 08:42:56
Done.
| |
| 80 return SYNC_STATUS_FAILED; | 81 return SYNC_STATUS_FAILED; |
| 81 } | 82 } |
| 82 | 83 |
| 83 void SetEnableDriveAPI(bool flag) { | 84 void SetEnableDriveAPI(bool flag) { |
| 84 is_drive_api_enabled = flag; | 85 is_drive_api_enabled = flag; |
| 85 } | 86 } |
| 86 | 87 |
| 87 bool IsDriveAPIEnabled() { | 88 bool IsDriveAPIEnabled() { |
| 88 return is_drive_api_enabled || | 89 return is_drive_api_enabled || |
| 89 CommandLine::ForCurrentProcess()->HasSwitch(kEnableDriveAPI); | 90 CommandLine::ForCurrentProcess()->HasSwitch(kEnableDriveAPI); |
| 90 } | 91 } |
| 91 | 92 |
| 92 } // namespace sync_file_system | 93 } // namespace sync_file_system |
| OLD | NEW |