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