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 ~NotificationManager() override
;
41 // NotificationManagerInterface overrides:
42 void ShowUnresponsiveNotification(
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.
53 // extensions::AppIconLoader::Delegate overrides:
54 void SetAppImage(const std::string
& id
, const gfx::ImageSkia
& image
) override
;
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
64 void OnNotificationResult(NotificationResult result
);
67 ProvidedFileSystemInfo file_system_info_
;
68 CallbackMap callbacks_
;
69 scoped_ptr
<extensions::AppIconLoader
> icon_loader_
;
70 scoped_ptr
<gfx::Image
> extension_icon_
;
72 DISALLOW_COPY_AND_ASSIGN(NotificationManager
);
75 } // namespace file_system_provider
76 } // namespace chromeos
78 #endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_NOTIFICATION_MANAGER_H_