Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(416)

Unified Diff: content/browser/android/mock_download_controller_android.h

Issue 1217223006: Prompt user for file access permission before download starts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressing asanka's comments Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/android/mock_download_controller_android.h
diff --git a/content/browser/android/mock_download_controller_android.h b/content/browser/android/mock_download_controller_android.h
new file mode 100644
index 0000000000000000000000000000000000000000..bfdb16d9a919087d2ed715badb0cc11ac26694ed
--- /dev/null
+++ b/content/browser/android/mock_download_controller_android.h
@@ -0,0 +1,46 @@
+// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_BROWSER_ANDROID_MOCK_DOWNLOAD_CONTROLLER_ANDROID_H_
+#define CONTENT_BROWSER_ANDROID_MOCK_DOWNLOAD_CONTROLLER_ANDROID_H_
+
+#include "base/callback.h"
+#include "base/memory/singleton.h"
+#include "content/public/browser/android/download_controller_android.h"
+
+namespace content {
+class DownloadItem;
+class WebContents;
+
+// Mock implementation of the DownloadControllerAndroid.
+class MockDownloadControllerAndroid : public DownloadControllerAndroid {
+ public:
+ static MockDownloadControllerAndroid* GetInstance();
+
+ // DownloadControllerAndroid implementation.
+ void CreateGETDownload(int render_process_id, int render_view_id,
+ int request_id) override;
+ void OnDownloadStarted(DownloadItem* download_item) override;
+ void StartContextMenuDownload(
+ const ContextMenuParams& params, WebContents* web_contents,
+ bool is_link, const std::string& extra_headers) override;
+ void DangerousDownloadValidated(
+ WebContents* web_contents, int download_id, bool accept) override;
+ void AcquireFileAccessPermission(
+ WebContents* web_contents,
+ const AcquireFileAccessPermissionCallback& callback) override;
+ void SetApproveFileAccessRequestForTesting(bool approve) override;
+
+ private:
+ friend struct DefaultSingletonTraits<MockDownloadControllerAndroid>;
+ MockDownloadControllerAndroid();
+ ~MockDownloadControllerAndroid() override;
+
+ bool approve_file_access_request_;
+ DISALLOW_COPY_AND_ASSIGN(MockDownloadControllerAndroid);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_ANDROID_MOCK_DOWNLOAD_CONTROLLER_ANDROID_H_

Powered by Google App Engine
This is Rietveld 408576698