BookmarkManager: Fix 'new folder text field size changes on clicking it' issue.
[chromium-blink-merge.git] / chrome / browser / download / download_service.h
blobb492ee9ae28d270f2cbea4acc9fa4914d6f6c975
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 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SERVICE_H_
6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SERVICE_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "components/keyed_service/core/keyed_service.h"
11 class ChromeDownloadManagerDelegate;
12 class DownloadHistory;
13 class ExtensionDownloadsEventRouter;
14 class Profile;
16 namespace content {
17 class DownloadManager;
20 namespace extensions {
21 class ExtensionDownloadsEventRouter;
24 // Abstract base class for the download service; see DownloadServiceImpl for
25 // implementation.
26 class DownloadService : public KeyedService {
27 public:
28 DownloadService();
29 ~DownloadService() override;
31 // Get the download manager delegate, creating it if it doesn't already exist.
32 virtual ChromeDownloadManagerDelegate* GetDownloadManagerDelegate() = 0;
34 // Get the interface to the history system. Returns NULL if profile is
35 // incognito or if the DownloadManager hasn't been created yet or if there is
36 // no HistoryService for profile. Virtual for testing.
37 virtual DownloadHistory* GetDownloadHistory() = 0;
39 #if defined(ENABLE_EXTENSIONS)
40 virtual extensions::ExtensionDownloadsEventRouter*
41 GetExtensionEventRouter() = 0;
42 #endif
44 // Has a download manager been created?
45 virtual bool HasCreatedDownloadManager() = 0;
47 // Number of non-malicious downloads associated with this instance of the
48 // service.
49 virtual int NonMaliciousDownloadCount() const = 0;
51 // Cancels all in-progress downloads for this profile.
52 virtual void CancelDownloads() = 0;
54 // Number of non-malicious downloads associated with all profiles.
55 static int NonMaliciousDownloadCountAllProfiles();
57 // Cancels all in-progress downloads for all profiles.
58 static void CancelAllDownloads();
60 // Sets the DownloadManagerDelegate associated with this object and
61 // its DownloadManager. Takes ownership of |delegate|, and destroys
62 // the previous delegate. For testing.
63 virtual void SetDownloadManagerDelegateForTesting(
64 scoped_ptr<ChromeDownloadManagerDelegate> delegate) = 0;
66 // Returns false if at least one extension has disabled the shelf, true
67 // otherwise.
68 virtual bool IsShelfEnabled() = 0;
70 private:
71 DISALLOW_COPY_AND_ASSIGN(DownloadService);
74 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SERVICE_H_