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
3 // found in the LICENSE file.
5 #include "chrome/browser/extensions/api/downloads_internal/downloads_internal_api.h"
7 #include "chrome/browser/extensions/api/downloads/downloads_api.h"
8 #include "chrome/common/extensions/api/downloads.h"
9 #include "chrome/common/extensions/api/downloads_internal.h"
11 namespace extensions
{
13 DownloadsInternalDetermineFilenameFunction::
14 DownloadsInternalDetermineFilenameFunction() {}
16 DownloadsInternalDetermineFilenameFunction::
17 ~DownloadsInternalDetermineFilenameFunction() {}
19 typedef extensions::api::downloads_internal::DetermineFilename::Params
20 DetermineFilenameParams
;
22 bool DownloadsInternalDetermineFilenameFunction::RunAsync() {
23 scoped_ptr
<DetermineFilenameParams
> params(
24 DetermineFilenameParams::Create(*args_
));
25 EXTENSION_FUNCTION_VALIDATE(params
.get());
26 base::FilePath::StringType filename
;
27 EXTENSION_FUNCTION_VALIDATE(args_
->GetString(1, &filename
));
28 return ExtensionDownloadsEventRouter::DetermineFilename(
33 base::FilePath(filename
),
34 extensions::api::downloads::ParseFilenameConflictAction(
35 params
->conflict_action
),
39 } // namespace extensions