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 "content/public/browser/web_contents.h" | 9 #include "content/public/browser/web_contents.h" |
| 10 #include "content/public/browser/web_contents_source.h" |
10 | 11 |
11 using content::WebContents; | 12 using content::WebContents; |
12 | 13 |
13 namespace extensions { | 14 namespace extensions { |
14 | 15 |
15 WebstoreInstallWithPrompt::WebstoreInstallWithPrompt( | 16 WebstoreInstallWithPrompt::WebstoreInstallWithPrompt( |
16 const std::string& webstore_item_id, | 17 const std::string& webstore_item_id, |
17 Profile* profile, | 18 Profile* profile, |
18 const Callback& callback) | 19 const Callback& callback) |
19 : WebstoreStandaloneInstaller(webstore_item_id, profile, callback), | 20 : WebstoreStandaloneInstaller(webstore_item_id, profile, callback), |
20 show_post_install_ui_(true), | 21 show_post_install_ui_(true), |
21 dummy_web_contents_( | 22 dummy_web_contents_( |
22 WebContents::Create(WebContents::CreateParams(profile))), | 23 WebContents::Create(WebContents::CreateParams(profile))), |
23 parent_window_(NULL) { | 24 parent_window_(NULL) { |
| 25 WebContentsSource::CreateForWebContentsAndLocation(dummy_web_contents_.get(), |
| 26 FROM_HERE); |
24 set_install_source(WebstoreInstaller::INSTALL_SOURCE_OTHER); | 27 set_install_source(WebstoreInstaller::INSTALL_SOURCE_OTHER); |
25 } | 28 } |
26 | 29 |
27 WebstoreInstallWithPrompt::WebstoreInstallWithPrompt( | 30 WebstoreInstallWithPrompt::WebstoreInstallWithPrompt( |
28 const std::string& webstore_item_id, | 31 const std::string& webstore_item_id, |
29 Profile* profile, | 32 Profile* profile, |
30 gfx::NativeWindow parent_window, | 33 gfx::NativeWindow parent_window, |
31 const Callback& callback) | 34 const Callback& callback) |
32 : WebstoreStandaloneInstaller(webstore_item_id, profile, callback), | 35 : WebstoreStandaloneInstaller(webstore_item_id, profile, callback), |
33 show_post_install_ui_(true), | 36 show_post_install_ui_(true), |
34 dummy_web_contents_( | 37 dummy_web_contents_( |
35 WebContents::Create(WebContents::CreateParams(profile))), | 38 WebContents::Create(WebContents::CreateParams(profile))), |
36 parent_window_(parent_window) { | 39 parent_window_(parent_window) { |
| 40 WebContentsSource::CreateForWebContentsAndLocation(dummy_web_contents_.get(), |
| 41 FROM_HERE); |
37 if (parent_window_) | 42 if (parent_window_) |
38 parent_window_tracker_ = NativeWindowTracker::Create(parent_window); | 43 parent_window_tracker_ = NativeWindowTracker::Create(parent_window); |
39 set_install_source(WebstoreInstaller::INSTALL_SOURCE_OTHER); | 44 set_install_source(WebstoreInstaller::INSTALL_SOURCE_OTHER); |
40 } | 45 } |
41 | 46 |
42 WebstoreInstallWithPrompt::~WebstoreInstallWithPrompt() { | 47 WebstoreInstallWithPrompt::~WebstoreInstallWithPrompt() { |
43 } | 48 } |
44 | 49 |
45 bool WebstoreInstallWithPrompt::CheckRequestorAlive() const { | 50 bool WebstoreInstallWithPrompt::CheckRequestorAlive() const { |
46 if (!parent_window_) { | 51 if (!parent_window_) { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 94 |
90 bool WebstoreInstallWithPrompt::CheckRequestorPermitted( | 95 bool WebstoreInstallWithPrompt::CheckRequestorPermitted( |
91 const base::DictionaryValue& webstore_data, | 96 const base::DictionaryValue& webstore_data, |
92 std::string* error) const { | 97 std::string* error) const { |
93 // Assume the requestor is trusted. | 98 // Assume the requestor is trusted. |
94 *error = std::string(); | 99 *error = std::string(); |
95 return true; | 100 return true; |
96 } | 101 } |
97 | 102 |
98 } // namespace extensions | 103 } // namespace extensions |
OLD | NEW |