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 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 extension_id, | 546 extension_id, |
547 &services); | 547 &services); |
548 | 548 |
549 // Extension must be registered with registry by now. | 549 // Extension must be registered with registry by now. |
550 DCHECK(services.size() > 0); | 550 DCHECK(services.size() > 0); |
551 | 551 |
552 // TODO(binji): We're going to need to disambiguate if there are multiple | 552 // TODO(binji): We're going to need to disambiguate if there are multiple |
553 // services. For now, just choose the first. | 553 // services. For now, just choose the first. |
554 const webkit_glue::WebIntentServiceData& service_data = services[0]; | 554 const webkit_glue::WebIntentServiceData& service_data = services[0]; |
555 | 555 |
556 picker_model_->RemoveSuggestedExtension(extension_id); | 556 picker_model_->AddInstalledService( |
557 AddServiceToModel(service_data); | 557 service_data.title, service_data.service_url, |
| 558 service_data.disposition); |
558 OnServiceChosen(service_data.service_url, service_data.disposition, | 559 OnServiceChosen(service_data.service_url, service_data.disposition, |
559 kEnableDefaults); | 560 kEnableDefaults); |
560 AsyncOperationFinished(); | 561 AsyncOperationFinished(); |
561 } | 562 } |
562 | 563 |
563 void WebIntentPickerController::OnExtensionInstallFailure( | 564 void WebIntentPickerController::OnExtensionInstallFailure( |
564 const std::string& id, | 565 const std::string& id, |
565 const std::string& error, | 566 const std::string& error, |
566 WebstoreInstaller::FailureReason reason) { | 567 WebstoreInstaller::FailureReason reason) { |
567 // If the user cancelled the install then don't show an error message. | 568 // If the user cancelled the install then don't show an error message. |
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1088 content::DownloadManager* download_manager = | 1089 content::DownloadManager* download_manager = |
1089 content::BrowserContext::GetDownloadManager(profile); | 1090 content::BrowserContext::GetDownloadManager(profile); |
1090 if (!download_manager) | 1091 if (!download_manager) |
1091 return; | 1092 return; |
1092 content::DownloadItem* item = | 1093 content::DownloadItem* item = |
1093 download_manager->GetDownload(download_id_.local()); | 1094 download_manager->GetDownload(download_id_.local()); |
1094 if (item) | 1095 if (item) |
1095 item->Cancel(true); | 1096 item->Cancel(true); |
1096 download_id_ = content::DownloadId(); | 1097 download_id_ = content::DownloadId(); |
1097 } | 1098 } |
OLD | NEW |