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 #include "chrome/browser/extensions/webstore_startup_installer.h"
7 #include "chrome/browser/profiles/profile.h"
8 #include "content/public/browser/web_contents.h"
10 using content::WebContents
;
12 namespace extensions
{
14 WebstoreStartupInstaller::WebstoreStartupInstaller(
15 const std::string
& webstore_item_id
,
18 const Callback
& callback
)
19 : WebstoreStandaloneInstaller(
23 show_prompt_(show_prompt
),
25 WebContents::Create(WebContents::CreateParams(profile
))) {
28 WebstoreStartupInstaller::~WebstoreStartupInstaller() {}
30 bool WebstoreStartupInstaller::CheckRequestorAlive() const {
31 // Requestor is the command line, so it's always alive.
35 const GURL
& WebstoreStartupInstaller::GetRequestorURL() const {
36 return dummy_requestor_url_
;
39 scoped_ptr
<ExtensionInstallPrompt::Prompt
>
40 WebstoreStartupInstaller::CreateInstallPrompt() const {
41 scoped_ptr
<ExtensionInstallPrompt::Prompt
> prompt
;
43 prompt
.reset(new ExtensionInstallPrompt::Prompt(
44 ExtensionInstallPrompt::INSTALL_PROMPT
));
48 scoped_ptr
<ExtensionInstallPrompt
> WebstoreStartupInstaller::CreateInstallUI() {
49 // The WebContents passed to ExtensionInstallPrompt is used to find a parent
50 // window for the dialog. This class uses a dummy WebContents and has no
51 // associated browser window. Pass NULL so the dialog is placed in the middle
53 return make_scoped_ptr(new ExtensionInstallPrompt(NULL
));
56 bool WebstoreStartupInstaller::ShouldShowPostInstallUI() const {
60 bool WebstoreStartupInstaller::ShouldShowAppInstalledBubble() const {
64 WebContents
* WebstoreStartupInstaller::GetWebContents() const {
65 return dummy_web_contents_
.get();
68 bool WebstoreStartupInstaller::CheckInlineInstallPermitted(
69 const base::DictionaryValue
& webstore_data
,
70 std::string
* error
) const {
71 // Requestor is the command line: ignore the property set in the store
72 // and always permit inline installs.
77 bool WebstoreStartupInstaller::CheckRequestorPermitted(
78 const base::DictionaryValue
& webstore_data
,
79 std::string
* error
) const {
80 // Requestor is the command line: always treat it as trusted.
86 } // namespace extensions