OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_EXTENSIONS_WEBSTORE_REINSTALLER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_WEBSTORE_REINSTALLER_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_WEBSTORE_REINSTALLER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_WEBSTORE_REINSTALLER_H_ |
7 | 7 |
8 #include "chrome/browser/extensions/webstore_standalone_installer.h" | 8 #include "chrome/browser/extensions/webstore_standalone_installer.h" |
9 #include "content/public/browser/web_contents_observer.h" | 9 #include "content/public/browser/web_contents_observer.h" |
10 | 10 |
11 namespace extensions { | 11 namespace extensions { |
12 | 12 |
13 // Reinstalls an extension from the webstore. This will first prompt the user if | 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 | 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 | 15 // for repairing corrupted extensions), and, if the user agrees, will uninstall |
16 // the extension and reinstall it directly from the webstore. | 16 // the extension and reinstall it directly from the webstore. |
17 class WebstoreReinstaller : public WebstoreStandaloneInstaller, | 17 class WebstoreReinstaller : public WebstoreStandaloneInstaller, |
18 public content::WebContentsObserver { | 18 public content::WebContentsObserver { |
19 public: | 19 public: |
20 WebstoreReinstaller(content::WebContents* web_contents, | 20 WebstoreReinstaller(content::WebContents* web_contents, |
21 const std::string& extension_id, | 21 const std::string& extension_id, |
22 const WebstoreStandaloneInstaller::Callback& callback); | 22 const WebstoreStandaloneInstaller::Callback& callback); |
23 | 23 |
24 // Begin the reinstall process. |callback| (from the constructor) will be | 24 // Begin the reinstall process. |callback| (from the constructor) will be |
25 // called upon completion. | 25 // called upon completion. |
26 void BeginReinstall(); | 26 void BeginReinstall(); |
27 | 27 |
28 private: | 28 private: |
29 virtual ~WebstoreReinstaller(); | 29 ~WebstoreReinstaller() override; |
30 | 30 |
31 // WebstoreStandaloneInstaller: | 31 // WebstoreStandaloneInstaller: |
32 virtual bool CheckRequestorAlive() const override; | 32 bool CheckRequestorAlive() const override; |
33 virtual const GURL& GetRequestorURL() const override; | 33 const GURL& GetRequestorURL() const override; |
34 virtual bool ShouldShowPostInstallUI() const override; | 34 bool ShouldShowPostInstallUI() const override; |
35 virtual bool ShouldShowAppInstalledBubble() const override; | 35 bool ShouldShowAppInstalledBubble() const override; |
36 virtual content::WebContents* GetWebContents() const override; | 36 content::WebContents* GetWebContents() const override; |
37 virtual scoped_refptr<ExtensionInstallPrompt::Prompt> CreateInstallPrompt() | 37 scoped_refptr<ExtensionInstallPrompt::Prompt> CreateInstallPrompt() |
38 const override; | 38 const override; |
39 virtual bool CheckInlineInstallPermitted( | 39 bool CheckInlineInstallPermitted(const base::DictionaryValue& webstore_data, |
40 const base::DictionaryValue& webstore_data, | 40 std::string* error) const override; |
41 std::string* error) const override; | 41 bool CheckRequestorPermitted(const base::DictionaryValue& webstore_data, |
42 virtual bool CheckRequestorPermitted( | 42 std::string* error) const override; |
43 const base::DictionaryValue& webstore_data, | 43 void InstallUIProceed() override; |
44 std::string* error) const override; | |
45 virtual void InstallUIProceed() override; | |
46 | 44 |
47 // content::WebContentsObserver: | 45 // content::WebContentsObserver: |
48 virtual void WebContentsDestroyed() override; | 46 void WebContentsDestroyed() override; |
49 | 47 |
50 // Called once all data from the old extension installation is removed. | 48 // Called once all data from the old extension installation is removed. |
51 void OnDeletionDone(); | 49 void OnDeletionDone(); |
52 }; | 50 }; |
53 | 51 |
54 } // namespace extensions | 52 } // namespace extensions |
55 | 53 |
56 #endif // CHROME_BROWSER_EXTENSIONS_WEBSTORE_REINSTALLER_H_ | 54 #endif // CHROME_BROWSER_EXTENSIONS_WEBSTORE_REINSTALLER_H_ |
OLD | NEW |