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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 return SYNC_FILE_ERROR_NO_SPACE; | 71 return SYNC_FILE_ERROR_NO_SPACE; |
71 } | 72 } |
72 | 73 |
73 // There's a case where DriveService layer returns GDataErrorCode==-1 | 74 // There's a case where DriveService layer returns GDataErrorCode==-1 |
74 // when network is unavailable. (http://crbug.com/223042) | 75 // when network is unavailable. (http://crbug.com/223042) |
75 // TODO(kinuko,nhiroki): We should identify from where this undefined error | 76 // TODO(kinuko,nhiroki): We should identify from where this undefined error |
76 // code is coming. | 77 // code is coming. |
77 if (error == -1) | 78 if (error == -1) |
78 return SYNC_STATUS_NETWORK_ERROR; | 79 return SYNC_STATUS_NETWORK_ERROR; |
79 | 80 |
80 LOG(WARNING) << "Got unexpected error: " << error; | 81 util::Log(logging::LOG_WARNING, |
| 82 FROM_HERE, |
| 83 "Got unexpected error: %d", |
| 84 static_cast<int>(error)); |
81 return SYNC_STATUS_FAILED; | 85 return SYNC_STATUS_FAILED; |
82 } | 86 } |
83 | 87 |
84 void SetEnableDriveAPI(bool flag) { | 88 void SetEnableDriveAPI(bool flag) { |
85 is_drive_api_enabled = flag; | 89 is_drive_api_enabled = flag; |
86 } | 90 } |
87 | 91 |
88 bool IsDriveAPIEnabled() { | 92 bool IsDriveAPIEnabled() { |
89 return is_drive_api_enabled || | 93 return is_drive_api_enabled || |
90 CommandLine::ForCurrentProcess()->HasSwitch(kEnableDriveAPI); | 94 CommandLine::ForCurrentProcess()->HasSwitch(kEnableDriveAPI); |
91 } | 95 } |
92 | 96 |
93 } // namespace sync_file_system | 97 } // namespace sync_file_system |
OLD | NEW |