- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / browser / extensions / webstore_ephemeral_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_EXTENSIONS_WEBSTORE_EPHEMERAL_INSTALLER_H_
6 #define CHROME_BROWSER_EXTENSIONS_WEBSTORE_EPHEMERAL_INSTALLER_H_
7
8 #include <string>
9
10 #include "base/basictypes.h"
11 #include "chrome/browser/extensions/webstore_standalone_installer.h"
12
13 class Profile;
14
15 namespace content {
16 class WebContents;
17 }
18
19 namespace extensions {
20
21 // WebstoreEphemeralInstaller handles the installation of ephemeral apps.
22 class WebstoreEphemeralInstaller
23     : public extensions::WebstoreStandaloneInstaller {
24  public:
25   typedef WebstoreStandaloneInstaller::Callback Callback;
26
27   static scoped_refptr<WebstoreEphemeralInstaller> CreateForLauncher(
28       const std::string& webstore_item_id,
29       Profile* profile,
30       gfx::NativeWindow parent_window,
31       const Callback& callback);
32
33  private:
34   friend class base::RefCountedThreadSafe<WebstoreEphemeralInstaller>;
35
36   WebstoreEphemeralInstaller(const std::string& webstore_item_id,
37                              Profile* profile,
38                              gfx::NativeWindow parent_window,
39                              const Callback& callback);
40
41   virtual ~WebstoreEphemeralInstaller();
42
43   // WebstoreStandaloneInstaller implementation.
44   virtual bool CheckRequestorAlive() const OVERRIDE;
45   virtual const GURL& GetRequestorURL() const OVERRIDE;
46   virtual bool ShouldShowPostInstallUI() const OVERRIDE;
47   virtual bool ShouldShowAppInstalledBubble() const OVERRIDE;
48   virtual content::WebContents* GetWebContents() const OVERRIDE;
49   virtual scoped_ptr<ExtensionInstallPrompt::Prompt>
50       CreateInstallPrompt() const OVERRIDE;
51   virtual bool CheckInlineInstallPermitted(
52       const base::DictionaryValue& webstore_data,
53       std::string* error) const OVERRIDE;
54   virtual bool CheckRequestorPermitted(
55       const base::DictionaryValue& webstore_data,
56       std::string* error) const OVERRIDE;
57   virtual scoped_ptr<ExtensionInstallPrompt> CreateInstallUI() OVERRIDE;
58
59   gfx::NativeWindow parent_window_;
60   scoped_ptr<content::WebContents> dummy_web_contents_;
61
62   DISALLOW_COPY_AND_ASSIGN(WebstoreEphemeralInstaller);
63 };
64
65 }  // namespace extensions
66
67 #endif  // CHROME_BROWSER_EXTENSIONS_WEBSTORE_EPHEMERAL_INSTALLER_H_