OLD | NEW |
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_standalone_installer.h" | 5 #include "chrome/browser/extensions/webstore_standalone_installer.h" |
6 | 6 |
7 #include "base/values.h" | 7 #include "base/values.h" |
8 #include "chrome/browser/extensions/crx_installer.h" | 8 #include "chrome/browser/extensions/crx_installer.h" |
9 #include "chrome/browser/extensions/extension_install_prompt.h" | 9 #include "chrome/browser/extensions/extension_install_prompt.h" |
10 #include "chrome/browser/extensions/extension_install_ui.h" | 10 #include "chrome/browser/extensions/extension_install_ui.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 scoped_ptr<ExtensionInstallPrompt> | 81 scoped_ptr<ExtensionInstallPrompt> |
82 WebstoreStandaloneInstaller::CreateInstallUI() { | 82 WebstoreStandaloneInstaller::CreateInstallUI() { |
83 return make_scoped_ptr(new ExtensionInstallPrompt(GetWebContents())); | 83 return make_scoped_ptr(new ExtensionInstallPrompt(GetWebContents())); |
84 } | 84 } |
85 | 85 |
86 void WebstoreStandaloneInstaller::OnWebstoreRequestFailure() { | 86 void WebstoreStandaloneInstaller::OnWebstoreRequestFailure() { |
87 CompleteInstall(kWebstoreRequestError); | 87 CompleteInstall(kWebstoreRequestError); |
88 } | 88 } |
89 | 89 |
90 void WebstoreStandaloneInstaller::OnWebstoreResponseParseSuccess( | 90 void WebstoreStandaloneInstaller::OnWebstoreResponseParseSuccess( |
91 DictionaryValue* webstore_data) { | 91 scoped_ptr<DictionaryValue> webstore_data) { |
92 if (!CheckRequestorAlive()) { | 92 if (!CheckRequestorAlive()) { |
93 CompleteInstall(std::string()); | 93 CompleteInstall(std::string()); |
94 return; | 94 return; |
95 } | 95 } |
96 | 96 |
97 std::string error; | 97 std::string error; |
98 | 98 |
99 if (!CheckInlineInstallPermitted(*webstore_data, &error)) { | 99 if (!CheckInlineInstallPermitted(*webstore_data, &error)) { |
100 CompleteInstall(error); | 100 CompleteInstall(error); |
101 return; | 101 return; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 } | 146 } |
147 icon_url = GURL(extension_urls::GetWebstoreLaunchURL()).Resolve( | 147 icon_url = GURL(extension_urls::GetWebstoreLaunchURL()).Resolve( |
148 icon_url_string); | 148 icon_url_string); |
149 if (!icon_url.is_valid()) { | 149 if (!icon_url.is_valid()) { |
150 CompleteInstall(kInvalidWebstoreResponseError); | 150 CompleteInstall(kInvalidWebstoreResponseError); |
151 return; | 151 return; |
152 } | 152 } |
153 } | 153 } |
154 | 154 |
155 // Assume ownership of webstore_data. | 155 // Assume ownership of webstore_data. |
156 webstore_data_.reset(webstore_data); | 156 webstore_data_ = webstore_data.Pass(); |
157 | 157 |
158 scoped_refptr<WebstoreInstallHelper> helper = | 158 scoped_refptr<WebstoreInstallHelper> helper = |
159 new WebstoreInstallHelper(this, | 159 new WebstoreInstallHelper(this, |
160 id_, | 160 id_, |
161 manifest, | 161 manifest, |
162 std::string(), // We don't have any icon data. | 162 std::string(), // We don't have any icon data. |
163 icon_url, | 163 icon_url, |
164 profile_->GetRequestContext()); | 164 profile_->GetRequestContext()); |
165 // The helper will call us back via OnWebstoreParseSucces or | 165 // The helper will call us back via OnWebstoreParseSucces or |
166 // OnWebstoreParseFailure. | 166 // OnWebstoreParseFailure. |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 // Balanced in InstallUIAbort or indirectly in InstallUIProceed via | 287 // Balanced in InstallUIAbort or indirectly in InstallUIProceed via |
288 // OnExtensionInstallSuccess or OnExtensionInstallFailure. | 288 // OnExtensionInstallSuccess or OnExtensionInstallFailure. |
289 AddRef(); | 289 AddRef(); |
290 | 290 |
291 install_ui_ = CreateInstallUI(); | 291 install_ui_ = CreateInstallUI(); |
292 install_ui_->ConfirmStandaloneInstall( | 292 install_ui_->ConfirmStandaloneInstall( |
293 this, localized_extension_for_display_.get(), &icon_, *install_prompt_); | 293 this, localized_extension_for_display_.get(), &icon_, *install_prompt_); |
294 } | 294 } |
295 | 295 |
296 } // namespace extensions | 296 } // namespace extensions |
OLD | NEW |