Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / browser / extensions / api / webstore_widget_private / app_installer.h
blob805cbaad16aec06b44f9d139e04254f2d2d8767e
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_
8 #include <string>
10 #include "base/callback.h"
11 #include "base/memory/ref_counted.h"
12 #include "chrome/browser/extensions/webstore_standalone_installer.h"
14 namespace content {
15 class WebContents;
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 {
23 public:
24 AppInstaller(content::WebContents* web_contents,
25 const std::string& item_id,
26 Profile* profile,
27 bool silent_installation,
28 const Callback& callback);
30 protected:
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()
44 const override;
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;
50 private:
51 class WebContentsObserver;
53 bool silent_installation_;
54 Callback callback_;
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_