- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / browser / chromeos / file_manager / file_manager_installer.h
1 // Copyright 2013 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_FILE_MANAGER_FILE_MANAGER_INSTALLER_H_
6 #define CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FILE_MANAGER_INSTALLER_H_
7
8 #include <string>
9
10 #include "base/memory/ref_counted.h"
11 #include "chrome/browser/extensions/webstore_standalone_installer.h"
12 #include "content/public/browser/web_contents_observer.h"
13
14 namespace content {
15 class WebContents;
16 }
17
18 namespace file_manager {
19
20 // Installer for Files.app.
21 class FileManagerInstaller
22     : public extensions::WebstoreStandaloneInstaller {
23  public:
24   typedef extensions::WebstoreStandaloneInstaller::Callback Callback;
25
26   FileManagerInstaller(content::WebContents* web_contents,
27                        const std::string& webstore_item_id,
28                        Profile* profile,
29                        const Callback& callback);
30
31  protected:
32   friend class base::RefCountedThreadSafe<FileManagerInstaller>;
33
34   virtual ~FileManagerInstaller();
35
36   void OnWebContentsDestroyed(content::WebContents* web_contents);
37
38   // WebstoreStandaloneInstaller implementation.
39   virtual bool CheckRequestorAlive() const OVERRIDE;
40   virtual const GURL& GetRequestorURL() const OVERRIDE;
41   virtual bool ShouldShowPostInstallUI() const OVERRIDE;
42   virtual bool ShouldShowAppInstalledBubble() const OVERRIDE;
43   virtual content::WebContents* GetWebContents() const OVERRIDE;
44   virtual scoped_ptr<ExtensionInstallPrompt::Prompt>
45       CreateInstallPrompt() const OVERRIDE;
46   virtual bool CheckInlineInstallPermitted(
47       const base::DictionaryValue& webstore_data,
48       std::string* error) const OVERRIDE;
49   virtual bool CheckRequestorPermitted(
50       const base::DictionaryValue& webstore_data,
51       std::string* error) const OVERRIDE;
52
53  private:
54   class WebContentsObserver;
55
56   Callback callback_;
57   content::WebContents* web_contents_;
58   scoped_ptr<WebContentsObserver> web_contents_observer_;
59
60   DISALLOW_IMPLICIT_CONSTRUCTORS(FileManagerInstaller);
61 };
62
63 }  // namespace file_manager
64
65 #endif  // CHROME_BROWSER_CHROMEOS_FILE_MANAGER_FILE_MANAGER_INSTALLER_H_