NaCl: Update revision in DEPS, r12770 -> r12773
[chromium-blink-merge.git] / chrome / browser / extensions / webstore_startup_installer.h
blob4d96bf0697b46b28169ee224b839f3ee45490c9d
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_EXTENSIONS_WEBSTORE_STARTUP_INSTALLER_H_
6 #define CHROME_BROWSER_EXTENSIONS_WEBSTORE_STARTUP_INSTALLER_H_
8 #include "url/gurl.h"
9 #include "webstore_standalone_installer.h"
11 namespace content {
12 class WebContents;
15 namespace extensions {
17 // Manages inline installs requested to be performed at startup, e.g. via a
18 // command line option: downloads and parses metadata from the webstore,
19 // optionally shows an install UI, starts the download once the user
20 // confirms.
22 // Clients will be notified of success or failure via the |callback| argument
23 // passed into the constructor.
24 class WebstoreStartupInstaller
25 : public WebstoreStandaloneInstaller {
26 public:
27 typedef WebstoreStandaloneInstaller::Callback Callback;
29 WebstoreStartupInstaller(const std::string& webstore_item_id,
30 Profile* profile,
31 bool show_prompt,
32 const Callback& callback);
34 protected:
35 friend class base::RefCountedThreadSafe<WebstoreStartupInstaller>;
36 FRIEND_TEST_ALL_PREFIXES(WebstoreStartupInstallerTest, DomainVerification);
38 virtual ~WebstoreStartupInstaller();
40 // Implementations 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>
47 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;
56 private:
57 bool show_prompt_;
58 GURL dummy_requestor_url_;
60 // A non-visible WebContents used to download data from the webstore.
61 scoped_ptr<content::WebContents> dummy_web_contents_;
63 DISALLOW_IMPLICIT_CONSTRUCTORS(WebstoreStartupInstaller);
66 } // namespace extensions
68 #endif // CHROME_BROWSER_EXTENSIONS_WEBSTORE_STARTUP_INSTALLER_H_