Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / extensions / webstore_startup_installer.h
blobb89195bc943812967b87bf954681d5a7dd459556
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 bool CheckInlineInstallPermitted(
49 const base::DictionaryValue& webstore_data,
50 std::string* error) const OVERRIDE;
51 virtual bool CheckRequestorPermitted(
52 const base::DictionaryValue& webstore_data,
53 std::string* error) const OVERRIDE;
55 private:
56 bool show_prompt_;
57 GURL dummy_requestor_url_;
58 scoped_ptr<content::WebContents> dummy_web_contents_;
60 DISALLOW_IMPLICIT_CONSTRUCTORS(WebstoreStartupInstaller);
63 } // namespace extensions
65 #endif // CHROME_BROWSER_EXTENSIONS_WEBSTORE_STARTUP_INSTALLER_H_