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

Side by Side Diff: chrome/browser/chromeos/extensions/file_browser_notifications.h

Issue 14020002: chromeos: Move chrome/browser/chromeos/extensions/file_browser* to chrome/browser/chromeos/file_man… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sort Created 7 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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.
4
5 #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_BROWSER_NOTIFICATIONS_H_
6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_BROWSER_NOTIFICATIONS_H_
7
8 #include <map>
9 #include <set>
10 #include <string>
11
12 #include "base/basictypes.h"
13 #include "base/memory/weak_ptr.h"
14 #include "base/string16.h"
15 #include "base/time.h"
16
17 class Profile;
18
19 class FileBrowserNotifications
20 : public base::SupportsWeakPtr<FileBrowserNotifications> {
21 public:
22 // If changing the enum, please also update kNotificationTypes in .cc file.
23 enum NotificationType {
24 DEVICE,
25 DEVICE_FAIL,
26 DEVICE_EXTERNAL_STORAGE_DISABLED,
27 FORMAT_START,
28 FORMAT_START_FAIL,
29 FORMAT_SUCCESS,
30 FORMAT_FAIL,
31 };
32
33 explicit FileBrowserNotifications(Profile* profile);
34 virtual ~FileBrowserNotifications();
35
36 // Registers the removable device whose mount events will be handled in
37 // |ManageNotificationsOnMountComplete|.
38 void RegisterDevice(const std::string& system_path);
39
40 // Unregisters the removable device whose mount events will be handled in
41 // |ManageNotificationsOnMountComplete|.
42 void UnregisterDevice(const std::string& system_path);
43
44 void ManageNotificationsOnMountCompleted(const std::string& system_path,
45 const std::string& label,
46 bool is_parent,
47 bool success,
48 bool is_unsupported);
49
50 void ManageNotificationOnGDataSyncProgress(int count);
51 void ManageNotificationOnGDataSyncFinish(bool success);
52
53 // Primary method for showing a notification.
54 void ShowNotification(NotificationType type, const std::string& path);
55 void ShowNotificationDelayed(NotificationType type,
56 const std::string& path,
57 base::TimeDelta delay);
58
59 // Primary method for hiding a notification. Virtual for mock in unittest.
60 virtual void HideNotification(NotificationType type, const std::string& path);
61 void HideNotificationDelayed(NotificationType type,
62 const std::string& path,
63 base::TimeDelta delay);
64
65 size_t GetNotificationCountForTest() const {
66 return notification_map_.size();
67 }
68
69 bool HasNotificationForTest(const std::string& id) const {
70 return notification_map_.find(id) != notification_map_.end();
71 }
72
73 string16 GetNotificationMessageForTest(const std::string& id) const;
74
75 private:
76 class NotificationMessage;
77 struct MountRequestsInfo;
78
79 typedef std::map<std::string, MountRequestsInfo> MountRequestsMap;
80 typedef std::map<std::string, NotificationMessage*> NotificationMap;
81
82 // Virtual for mock in unittest.
83 virtual void ShowNotificationWithMessage(NotificationType type,
84 const std::string& path,
85 const string16& message);
86 void ShowNotificationById(NotificationType type,
87 const std::string& notification_id,
88 const string16& message);
89 void HideNotificationById(const std::string& notification_id);
90 void RemoveNotificationById(const std::string& notification_id);
91
92 NotificationMap notification_map_;
93 std::set<std::string> hidden_notifications_;
94 MountRequestsMap mount_requests_;
95 Profile* profile_;
96
97 DISALLOW_COPY_AND_ASSIGN(FileBrowserNotifications);
98 };
99
100 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_BROWSER_NOTIFICATIONS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698