Chromium Code Reviews| 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 webstore_data_fetcher_->Start(); | 72 OnBeforeWebstoreDataRequest(webstore_data_fetcher_.get()); |
|
Devlin
2017/01/27 20:31:34
(Following up from the other comment)
So here, we
robertshield
2017/01/28 03:58:48
Done.
| |
| 73 } | 73 } |
| 74 | 74 |
| 75 // | 75 // |
| 76 // Private interface implementation. | 76 // Private interface implementation. |
| 77 // | 77 // |
| 78 | 78 |
| 79 WebstoreStandaloneInstaller::~WebstoreStandaloneInstaller() { | 79 WebstoreStandaloneInstaller::~WebstoreStandaloneInstaller() { |
| 80 } | 80 } |
| 81 | 81 |
| 82 void WebstoreStandaloneInstaller::RunCallback(bool success, | 82 void WebstoreStandaloneInstaller::RunCallback(bool success, |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 152 &error); | 152 &error); |
| 153 } | 153 } |
| 154 return localized_extension_for_display_.get(); | 154 return localized_extension_for_display_.get(); |
| 155 } | 155 } |
| 156 | 156 |
| 157 void WebstoreStandaloneInstaller::InitInstallData( | 157 void WebstoreStandaloneInstaller::InitInstallData( |
| 158 ActiveInstallData* install_data) const { | 158 ActiveInstallData* install_data) const { |
| 159 // Default implementation sets no properties. | 159 // Default implementation sets no properties. |
| 160 } | 160 } |
| 161 | 161 |
| 162 void WebstoreStandaloneInstaller::OnBeforeWebstoreDataRequest( | |
| 163 WebstoreDataFetcher* fetcher) { | |
| 164 webstore_data_fetcher_->Start(); | |
| 165 } | |
| 166 | |
| 162 void WebstoreStandaloneInstaller::OnManifestParsed() { | 167 void WebstoreStandaloneInstaller::OnManifestParsed() { |
| 163 ProceedWithInstallPrompt(); | 168 ProceedWithInstallPrompt(); |
| 164 } | 169 } |
| 165 | 170 |
| 166 std::unique_ptr<ExtensionInstallPrompt> | 171 std::unique_ptr<ExtensionInstallPrompt> |
| 167 WebstoreStandaloneInstaller::CreateInstallUI() { | 172 WebstoreStandaloneInstaller::CreateInstallUI() { |
| 168 return base::MakeUnique<ExtensionInstallPrompt>(GetWebContents()); | 173 return base::MakeUnique<ExtensionInstallPrompt>(GetWebContents()); |
| 169 } | 174 } |
| 170 | 175 |
| 171 std::unique_ptr<WebstoreInstaller::Approval> | 176 std::unique_ptr<WebstoreInstaller::Approval> |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 409 void WebstoreStandaloneInstaller::OnWebStoreDataFetcherDone() { | 414 void WebstoreStandaloneInstaller::OnWebStoreDataFetcherDone() { |
| 410 // An instance of this class is passed in as a delegate for the | 415 // An instance of this class is passed in as a delegate for the |
| 411 // WebstoreInstallHelper, ExtensionInstallPrompt and WebstoreInstaller, and | 416 // WebstoreInstallHelper, ExtensionInstallPrompt and WebstoreInstaller, and |
| 412 // therefore needs to remain alive until they are done. Clear the webstore | 417 // 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 | 418 // data fetcher to avoid calling Release in AbortInstall while any of these |
| 414 // operations are in progress. | 419 // operations are in progress. |
| 415 webstore_data_fetcher_.reset(); | 420 webstore_data_fetcher_.reset(); |
| 416 } | 421 } |
| 417 | 422 |
| 418 } // namespace extensions | 423 } // namespace extensions |
| OLD | NEW |