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_EXTENSIONS_API_WEBSTORE_WIDGET_PRIVATE_APP_INSTALLER_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_WEBSTORE_WIDGET_PRIVATE_APP_INSTALLER_H_
10 #include "base/callback.h"
11 #include "base/memory/ref_counted.h"
12 #include "chrome/browser/extensions/webstore_standalone_installer.h"
16 } // namespace content
18 namespace webstore_widget
{
20 // This class is used for installing apps and extensions suggested from the
21 // Chrome Web Store Gallery widget.
22 class AppInstaller
: public extensions::WebstoreStandaloneInstaller
{
24 AppInstaller(content::WebContents
* web_contents
,
25 const std::string
& item_id
,
27 bool silent_installation
,
28 const Callback
& callback
);
31 friend class base::RefCountedThreadSafe
<AppInstaller
>;
33 ~AppInstaller() override
;
35 void OnWebContentsDestroyed(content::WebContents
* web_contents
);
37 // WebstoreStandaloneInstaller implementation.
38 bool CheckRequestorAlive() const override
;
39 const GURL
& GetRequestorURL() const override
;
40 bool ShouldShowPostInstallUI() const override
;
41 bool ShouldShowAppInstalledBubble() const override
;
42 content::WebContents
* GetWebContents() const override
;
43 scoped_refptr
<ExtensionInstallPrompt::Prompt
> CreateInstallPrompt()
45 bool CheckInlineInstallPermitted(const base::DictionaryValue
& webstore_data
,
46 std::string
* error
) const override
;
47 bool CheckRequestorPermitted(const base::DictionaryValue
& webstore_data
,
48 std::string
* error
) const override
;
51 class WebContentsObserver
;
53 bool silent_installation_
;
55 content::WebContents
* web_contents_
;
56 scoped_ptr
<WebContentsObserver
> web_contents_observer_
;
58 DISALLOW_IMPLICIT_CONSTRUCTORS(AppInstaller
);
61 } // namespace webstore_widget
63 #endif // CHROME_BROWSER_EXTENSIONS_API_WEBSTORE_WIDGET_PRIVATE_APP_INSTALLER_H_