blob: 114f85ec694b67777959d08887c7548b0746cded (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/extensions/webstore_startup_installer.h"
#include "chrome/browser/profiles/profile.h"
#include "content/public/browser/web_contents.h"
using content::WebContents;
namespace extensions {
WebstoreStartupInstaller::WebstoreStartupInstaller(
const std::string& webstore_item_id,
Profile* profile,
bool show_prompt,
const Callback& callback)
: WebstoreStandaloneInstaller(
webstore_item_id,
profile,
callback),
show_prompt_(show_prompt),
dummy_web_contents_(
WebContents::Create(WebContents::CreateParams(profile))) {
}
WebstoreStartupInstaller::~WebstoreStartupInstaller() {}
bool WebstoreStartupInstaller::CheckRequestorAlive() const {
// Requestor is the command line, so it's always alive.
return true;
}
const GURL& WebstoreStartupInstaller::GetRequestorURL() const {
return dummy_requestor_url_;
}
scoped_ptr<ExtensionInstallPrompt::Prompt>
WebstoreStartupInstaller::CreateInstallPrompt() const {
scoped_ptr<ExtensionInstallPrompt::Prompt> prompt;
if (show_prompt_)
prompt.reset(new ExtensionInstallPrompt::Prompt(
ExtensionInstallPrompt::INSTALL_PROMPT));
return prompt.Pass();
}
bool WebstoreStartupInstaller::ShouldShowPostInstallUI() const {
return false;
}
bool WebstoreStartupInstaller::ShouldShowAppInstalledBubble() const {
return false;
}
WebContents* WebstoreStartupInstaller::GetWebContents() const {
return dummy_web_contents_.get();
}
bool WebstoreStartupInstaller::CheckInlineInstallPermitted(
const base::DictionaryValue& webstore_data,
std::string* error) const {
// Requestor is the command line: ignore the property set in the store
// and always permit inline installs.
*error = "";
return true;
}
bool WebstoreStartupInstaller::CheckRequestorPermitted(
const base::DictionaryValue& webstore_data,
std::string* error) const {
// Requestor is the command line: always treat it as trusted.
*error = "";
return true;
}
} // namespace extensions
|