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