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

Unified Diff: chrome/browser/download/download_test_file_chooser_observer.h

Issue 10855116: Move DownloadTestObserver and friends down into content. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Incorporated comments. Created 8 years, 4 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: chrome/browser/download/download_test_file_chooser_observer.h
diff --git a/chrome/browser/download/download_test_file_chooser_observer.h b/chrome/browser/download/download_test_file_chooser_observer.h
new file mode 100644
index 0000000000000000000000000000000000000000..9380065e581a7824531af38102fb47a0b2ec80e0
--- /dev/null
+++ b/chrome/browser/download/download_test_file_chooser_observer.h
@@ -0,0 +1,42 @@
+// Copyright (c) 2012 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 CHROME_BROWSER_DOWNLOAD_DOWNLOAD_TEST_FILE_CHOOSER_OBSERVER_H_
+#define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_TEST_FILE_CHOOSER_OBSERVER_H_
+
+#include "base/memory/ref_counted.h"
+
+class Profile;
+
+namespace internal {
+class MockFileChooserDownloadManagerDelegate;
+}
+
+// Observes and overrides file chooser activity for a profile. By default, once
+// attached to a profile, this class overrides the default file chooser by
+// replacing the ChromeDownloadManagerDelegate associated with |profile|.
+// NOTE: Again, this overrides the ChromeDownloadManagerDelegate for |profile|.
+class DownloadTestFileChooserObserver {
+ public:
+ // Attaches to |profile|. By default file chooser dialogs will be disabled
+ // once attached. Call EnableFileChooser() to re-enable.
+ explicit DownloadTestFileChooserObserver(Profile* profile);
+ ~DownloadTestFileChooserObserver();
+
+ // Sets whether the file chooser dialog is enabled. If |enable| is false, any
+ // attempt to display a file chooser dialog will cause the download to be
+ // canceled. Otherwise, attempting to display a file chooser dialog will
+ // result in the download continuing with the suggested path.
+ void EnableFileChooser(bool enable);
+
+ // Returns true if a file chooser dialog was displayed since the last time
+ // this method was called.
+ bool TestAndResetDidShowFileChooser();
+
+ private:
+ scoped_refptr<internal::MockFileChooserDownloadManagerDelegate>
+ test_delegate_;
+};
+
+#endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_TEST_FILE_CHOOSER_OBSERVER_H_
« no previous file with comments | « chrome/browser/download/download_browsertest.cc ('k') | chrome/browser/download/download_test_file_chooser_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698