Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(238)

Side by Side Diff: chrome/browser/extensions/webstore_startup_installer.cc

Issue 298303002: Add option to install an ephemeral app to ChromeOS shelf context menu (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed asargent's review comments Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "chrome/browser/extensions/webstore_startup_installer.h" 5 #include "chrome/browser/extensions/webstore_startup_installer.h"
6 6
7 #include "chrome/browser/profiles/profile.h"
8 #include "content/public/browser/web_contents.h"
9
10 using content::WebContents;
11
12 namespace extensions { 7 namespace extensions {
13 8
14 WebstoreStartupInstaller::WebstoreStartupInstaller( 9 WebstoreStartupInstaller::WebstoreStartupInstaller(
15 const std::string& webstore_item_id, 10 const std::string& webstore_item_id,
16 Profile* profile, 11 Profile* profile,
17 bool show_prompt, 12 bool show_prompt,
18 const Callback& callback) 13 const Callback& callback)
19 : WebstoreStandaloneInstaller( 14 : WebstoreInstallWithPrompt(webstore_item_id, profile, callback),
20 webstore_item_id, 15 show_prompt_(show_prompt) {
21 profile, 16 set_install_source(WebstoreInstaller::INSTALL_SOURCE_INLINE);
22 callback),
23 show_prompt_(show_prompt),
24 dummy_web_contents_(
25 WebContents::Create(WebContents::CreateParams(profile))) {
26 } 17 }
27 18
28 WebstoreStartupInstaller::~WebstoreStartupInstaller() {} 19 WebstoreStartupInstaller::~WebstoreStartupInstaller() {}
29 20
30 bool WebstoreStartupInstaller::CheckRequestorAlive() const {
31 // Requestor is the command line, so it's always alive.
32 return true;
33 }
34
35 const GURL& WebstoreStartupInstaller::GetRequestorURL() const {
36 return dummy_requestor_url_;
37 }
38
39 scoped_ptr<ExtensionInstallPrompt::Prompt> 21 scoped_ptr<ExtensionInstallPrompt::Prompt>
40 WebstoreStartupInstaller::CreateInstallPrompt() const { 22 WebstoreStartupInstaller::CreateInstallPrompt() const {
41 scoped_ptr<ExtensionInstallPrompt::Prompt> prompt; 23 scoped_ptr<ExtensionInstallPrompt::Prompt> prompt;
42 if (show_prompt_) 24 if (show_prompt_) {
43 prompt.reset(new ExtensionInstallPrompt::Prompt( 25 prompt.reset(new ExtensionInstallPrompt::Prompt(
44 ExtensionInstallPrompt::INSTALL_PROMPT)); 26 ExtensionInstallPrompt::INSTALL_PROMPT));
27 }
45 return prompt.Pass(); 28 return prompt.Pass();
46 } 29 }
47 30
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
52 // of the screen.
53 return make_scoped_ptr(new ExtensionInstallPrompt(NULL));
54 }
55
56 bool WebstoreStartupInstaller::ShouldShowPostInstallUI() const {
57 return false;
58 }
59
60 bool WebstoreStartupInstaller::ShouldShowAppInstalledBubble() const {
61 return false;
62 }
63
64 WebContents* WebstoreStartupInstaller::GetWebContents() const {
65 return dummy_web_contents_.get();
66 }
67
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.
73 *error = "";
74 return true;
75 }
76
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.
81 *error = "";
82 return true;
83 }
84
85
86 } // namespace extensions 31 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698