| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/extensions/file_manager/private_api_drive.h" | 5 #include "chrome/browser/chromeos/extensions/file_manager/private_api_drive.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/chromeos/drive/drive_integration_service.h" | 9 #include "chrome/browser/chromeos/drive/drive_integration_service.h" |
| 10 #include "chrome/browser/chromeos/extensions/file_manager/private_api_util.h" | 10 #include "chrome/browser/chromeos/extensions/file_manager/private_api_util.h" |
| (...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 895 | 895 |
| 896 FileBrowserPrivateGetDownloadUrlFunction:: | 896 FileBrowserPrivateGetDownloadUrlFunction:: |
| 897 FileBrowserPrivateGetDownloadUrlFunction() { | 897 FileBrowserPrivateGetDownloadUrlFunction() { |
| 898 } | 898 } |
| 899 | 899 |
| 900 FileBrowserPrivateGetDownloadUrlFunction:: | 900 FileBrowserPrivateGetDownloadUrlFunction:: |
| 901 ~FileBrowserPrivateGetDownloadUrlFunction() { | 901 ~FileBrowserPrivateGetDownloadUrlFunction() { |
| 902 } | 902 } |
| 903 | 903 |
| 904 bool FileBrowserPrivateGetDownloadUrlFunction::RunAsync() { | 904 bool FileBrowserPrivateGetDownloadUrlFunction::RunAsync() { |
| 905 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | |
| 906 if (!command_line->HasSwitch( | |
| 907 chromeos::switches::kEnableVideoPlayerChromecastSupport)) { | |
| 908 SetError("Cast support is disabled."); | |
| 909 SetResult(new base::StringValue("")); // Intentionally returns a blank. | |
| 910 return false; | |
| 911 } | |
| 912 | |
| 913 using extensions::api::file_browser_private::GetShareUrl::Params; | 905 using extensions::api::file_browser_private::GetShareUrl::Params; |
| 914 const scoped_ptr<Params> params(Params::Create(*args_)); | 906 const scoped_ptr<Params> params(Params::Create(*args_)); |
| 915 EXTENSION_FUNCTION_VALIDATE(params); | 907 EXTENSION_FUNCTION_VALIDATE(params); |
| 916 | 908 |
| 917 // Start getting the file info. | 909 // Start getting the file info. |
| 918 drive::FileSystemInterface* const file_system = | 910 drive::FileSystemInterface* const file_system = |
| 919 drive::util::GetFileSystemByProfile(GetProfile()); | 911 drive::util::GetFileSystemByProfile(GetProfile()); |
| 920 if (!file_system) { | 912 if (!file_system) { |
| 921 // |file_system| is NULL if Drive is disabled or not mounted. | 913 // |file_system| is NULL if Drive is disabled or not mounted. |
| 922 SetError("Drive is disabled or not mounted."); | 914 SetError("Drive is disabled or not mounted."); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 979 return; | 971 return; |
| 980 } | 972 } |
| 981 | 973 |
| 982 const std::string url = download_url_ + "?access_token=" + access_token; | 974 const std::string url = download_url_ + "?access_token=" + access_token; |
| 983 SetResult(new base::StringValue(url)); | 975 SetResult(new base::StringValue(url)); |
| 984 | 976 |
| 985 SendResponse(true); | 977 SendResponse(true); |
| 986 } | 978 } |
| 987 | 979 |
| 988 } // namespace extensions | 980 } // namespace extensions |
| OLD | NEW |