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/extensions/api/downloads_internal/downloads_internal_ap
i.h" | 5 #include "chrome/browser/extensions/api/downloads_internal/downloads_internal_ap
i.h" |
6 | 6 |
7 #include "chrome/browser/extensions/api/downloads/downloads_api.h" | 7 #include "chrome/browser/extensions/api/downloads/downloads_api.h" |
8 #include "chrome/common/extensions/api/downloads.h" | 8 #include "chrome/common/extensions/api/downloads.h" |
9 #include "chrome/common/extensions/api/downloads_internal.h" | 9 #include "chrome/common/extensions/api/downloads_internal.h" |
10 | 10 |
11 namespace extensions { | 11 namespace extensions { |
12 | 12 |
13 DownloadsInternalDetermineFilenameFunction:: | 13 DownloadsInternalDetermineFilenameFunction:: |
14 DownloadsInternalDetermineFilenameFunction() {} | 14 DownloadsInternalDetermineFilenameFunction() {} |
15 | 15 |
16 DownloadsInternalDetermineFilenameFunction:: | 16 DownloadsInternalDetermineFilenameFunction:: |
17 ~DownloadsInternalDetermineFilenameFunction() {} | 17 ~DownloadsInternalDetermineFilenameFunction() {} |
18 | 18 |
19 typedef extensions::api::downloads_internal::DetermineFilename::Params | 19 typedef extensions::api::downloads_internal::DetermineFilename::Params |
20 DetermineFilenameParams; | 20 DetermineFilenameParams; |
21 | 21 |
22 bool DownloadsInternalDetermineFilenameFunction::RunAsync() { | 22 bool DownloadsInternalDetermineFilenameFunction::RunAsync() { |
23 scoped_ptr<DetermineFilenameParams> params( | 23 std::unique_ptr<DetermineFilenameParams> params( |
24 DetermineFilenameParams::Create(*args_)); | 24 DetermineFilenameParams::Create(*args_)); |
25 EXTENSION_FUNCTION_VALIDATE(params.get()); | 25 EXTENSION_FUNCTION_VALIDATE(params.get()); |
26 base::FilePath::StringType filename; | 26 base::FilePath::StringType filename; |
27 EXTENSION_FUNCTION_VALIDATE(args_->GetString(1, &filename)); | 27 EXTENSION_FUNCTION_VALIDATE(args_->GetString(1, &filename)); |
28 return ExtensionDownloadsEventRouter::DetermineFilename( | 28 return ExtensionDownloadsEventRouter::DetermineFilename( |
29 GetProfile(), | 29 GetProfile(), |
30 include_incognito(), | 30 include_incognito(), |
31 extension()->id(), | 31 extension()->id(), |
32 params->download_id, | 32 params->download_id, |
33 base::FilePath(filename), | 33 base::FilePath(filename), |
34 extensions::api::downloads::ParseFilenameConflictAction( | 34 extensions::api::downloads::ParseFilenameConflictAction( |
35 params->conflict_action), | 35 params->conflict_action), |
36 &error_); | 36 &error_); |
37 } | 37 } |
38 | 38 |
39 } // namespace extensions | 39 } // namespace extensions |
OLD | NEW |