Adding instrumentation to locate the source of jankiness
[chromium-blink-merge.git] / chrome / browser / extensions / webstore_reinstaller.h
blobaaea5707e247d03521db782610b828c8ec4e9907
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 {
19 public:
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();
28 private:
29 virtual ~WebstoreReinstaller();
31 // WebstoreStandaloneInstaller:
32 virtual bool CheckRequestorAlive() const override;
33 virtual const GURL& GetRequestorURL() const override;
34 virtual bool ShouldShowPostInstallUI() const override;
35 virtual bool ShouldShowAppInstalledBubble() const override;
36 virtual content::WebContents* GetWebContents() const override;
37 virtual scoped_refptr<ExtensionInstallPrompt::Prompt> CreateInstallPrompt()
38 const override;
39 virtual bool CheckInlineInstallPermitted(
40 const base::DictionaryValue& webstore_data,
41 std::string* error) const override;
42 virtual bool CheckRequestorPermitted(
43 const base::DictionaryValue& webstore_data,
44 std::string* error) const override;
45 virtual void InstallUIProceed() override;
47 // content::WebContentsObserver:
48 virtual void WebContentsDestroyed() override;
50 // Called once all data from the old extension installation is removed.
51 void OnDeletionDone();
54 } // namespace extensions
56 #endif // CHROME_BROWSER_EXTENSIONS_WEBSTORE_REINSTALLER_H_