| 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_inline_installer.h" | 5 #include "chrome/browser/extensions/webstore_inline_installer.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 manifest_.reset(manifest); | 366 manifest_.reset(manifest); |
| 367 icon_ = icon; | 367 icon_ = icon; |
| 368 | 368 |
| 369 Profile* profile = Profile::FromBrowserContext( | 369 Profile* profile = Profile::FromBrowserContext( |
| 370 web_contents()->GetBrowserContext()); | 370 web_contents()->GetBrowserContext()); |
| 371 | 371 |
| 372 ExtensionInstallUI::Prompt prompt(ExtensionInstallUI::INLINE_INSTALL_PROMPT); | 372 ExtensionInstallUI::Prompt prompt(ExtensionInstallUI::INLINE_INSTALL_PROMPT); |
| 373 prompt.SetInlineInstallWebstoreData(localized_user_count_, | 373 prompt.SetInlineInstallWebstoreData(localized_user_count_, |
| 374 average_rating_, | 374 average_rating_, |
| 375 rating_count_); | 375 rating_count_); |
| 376 | 376 std::string error; |
| 377 if (!ShowExtensionInstallDialogForManifest(profile, | 377 dummy_extension_ = ExtensionInstallUI::GetLocalizedExtensionForDisplay( |
| 378 this, | 378 manifest, id_, localized_name_, localized_description_, &error); |
| 379 manifest, | 379 if (!dummy_extension_) { |
| 380 id_, | 380 OnWebstoreParseFailure(id_, WebstoreInstallHelper::Delegate::MANIFEST_ERROR, |
| 381 localized_name_, | 381 kInvalidManifestError); |
| 382 localized_description_, | |
| 383 &icon_, | |
| 384 prompt, | |
| 385 &dummy_extension_)) { | |
| 386 CompleteInstall(kInvalidManifestError); | |
| 387 return; | 382 return; |
| 388 } | 383 } |
| 389 | 384 |
| 385 install_ui_.reset(new ExtensionInstallUI(profile)); |
| 386 install_ui_->ConfirmInlineInstall(this, dummy_extension_, &icon_, prompt); |
| 390 // Control flow finishes up in InstallUIProceed or InstallUIAbort. | 387 // Control flow finishes up in InstallUIProceed or InstallUIAbort. |
| 391 } | 388 } |
| 392 | 389 |
| 393 void WebstoreInlineInstaller::OnWebstoreParseFailure( | 390 void WebstoreInlineInstaller::OnWebstoreParseFailure( |
| 394 const std::string& id, | 391 const std::string& id, |
| 395 InstallHelperResultCode result_code, | 392 InstallHelperResultCode result_code, |
| 396 const std::string& error_message) { | 393 const std::string& error_message) { |
| 397 CompleteInstall(error_message); | 394 CompleteInstall(error_message); |
| 398 } | 395 } |
| 399 | 396 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 if (web_contents()) { | 446 if (web_contents()) { |
| 450 if (error.empty()) { | 447 if (error.empty()) { |
| 451 delegate_->OnInlineInstallSuccess(install_id_, return_route_id_); | 448 delegate_->OnInlineInstallSuccess(install_id_, return_route_id_); |
| 452 } else { | 449 } else { |
| 453 delegate_->OnInlineInstallFailure(install_id_, return_route_id_, error); | 450 delegate_->OnInlineInstallFailure(install_id_, return_route_id_, error); |
| 454 } | 451 } |
| 455 } | 452 } |
| 456 | 453 |
| 457 Release(); // Matches the AddRef in BeginInstall. | 454 Release(); // Matches the AddRef in BeginInstall. |
| 458 } | 455 } |
| OLD | NEW |