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 const base::CommandLine* command_line = |
| 906 base::CommandLine::ForCurrentProcess(); |
| 907 if (!command_line->HasSwitch( |
| 908 chromeos::switches::kEnableVideoPlayerChromecastSupport)) { |
| 909 SetError("Cast support is disabled."); |
| 910 SetResult(new base::StringValue("")); // Intentionally returns a blank. |
| 911 return false; |
| 912 } |
| 913 |
905 using extensions::api::file_browser_private::GetShareUrl::Params; | 914 using extensions::api::file_browser_private::GetShareUrl::Params; |
906 const scoped_ptr<Params> params(Params::Create(*args_)); | 915 const scoped_ptr<Params> params(Params::Create(*args_)); |
907 EXTENSION_FUNCTION_VALIDATE(params); | 916 EXTENSION_FUNCTION_VALIDATE(params); |
908 | 917 |
909 // Start getting the file info. | 918 // Start getting the file info. |
910 drive::FileSystemInterface* const file_system = | 919 drive::FileSystemInterface* const file_system = |
911 drive::util::GetFileSystemByProfile(GetProfile()); | 920 drive::util::GetFileSystemByProfile(GetProfile()); |
912 if (!file_system) { | 921 if (!file_system) { |
913 // |file_system| is NULL if Drive is disabled or not mounted. | 922 // |file_system| is NULL if Drive is disabled or not mounted. |
914 SetError("Drive is disabled or not mounted."); | 923 SetError("Drive is disabled or not mounted."); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
975 return; | 984 return; |
976 } | 985 } |
977 | 986 |
978 const std::string url = download_url_ + "?access_token=" + access_token; | 987 const std::string url = download_url_ + "?access_token=" + access_token; |
979 SetResult(new base::StringValue(url)); | 988 SetResult(new base::StringValue(url)); |
980 | 989 |
981 SendResponse(true); | 990 SendResponse(true); |
982 } | 991 } |
983 | 992 |
984 } // namespace extensions | 993 } // namespace extensions |
OLD | NEW |