| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 } | 62 } |
| 63 | 63 |
| 64 // Use the requesting page as the referrer both since that is more correct | 64 // Use the requesting page as the referrer both since that is more correct |
| 65 // (it is the page that caused this request to happen) and so that we can | 65 // (it is the page that caused this request to happen) and so that we can |
| 66 // track top sites that trigger inline install requests. | 66 // track top sites that trigger inline install requests. |
| 67 webstore_data_fetcher_.reset(new WebstoreDataFetcher( | 67 webstore_data_fetcher_.reset(new WebstoreDataFetcher( |
| 68 this, | 68 this, |
| 69 profile_->GetRequestContext(), | 69 profile_->GetRequestContext(), |
| 70 GetRequestorURL(), | 70 GetRequestorURL(), |
| 71 id_)); | 71 id_)); |
| 72 |
| 73 std::string json_post_data = GetJsonPostData(); |
| 74 if (!json_post_data.empty()) |
| 75 webstore_data_fetcher_->SetJsonPostData(json_post_data); |
| 76 |
| 72 webstore_data_fetcher_->Start(); | 77 webstore_data_fetcher_->Start(); |
| 73 } | 78 } |
| 74 | 79 |
| 75 // | 80 // |
| 76 // Private interface implementation. | 81 // Private interface implementation. |
| 77 // | 82 // |
| 78 | 83 |
| 79 WebstoreStandaloneInstaller::~WebstoreStandaloneInstaller() { | 84 WebstoreStandaloneInstaller::~WebstoreStandaloneInstaller() { |
| 80 } | 85 } |
| 81 | 86 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 &error); | 157 &error); |
| 153 } | 158 } |
| 154 return localized_extension_for_display_.get(); | 159 return localized_extension_for_display_.get(); |
| 155 } | 160 } |
| 156 | 161 |
| 157 void WebstoreStandaloneInstaller::InitInstallData( | 162 void WebstoreStandaloneInstaller::InitInstallData( |
| 158 ActiveInstallData* install_data) const { | 163 ActiveInstallData* install_data) const { |
| 159 // Default implementation sets no properties. | 164 // Default implementation sets no properties. |
| 160 } | 165 } |
| 161 | 166 |
| 167 std::string WebstoreStandaloneInstaller::GetJsonPostData() { |
| 168 return std::string(); |
| 169 } |
| 170 |
| 162 void WebstoreStandaloneInstaller::OnManifestParsed() { | 171 void WebstoreStandaloneInstaller::OnManifestParsed() { |
| 163 ProceedWithInstallPrompt(); | 172 ProceedWithInstallPrompt(); |
| 164 } | 173 } |
| 165 | 174 |
| 166 std::unique_ptr<ExtensionInstallPrompt> | 175 std::unique_ptr<ExtensionInstallPrompt> |
| 167 WebstoreStandaloneInstaller::CreateInstallUI() { | 176 WebstoreStandaloneInstaller::CreateInstallUI() { |
| 168 return base::MakeUnique<ExtensionInstallPrompt>(GetWebContents()); | 177 return base::MakeUnique<ExtensionInstallPrompt>(GetWebContents()); |
| 169 } | 178 } |
| 170 | 179 |
| 171 std::unique_ptr<WebstoreInstaller::Approval> | 180 std::unique_ptr<WebstoreInstaller::Approval> |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 void WebstoreStandaloneInstaller::OnWebStoreDataFetcherDone() { | 418 void WebstoreStandaloneInstaller::OnWebStoreDataFetcherDone() { |
| 410 // An instance of this class is passed in as a delegate for the | 419 // An instance of this class is passed in as a delegate for the |
| 411 // WebstoreInstallHelper, ExtensionInstallPrompt and WebstoreInstaller, and | 420 // WebstoreInstallHelper, ExtensionInstallPrompt and WebstoreInstaller, and |
| 412 // therefore needs to remain alive until they are done. Clear the webstore | 421 // therefore needs to remain alive until they are done. Clear the webstore |
| 413 // data fetcher to avoid calling Release in AbortInstall while any of these | 422 // data fetcher to avoid calling Release in AbortInstall while any of these |
| 414 // operations are in progress. | 423 // operations are in progress. |
| 415 webstore_data_fetcher_.reset(); | 424 webstore_data_fetcher_.reset(); |
| 416 } | 425 } |
| 417 | 426 |
| 418 } // namespace extensions | 427 } // namespace extensions |
| OLD | NEW |