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_
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"
24 namespace message_center {
26 } // namespace message_center
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 {
37 NotificationManager(Profile* profile,
38 const ProvidedFileSystemInfo& file_system_info);
39 virtual ~NotificationManager();
41 // NotificationManagerInterface overrides:
42 virtual void ShowUnresponsiveNotification(
44 const NotificationCallback& callback) OVERRIDE;
45 virtual 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 failed to show up.
53 // Invoked when the notification got closed either by user or by system.
56 // extensions::AppIconLoader::Delegate overrides:
57 virtual void SetAppImage(const std::string& id,
58 const gfx::ImageSkia& image) OVERRIDE;
61 typedef std::map<int, NotificationCallback> CallbackMap;
63 // Creates a notification object for the actual state of the manager.
64 scoped_ptr<message_center::Notification> CreateNotification();
66 // Handles a notification result by calling all registered callbacks and
68 void OnNotificationResult(NotificationResult result);
70 Profile* profile_; // Not owned.
71 ProvidedFileSystemInfo file_system_info_;
72 CallbackMap callbacks_;
73 scoped_ptr<extensions::AppIconLoader> icon_loader_;
74 scoped_ptr<gfx::Image> extension_icon_;
76 DISALLOW_COPY_AND_ASSIGN(NotificationManager);
79 } // namespace file_system_provider
80 } // namespace chromeos
82 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_NOTIFICATION_MANAGER_H_