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 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 extension_id, | 569 extension_id, |
570 &services); | 570 &services); |
571 | 571 |
572 // Extension must be registered with registry by now. | 572 // Extension must be registered with registry by now. |
573 DCHECK(services.size() > 0); | 573 DCHECK(services.size() > 0); |
574 | 574 |
575 // TODO(binji): We're going to need to disambiguate if there are multiple | 575 // TODO(binji): We're going to need to disambiguate if there are multiple |
576 // services. For now, just choose the first. | 576 // services. For now, just choose the first. |
577 const webkit_glue::WebIntentServiceData& service_data = services[0]; | 577 const webkit_glue::WebIntentServiceData& service_data = services[0]; |
578 | 578 |
579 picker_model_->AddInstalledService( | 579 picker_model_->RemoveSuggestedExtension(extension_id); |
580 service_data.title, service_data.service_url, | 580 AddServiceToModel(service_data); |
581 service_data.disposition); | |
582 OnServiceChosen(service_data.service_url, service_data.disposition, | 581 OnServiceChosen(service_data.service_url, service_data.disposition, |
583 kEnableDefaults); | 582 kEnableDefaults); |
584 AsyncOperationFinished(); | 583 AsyncOperationFinished(); |
585 } | 584 } |
586 | 585 |
587 void WebIntentPickerController::OnExtensionInstallFailure( | 586 void WebIntentPickerController::OnExtensionInstallFailure( |
588 const std::string& id, | 587 const std::string& id, |
589 const std::string& error, | 588 const std::string& error, |
590 WebstoreInstaller::FailureReason reason) { | 589 WebstoreInstaller::FailureReason reason) { |
591 // If the user cancelled the install then don't show an error message. | 590 // If the user cancelled the install then don't show an error message. |
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1129 content::DownloadManager* download_manager = | 1128 content::DownloadManager* download_manager = |
1130 content::BrowserContext::GetDownloadManager(profile); | 1129 content::BrowserContext::GetDownloadManager(profile); |
1131 if (!download_manager) | 1130 if (!download_manager) |
1132 return; | 1131 return; |
1133 content::DownloadItem* item = | 1132 content::DownloadItem* item = |
1134 download_manager->GetDownload(download_id_.local()); | 1133 download_manager->GetDownload(download_id_.local()); |
1135 if (item) | 1134 if (item) |
1136 item->Cancel(true); | 1135 item->Cancel(true); |
1137 download_id_ = content::DownloadId(); | 1136 download_id_ = content::DownloadId(); |
1138 } | 1137 } |
OLD | NEW |