Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / chromeos / file_manager / app_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_APP_INSTALLER_H_
6 #define CHROME_BROWSER_CHROMEOS_FILE_MANAGER_APP_INSTALLER_H_
7
8 #include <string>
9
10 #include "base/memory/ref_counted.h"
11 #include "chrome/browser/extensions/webstore_standalone_installer.h"
12
13 namespace content {
14 class WebContents;
15 }  // namespace content
16
17 namespace file_manager {
18
19 // This class is used for installing apps and extensions suggested from the
20 // Chrome Web Store for unsupported file types, inside Files.app.
21 class AppInstaller : public extensions::WebstoreStandaloneInstaller {
22  public:
23   AppInstaller(content::WebContents* web_contents,
24                const std::string& item_id,
25                Profile* profile,
26                bool silent_installation,
27                const Callback& callback);
28
29  protected:
30   friend class base::RefCountedThreadSafe<AppInstaller>;
31
32   virtual ~AppInstaller();
33
34   void OnWebContentsDestroyed(content::WebContents* web_contents);
35
36   // WebstoreStandaloneInstaller implementation.
37   virtual bool CheckRequestorAlive() const override;
38   virtual const GURL& GetRequestorURL() const override;
39   virtual bool ShouldShowPostInstallUI() const override;
40   virtual bool ShouldShowAppInstalledBubble() const override;
41   virtual content::WebContents* GetWebContents() const override;
42   virtual scoped_refptr<ExtensionInstallPrompt::Prompt> CreateInstallPrompt()
43       const override;
44   virtual bool CheckInlineInstallPermitted(
45       const base::DictionaryValue& webstore_data,
46       std::string* error) const override;
47   virtual bool CheckRequestorPermitted(
48       const base::DictionaryValue& webstore_data,
49       std::string* error) const override;
50
51  private:
52   class WebContentsObserver;
53
54   bool silent_installation_;
55   Callback callback_;
56   content::WebContents* web_contents_;
57   scoped_ptr<WebContentsObserver> web_contents_observer_;
58
59   DISALLOW_IMPLICIT_CONSTRUCTORS(AppInstaller);
60 };
61
62 }  // namespace file_manager
63
64 #endif  // CHROME_BROWSER_CHROMEOS_FILE_MANAGER_APP_INSTALLER_H_