| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_STARTUP_INSTALLER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_WEBSTORE_STARTUP_INSTALLER_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_WEBSTORE_STARTUP_INSTALLER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_WEBSTORE_STARTUP_INSTALLER_H_ |
| 7 | 7 |
| 8 #include "url/gurl.h" | 8 #include "chrome/browser/extensions/webstore_install_prompt.h" |
| 9 #include "webstore_standalone_installer.h" | |
| 10 | |
| 11 namespace content { | |
| 12 class WebContents; | |
| 13 } | |
| 14 | 9 |
| 15 namespace extensions { | 10 namespace extensions { |
| 16 | 11 |
| 17 // Manages inline installs requested to be performed at startup, e.g. via a | 12 // Manages inline installs requested to be performed at startup, e.g. via a |
| 18 // command line option: downloads and parses metadata from the webstore, | 13 // command line option: downloads and parses metadata from the webstore, |
| 19 // optionally shows an install UI, starts the download once the user | 14 // optionally shows an install UI, starts the download once the user |
| 20 // confirms. | 15 // confirms. |
| 21 // | 16 // |
| 22 // Clients will be notified of success or failure via the |callback| argument | 17 // Clients will be notified of success or failure via the |callback| argument |
| 23 // passed into the constructor. | 18 // passed into the constructor. |
| 24 class WebstoreStartupInstaller | 19 class WebstoreStartupInstaller : public WebstoreInstallPrompt { |
| 25 : public WebstoreStandaloneInstaller { | |
| 26 public: | 20 public: |
| 27 typedef WebstoreStandaloneInstaller::Callback Callback; | |
| 28 | |
| 29 WebstoreStartupInstaller(const std::string& webstore_item_id, | 21 WebstoreStartupInstaller(const std::string& webstore_item_id, |
| 30 Profile* profile, | 22 Profile* profile, |
| 31 bool show_prompt, | 23 bool show_prompt, |
| 32 const Callback& callback); | 24 const Callback& callback); |
| 33 | 25 |
| 34 protected: | 26 protected: |
| 35 friend class base::RefCountedThreadSafe<WebstoreStartupInstaller>; | 27 friend class base::RefCountedThreadSafe<WebstoreStartupInstaller>; |
| 36 FRIEND_TEST_ALL_PREFIXES(WebstoreStartupInstallerTest, DomainVerification); | 28 FRIEND_TEST_ALL_PREFIXES(WebstoreStartupInstallerTest, DomainVerification); |
| 37 | 29 |
| 38 virtual ~WebstoreStartupInstaller(); | 30 virtual ~WebstoreStartupInstaller(); |
| 39 | 31 |
| 40 // Implementations WebstoreStandaloneInstaller Template Method's hooks. | 32 // Implementations of WebstoreStandaloneInstaller Template Method's hooks. |
| 41 virtual bool CheckRequestorAlive() const OVERRIDE; | |
| 42 virtual const GURL& GetRequestorURL() const OVERRIDE; | |
| 43 virtual bool ShouldShowPostInstallUI() const OVERRIDE; | |
| 44 virtual bool ShouldShowAppInstalledBubble() const OVERRIDE; | |
| 45 virtual content::WebContents* GetWebContents() const OVERRIDE; | |
| 46 virtual scoped_ptr<ExtensionInstallPrompt::Prompt> | 33 virtual scoped_ptr<ExtensionInstallPrompt::Prompt> |
| 47 CreateInstallPrompt() const OVERRIDE; | 34 CreateInstallPrompt() const OVERRIDE; |
| 48 virtual scoped_ptr<ExtensionInstallPrompt> CreateInstallUI() OVERRIDE; | |
| 49 virtual bool CheckInlineInstallPermitted( | |
| 50 const base::DictionaryValue& webstore_data, | |
| 51 std::string* error) const OVERRIDE; | |
| 52 virtual bool CheckRequestorPermitted( | |
| 53 const base::DictionaryValue& webstore_data, | |
| 54 std::string* error) const OVERRIDE; | |
| 55 | 35 |
| 56 private: | 36 private: |
| 57 bool show_prompt_; | 37 bool show_prompt_; |
| 58 GURL dummy_requestor_url_; | |
| 59 | |
| 60 // A non-visible WebContents used to download data from the webstore. | |
| 61 scoped_ptr<content::WebContents> dummy_web_contents_; | |
| 62 | 38 |
| 63 DISALLOW_IMPLICIT_CONSTRUCTORS(WebstoreStartupInstaller); | 39 DISALLOW_IMPLICIT_CONSTRUCTORS(WebstoreStartupInstaller); |
| 64 }; | 40 }; |
| 65 | 41 |
| 66 } // namespace extensions | 42 } // namespace extensions |
| 67 | 43 |
| 68 #endif // CHROME_BROWSER_EXTENSIONS_WEBSTORE_STARTUP_INSTALLER_H_ | 44 #endif // CHROME_BROWSER_EXTENSIONS_WEBSTORE_STARTUP_INSTALLER_H_ |
| OLD | NEW |