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/ui/intents/web_intent_picker_controller.h" | 5 #include "chrome/browser/ui/intents/web_intent_picker_controller.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 extension_id, | 552 extension_id, |
553 &services); | 553 &services); |
554 | 554 |
555 // Extension must be registered with registry by now. | 555 // Extension must be registered with registry by now. |
556 DCHECK(services.size() > 0); | 556 DCHECK(services.size() > 0); |
557 | 557 |
558 // TODO(binji): We're going to need to disambiguate if there are multiple | 558 // TODO(binji): We're going to need to disambiguate if there are multiple |
559 // services. For now, just choose the first. | 559 // services. For now, just choose the first. |
560 const webkit_glue::WebIntentServiceData& service_data = services[0]; | 560 const webkit_glue::WebIntentServiceData& service_data = services[0]; |
561 | 561 |
562 picker_model_->AddInstalledService( | 562 picker_model_->RemoveSuggestedExtension(extension_id); |
563 service_data.title, service_data.service_url, | 563 AddServiceToModel(service_data); |
564 service_data.disposition); | |
565 OnServiceChosen(service_data.service_url, service_data.disposition, | 564 OnServiceChosen(service_data.service_url, service_data.disposition, |
566 kEnableDefaults); | 565 kEnableDefaults); |
567 AsyncOperationFinished(); | 566 AsyncOperationFinished(); |
568 } | 567 } |
569 | 568 |
570 void WebIntentPickerController::OnExtensionInstallFailure( | 569 void WebIntentPickerController::OnExtensionInstallFailure( |
571 const std::string& id, | 570 const std::string& id, |
572 const std::string& error, | 571 const std::string& error, |
573 WebstoreInstaller::FailureReason reason) { | 572 WebstoreInstaller::FailureReason reason) { |
574 // If the user cancelled the install then don't show an error message. | 573 // If the user cancelled the install then don't show an error message. |
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1116 content::DownloadManager* download_manager = | 1115 content::DownloadManager* download_manager = |
1117 content::BrowserContext::GetDownloadManager(profile); | 1116 content::BrowserContext::GetDownloadManager(profile); |
1118 if (!download_manager) | 1117 if (!download_manager) |
1119 return; | 1118 return; |
1120 content::DownloadItem* item = | 1119 content::DownloadItem* item = |
1121 download_manager->GetDownload(download_id_.local()); | 1120 download_manager->GetDownload(download_id_.local()); |
1122 if (item) | 1121 if (item) |
1123 item->Cancel(true); | 1122 item->Cancel(true); |
1124 download_id_ = content::DownloadId(); | 1123 download_id_ = content::DownloadId(); |
1125 } | 1124 } |
OLD | NEW |