| 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_file_system_util.h" | 5 #include "chrome/browser/chromeos/drive/drive_file_system_util.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 #include "chrome/browser/ui/browser.h" | 27 #include "chrome/browser/ui/browser.h" |
| 28 #include "chrome/browser/ui/browser_finder.h" | 28 #include "chrome/browser/ui/browser_finder.h" |
| 29 #include "chrome/common/chrome_version_info.h" | 29 #include "chrome/common/chrome_version_info.h" |
| 30 #include "chrome/common/pref_names.h" | 30 #include "chrome/common/pref_names.h" |
| 31 #include "chrome/common/url_constants.h" | 31 #include "chrome/common/url_constants.h" |
| 32 #include "net/base/escape.h" | 32 #include "net/base/escape.h" |
| 33 #include "net/base/network_change_notifier.h" | 33 #include "net/base/network_change_notifier.h" |
| 34 | 34 |
| 35 using content::BrowserThread; | 35 using content::BrowserThread; |
| 36 | 36 |
| 37 namespace gdata { | 37 namespace drive { |
| 38 namespace util { | 38 namespace util { |
| 39 | 39 |
| 40 namespace { | 40 namespace { |
| 41 | 41 |
| 42 const char kDriveSpecialRootPath[] = "/special"; | 42 const char kDriveSpecialRootPath[] = "/special"; |
| 43 | 43 |
| 44 const char kDriveMountPointPath[] = "/special/drive"; | 44 const char kDriveMountPointPath[] = "/special/drive"; |
| 45 | 45 |
| 46 const FilePath::CharType* kDriveMountPointPathComponents[] = { | 46 const FilePath::CharType* kDriveMountPointPathComponents[] = { |
| 47 "/", "special", "drive" | 47 "/", "special", "drive" |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 ExtractDrivePath(directory), | 411 ExtractDrivePath(directory), |
| 412 true /* is_exclusive */, | 412 true /* is_exclusive */, |
| 413 true /* is_recursive */, | 413 true /* is_recursive */, |
| 414 callback); | 414 callback); |
| 415 } else { | 415 } else { |
| 416 base::MessageLoopProxy::current()->PostTask( | 416 base::MessageLoopProxy::current()->PostTask( |
| 417 FROM_HERE, base::Bind(callback, DRIVE_FILE_OK)); | 417 FROM_HERE, base::Bind(callback, DRIVE_FILE_OK)); |
| 418 } | 418 } |
| 419 } | 419 } |
| 420 | 420 |
| 421 DriveFileError GDataToDriveFileError(GDataErrorCode status) { | 421 DriveFileError GDataToDriveFileError(gdata::GDataErrorCode status) { |
| 422 switch (status) { | 422 switch (status) { |
| 423 case HTTP_SUCCESS: | 423 case gdata::HTTP_SUCCESS: |
| 424 case HTTP_CREATED: | 424 case gdata::HTTP_CREATED: |
| 425 return DRIVE_FILE_OK; | 425 return DRIVE_FILE_OK; |
| 426 case HTTP_UNAUTHORIZED: | 426 case gdata::HTTP_UNAUTHORIZED: |
| 427 case HTTP_FORBIDDEN: | 427 case gdata::HTTP_FORBIDDEN: |
| 428 return DRIVE_FILE_ERROR_ACCESS_DENIED; | 428 return DRIVE_FILE_ERROR_ACCESS_DENIED; |
| 429 case HTTP_NOT_FOUND: | 429 case gdata::HTTP_NOT_FOUND: |
| 430 return DRIVE_FILE_ERROR_NOT_FOUND; | 430 return DRIVE_FILE_ERROR_NOT_FOUND; |
| 431 case GDATA_PARSE_ERROR: | 431 case gdata::GDATA_PARSE_ERROR: |
| 432 case GDATA_FILE_ERROR: | 432 case gdata::GDATA_FILE_ERROR: |
| 433 return DRIVE_FILE_ERROR_ABORT; | 433 return DRIVE_FILE_ERROR_ABORT; |
| 434 case GDATA_NO_CONNECTION: | 434 case gdata::GDATA_NO_CONNECTION: |
| 435 return DRIVE_FILE_ERROR_NO_CONNECTION; | 435 return DRIVE_FILE_ERROR_NO_CONNECTION; |
| 436 default: | 436 default: |
| 437 return DRIVE_FILE_ERROR_FAILED; | 437 return DRIVE_FILE_ERROR_FAILED; |
| 438 } | 438 } |
| 439 } | 439 } |
| 440 | 440 |
| 441 bool IsConnectionTypeCellular() { | 441 bool IsConnectionTypeCellular() { |
| 442 bool is_cellular = false; | 442 bool is_cellular = false; |
| 443 // Use switch, not if, to allow compiler to catch future enum changes. | 443 // Use switch, not if, to allow compiler to catch future enum changes. |
| 444 // (e.g. Addition of CONNECTION_5G) | 444 // (e.g. Addition of CONNECTION_5G) |
| 445 switch (net::NetworkChangeNotifier::GetConnectionType()) { | 445 switch (net::NetworkChangeNotifier::GetConnectionType()) { |
| 446 case net::NetworkChangeNotifier::CONNECTION_2G: | 446 case net::NetworkChangeNotifier::CONNECTION_2G: |
| 447 case net::NetworkChangeNotifier::CONNECTION_3G: | 447 case net::NetworkChangeNotifier::CONNECTION_3G: |
| 448 case net::NetworkChangeNotifier::CONNECTION_4G: | 448 case net::NetworkChangeNotifier::CONNECTION_4G: |
| 449 is_cellular = true; | 449 is_cellular = true; |
| 450 break; | 450 break; |
| 451 case net::NetworkChangeNotifier::CONNECTION_UNKNOWN: | 451 case net::NetworkChangeNotifier::CONNECTION_UNKNOWN: |
| 452 case net::NetworkChangeNotifier::CONNECTION_ETHERNET: | 452 case net::NetworkChangeNotifier::CONNECTION_ETHERNET: |
| 453 case net::NetworkChangeNotifier::CONNECTION_WIFI: | 453 case net::NetworkChangeNotifier::CONNECTION_WIFI: |
| 454 case net::NetworkChangeNotifier::CONNECTION_NONE: | 454 case net::NetworkChangeNotifier::CONNECTION_NONE: |
| 455 is_cellular = false; | 455 is_cellular = false; |
| 456 break; | 456 break; |
| 457 } | 457 } |
| 458 return is_cellular; | 458 return is_cellular; |
| 459 } | 459 } |
| 460 | 460 |
| 461 } // namespace util | 461 } // namespace util |
| 462 } // namespace gdata | 462 } // namespace drive |
| OLD | NEW |