1 // Copyright 2014 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_WEBSTORE_REINSTALLER_H_
6 #define CHROME_BROWSER_EXTENSIONS_WEBSTORE_REINSTALLER_H_
8 #include "chrome/browser/extensions/webstore_standalone_installer.h"
9 #include "content/public/browser/web_contents_observer.h"
11 namespace extensions
{
13 // Reinstalls an extension from the webstore. This will first prompt the user if
14 // they want to reinstall (using the verbase "Repair", since this is our action
15 // for repairing corrupted extensions), and, if the user agrees, will uninstall
16 // the extension and reinstall it directly from the webstore.
17 class WebstoreReinstaller
: public WebstoreStandaloneInstaller
,
18 public content::WebContentsObserver
{
20 WebstoreReinstaller(content::WebContents
* web_contents
,
21 const std::string
& extension_id
,
22 const WebstoreStandaloneInstaller::Callback
& callback
);
24 // Begin the reinstall process. |callback| (from the constructor) will be
25 // called upon completion.
26 void BeginReinstall();
29 ~WebstoreReinstaller() override
;
31 // WebstoreStandaloneInstaller:
32 bool CheckRequestorAlive() const override
;
33 const GURL
& GetRequestorURL() const override
;
34 bool ShouldShowPostInstallUI() const override
;
35 bool ShouldShowAppInstalledBubble() const override
;
36 content::WebContents
* GetWebContents() const override
;
37 scoped_refptr
<ExtensionInstallPrompt::Prompt
> CreateInstallPrompt()
39 bool CheckInlineInstallPermitted(const base::DictionaryValue
& webstore_data
,
40 std::string
* error
) const override
;
41 bool CheckRequestorPermitted(const base::DictionaryValue
& webstore_data
,
42 std::string
* error
) const override
;
43 void InstallUIProceed() override
;
45 // content::WebContentsObserver:
46 void WebContentsDestroyed() override
;
48 // Called once all data from the old extension installation is removed.
49 void OnDeletionDone();
52 } // namespace extensions
54 #endif // CHROME_BROWSER_EXTENSIONS_WEBSTORE_REINSTALLER_H_