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

Side by Side Diff: chrome/browser/extensions/webstore_install_prompt.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 tapted's review comments Created 6 years, 7 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
(Empty)
1 // Copyright 2014 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.
4
5 #include "chrome/browser/extensions/webstore_install_prompt.h"
6
7 #include "chrome/browser/extensions/webstore_installer.h"
8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/ui/browser.h"
10 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h"
11 #include "content/public/browser/web_contents.h"
12
13 using content::WebContents;
14
15 namespace extensions {
16
17 WebstoreInstallPrompt::WebstoreInstallPrompt(
18 const std::string& webstore_item_id,
19 Profile* profile,
20 const Callback& callback)
21 : WebstoreStandaloneInstaller(webstore_item_id, profile, callback),
22 dummy_web_contents_(
23 WebContents::Create(WebContents::CreateParams(profile))),
24 parent_window_(NULL) {
25 set_install_source(WebstoreInstaller::INSTALL_SOURCE_OTHER);
26 }
27
28 WebstoreInstallPrompt::WebstoreInstallPrompt(
29 const std::string& webstore_item_id,
30 Profile* profile,
31 gfx::NativeWindow parent_window,
32 const Callback& callback)
33 : WebstoreStandaloneInstaller(webstore_item_id, profile, callback),
34 dummy_web_contents_(
35 WebContents::Create(WebContents::CreateParams(profile))),
36 parent_window_(parent_window) {
37 DCHECK(parent_window);
38 set_install_source(WebstoreInstaller::INSTALL_SOURCE_OTHER);
39 }
40
41 WebstoreInstallPrompt::~WebstoreInstallPrompt() {
42 }
43
44 bool WebstoreInstallPrompt::CheckRequestorAlive() const {
45 // Assume the requestor is always alive.
46 return true;
47 }
48
49 const GURL& WebstoreInstallPrompt::GetRequestorURL() const {
50 return dummy_requestor_url_;
51 }
52
53 scoped_ptr<ExtensionInstallPrompt::Prompt>
54 WebstoreInstallPrompt::CreateInstallPrompt() const {
55 scoped_ptr<ExtensionInstallPrompt::Prompt> prompt(
56 new ExtensionInstallPrompt::Prompt(
57 ExtensionInstallPrompt::INSTALL_PROMPT));
58 return prompt.Pass();
59 }
60
61 scoped_ptr<ExtensionInstallPrompt> WebstoreInstallPrompt::CreateInstallUI() {
62 // Create an ExtensionInstallPrompt. If the parent window is NULL, the dialog
63 // will be placed in the middle of the screen.
64 return make_scoped_ptr(
65 new ExtensionInstallPrompt(profile(), parent_window_, this));
66 }
67
68 bool WebstoreInstallPrompt::ShouldShowPostInstallUI() const {
69 return false;
70 }
71
72 bool WebstoreInstallPrompt::ShouldShowAppInstalledBubble() const {
73 return false;
74 }
75
76 WebContents* WebstoreInstallPrompt::GetWebContents() const {
77 return dummy_web_contents_.get();
78 }
79
80 bool WebstoreInstallPrompt::CheckInlineInstallPermitted(
81 const base::DictionaryValue& webstore_data,
82 std::string* error) const {
83 // Assume the requestor is trusted.
84 *error = std::string();
85 return true;
86 }
87
88 bool WebstoreInstallPrompt::CheckRequestorPermitted(
89 const base::DictionaryValue& webstore_data,
90 std::string* error) const {
91 // Assume the requestor is trusted.
92 *error = std::string();
93 return true;
94 }
95
96 content::WebContents* WebstoreInstallPrompt::OpenURL(
97 const content::OpenURLParams& params) {
98 chrome::ScopedTabbedBrowserDisplayer displayer(profile(),
99 chrome::GetActiveDesktop());
100 return displayer.browser()->OpenURL(params);
101 }
102
103 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698