Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / extensions / api / downloads_internal / downloads_internal_api.cc
blob164986bbfb4701804cf103651fe41d36437d8c48
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(
29 GetProfile(),
30 include_incognito(),
31 extension()->id(),
32 params->download_id,
33 base::FilePath(filename),
34 extensions::api::downloads::ParseFilenameConflictAction(
35 params->conflict_action),
36 &error_);
39 } // namespace extensions