Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / extensions / api / file_system / request_file_system_notification.h
blobb53880573c92f6754460113af8ad2019fcc8b2bc
1 // Copyright 2015 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_EXTENSIONS_API_FILE_SYSTEM_REQUEST_FILE_SYSTEM_NOTIFICATION_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_REQUEST_FILE_SYSTEM_NOTIFICATION_H_
8 #include <string>
10 #include "base/callback.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/weak_ptr.h"
13 #include "chrome/browser/extensions/app_icon_loader.h"
14 #include "ui/message_center/notification_delegate.h"
16 class Profile;
18 namespace extensions {
19 class Extension;
20 } // namespace extensions
22 namespace file_manager {
23 class Volume;
24 } // namespace file_manager
26 namespace gfx {
27 class Image;
28 class ImageSkia;
29 } // namespace gfx
31 namespace message_center {
32 class Notification;
33 } // namespace message_center
35 // Shows notifications for the chrome.fileSystem.requestFileSystem() API.
36 class RequestFileSystemNotification
37 : public message_center::NotificationDelegate,
38 public extensions::AppIconLoader::Delegate {
39 public:
40 // Shows a notification about automatically granted access to a file system.
41 static void ShowAutoGrantedNotification(
42 Profile* profile,
43 const extensions::Extension& extension,
44 const base::WeakPtr<file_manager::Volume>& volume,
45 bool writable);
47 private:
48 RequestFileSystemNotification(Profile* profile,
49 const extensions::Extension& extension);
50 ~RequestFileSystemNotification() override;
52 // Shows the notification. Can be called only once.
53 void Show(scoped_ptr<message_center::Notification> notification);
55 // extensions::AppIconLoader::Delegate overrides:
56 void SetAppImage(const std::string& id, const gfx::ImageSkia& image) override;
58 scoped_ptr<extensions::AppIconLoader> icon_loader_;
59 scoped_ptr<gfx::Image> extension_icon_;
60 scoped_ptr<message_center::Notification> pending_notification_;
62 DISALLOW_COPY_AND_ASSIGN(RequestFileSystemNotification);
65 #endif // CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_REQUEST_FILE_SYSTEM_NOTIFICATION_H_