OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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_install_with_prompt.h" | 5 #include "chrome/browser/extensions/webstore_install_with_prompt.h" |
6 | 6 |
7 #include "chrome/browser/extensions/webstore_installer.h" | 7 #include "chrome/browser/extensions/webstore_installer.h" |
8 #include "chrome/browser/profiles/profile.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" | 9 #include "content/public/browser/web_contents.h" |
12 | 10 |
13 using content::WebContents; | 11 using content::WebContents; |
14 | 12 |
15 namespace extensions { | 13 namespace extensions { |
16 | 14 |
17 WebstoreInstallWithPrompt::WebstoreInstallWithPrompt( | 15 WebstoreInstallWithPrompt::WebstoreInstallWithPrompt( |
18 const std::string& webstore_item_id, | 16 const std::string& webstore_item_id, |
19 Profile* profile, | 17 Profile* profile, |
20 const Callback& callback) | 18 const Callback& callback) |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 scoped_refptr<ExtensionInstallPrompt::Prompt> | 53 scoped_refptr<ExtensionInstallPrompt::Prompt> |
56 WebstoreInstallWithPrompt::CreateInstallPrompt() const { | 54 WebstoreInstallWithPrompt::CreateInstallPrompt() const { |
57 return new ExtensionInstallPrompt::Prompt( | 55 return new ExtensionInstallPrompt::Prompt( |
58 ExtensionInstallPrompt::INSTALL_PROMPT); | 56 ExtensionInstallPrompt::INSTALL_PROMPT); |
59 } | 57 } |
60 | 58 |
61 scoped_ptr<ExtensionInstallPrompt> | 59 scoped_ptr<ExtensionInstallPrompt> |
62 WebstoreInstallWithPrompt::CreateInstallUI() { | 60 WebstoreInstallWithPrompt::CreateInstallUI() { |
63 // Create an ExtensionInstallPrompt. If the parent window is NULL, the dialog | 61 // Create an ExtensionInstallPrompt. If the parent window is NULL, the dialog |
64 // will be placed in the middle of the screen. | 62 // will be placed in the middle of the screen. |
65 return make_scoped_ptr( | 63 return make_scoped_ptr(new ExtensionInstallPrompt(profile(), parent_window_)); |
66 new ExtensionInstallPrompt(profile(), parent_window_, this)); | |
67 } | 64 } |
68 | 65 |
69 bool WebstoreInstallWithPrompt::ShouldShowPostInstallUI() const { | 66 bool WebstoreInstallWithPrompt::ShouldShowPostInstallUI() const { |
70 return show_post_install_ui_; | 67 return show_post_install_ui_; |
71 } | 68 } |
72 | 69 |
73 bool WebstoreInstallWithPrompt::ShouldShowAppInstalledBubble() const { | 70 bool WebstoreInstallWithPrompt::ShouldShowAppInstalledBubble() const { |
74 return false; | 71 return false; |
75 } | 72 } |
76 | 73 |
(...skipping 10 matching lines...) Expand all Loading... |
87 } | 84 } |
88 | 85 |
89 bool WebstoreInstallWithPrompt::CheckRequestorPermitted( | 86 bool WebstoreInstallWithPrompt::CheckRequestorPermitted( |
90 const base::DictionaryValue& webstore_data, | 87 const base::DictionaryValue& webstore_data, |
91 std::string* error) const { | 88 std::string* error) const { |
92 // Assume the requestor is trusted. | 89 // Assume the requestor is trusted. |
93 *error = std::string(); | 90 *error = std::string(); |
94 return true; | 91 return true; |
95 } | 92 } |
96 | 93 |
97 content::WebContents* WebstoreInstallWithPrompt::OpenURL( | |
98 const content::OpenURLParams& params) { | |
99 chrome::ScopedTabbedBrowserDisplayer displayer(profile(), | |
100 chrome::GetActiveDesktop()); | |
101 return displayer.browser()->OpenURL(params); | |
102 } | |
103 | |
104 } // namespace extensions | 94 } // namespace extensions |
OLD | NEW |