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.
5 #ifndef CHROME_BROWSER_CHROMEOS_FILE_MANAGER_APP_INSTALLER_H_
6 #define CHROME_BROWSER_CHROMEOS_FILE_MANAGER_APP_INSTALLER_H_
10 #include "base/memory/ref_counted.h"
11 #include "chrome/browser/extensions/webstore_standalone_installer.h"
15 } // namespace content
17 namespace file_manager {
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 {
23 AppInstaller(content::WebContents* web_contents,
24 const std::string& item_id,
26 bool silent_installation,
27 const Callback& callback);
30 friend class base::RefCountedThreadSafe<AppInstaller>;
32 virtual ~AppInstaller();
34 void OnWebContentsDestroyed(content::WebContents* web_contents);
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()
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;
52 class WebContentsObserver;
54 bool silent_installation_;
56 content::WebContents* web_contents_;
57 scoped_ptr<WebContentsObserver> web_contents_observer_;
59 DISALLOW_IMPLICIT_CONSTRUCTORS(AppInstaller);
62 } // namespace file_manager
64 #endif // CHROME_BROWSER_CHROMEOS_FILE_MANAGER_APP_INSTALLER_H_