Revert of Add button to add new FSP services to Files app. (patchset #8 id:140001...
[chromium-blink-merge.git] / chrome / browser / chromeos / file_system_provider / notification_manager.h
bloba344ea8540398f60c98f03eac94bccc2c3e1a640
1 // Copyright 2014 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_CHROMEOS_FILE_SYSTEM_PROVIDER_NOTIFICATION_MANAGER_H_
6 #define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_NOTIFICATION_MANAGER_H_
8 #include <map>
9 #include <string>
11 #include "base/callback.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "chrome/browser/chromeos/file_system_provider/notification_manager_interface.h"
14 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_info.h"
15 #include "chrome/browser/extensions/app_icon_loader.h"
17 class Profile;
19 namespace gfx {
20 class Image;
21 class ImageSkia;
22 } // message gfx
24 namespace message_center {
25 class Notification;
26 } // namespace message_center
28 namespace chromeos {
29 namespace file_system_provider {
31 // Provided file systems's manager for showing notifications. Shows always
32 // up to one notification. If more than one request is unresponsive, then
33 // all of them will be aborted when clicking on the notification button.
34 class NotificationManager : public NotificationManagerInterface,
35 public extensions::AppIconLoader::Delegate {
36 public:
37 NotificationManager(Profile* profile,
38 const ProvidedFileSystemInfo& file_system_info);
39 ~NotificationManager() override;
41 // NotificationManagerInterface overrides:
42 void ShowUnresponsiveNotification(
43 int id,
44 const NotificationCallback& callback) override;
45 void HideUnresponsiveNotification(int id) override;
47 // Invoked when a button on the notification is clicked.
48 void OnButtonClick(int button_index);
50 // Invoked when the notification got closed either by user or by system.
51 void OnClose();
53 // extensions::AppIconLoader::Delegate overrides:
54 void SetAppImage(const std::string& id, const gfx::ImageSkia& image) override;
56 private:
57 typedef std::map<int, NotificationCallback> CallbackMap;
59 // Creates a notification object for the actual state of the manager.
60 scoped_ptr<message_center::Notification> CreateNotification();
62 // Handles a notification result by calling all registered callbacks and
63 // clearing the list.
64 void OnNotificationResult(NotificationResult result);
66 ProvidedFileSystemInfo file_system_info_;
67 CallbackMap callbacks_;
68 scoped_ptr<extensions::AppIconLoader> icon_loader_;
69 scoped_ptr<gfx::Image> extension_icon_;
71 DISALLOW_COPY_AND_ASSIGN(NotificationManager);
74 } // namespace file_system_provider
75 } // namespace chromeos
77 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_NOTIFICATION_MANAGER_H_