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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 GetWebIntentsRegistry(tab_contents_)->GetDefaultIntentService( | 240 GetWebIntentsRegistry(tab_contents_)->GetDefaultIntentService( |
241 action, type, invoking_url, | 241 action, type, invoking_url, |
242 base::Bind(&WebIntentPickerController::OnWebIntentDefaultsAvailable, | 242 base::Bind(&WebIntentPickerController::OnWebIntentDefaultsAvailable, |
243 weak_ptr_factory_.GetWeakPtr())); | 243 weak_ptr_factory_.GetWeakPtr())); |
244 } | 244 } |
245 | 245 |
246 GetCWSIntentsRegistry(tab_contents_)->GetIntentServices( | 246 GetCWSIntentsRegistry(tab_contents_)->GetIntentServices( |
247 action, type, | 247 action, type, |
248 base::Bind(&WebIntentPickerController::OnCWSIntentServicesAvailable, | 248 base::Bind(&WebIntentPickerController::OnCWSIntentServicesAvailable, |
249 weak_ptr_factory_.GetWeakPtr())); | 249 weak_ptr_factory_.GetWeakPtr())); |
250 } | 250 } |
251 | 251 |
252 void WebIntentPickerController::Observe( | 252 void WebIntentPickerController::Observe( |
253 int type, | 253 int type, |
254 const content::NotificationSource& source, | 254 const content::NotificationSource& source, |
255 const content::NotificationDetails& details) { | 255 const content::NotificationDetails& details) { |
256 DCHECK(type == content::NOTIFICATION_LOAD_START || | 256 DCHECK(type == content::NOTIFICATION_LOAD_START || |
257 type == chrome::NOTIFICATION_TAB_CLOSING); | 257 type == chrome::NOTIFICATION_TAB_CLOSING); |
258 ClosePicker(); | 258 ClosePicker(); |
259 } | 259 } |
260 | 260 |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 const gfx::Image& icon_image) { | 674 const gfx::Image& icon_image) { |
675 picker_model_->SetSuggestedExtensionIconWithId(extension_id, icon_image); | 675 picker_model_->SetSuggestedExtensionIconWithId(extension_id, icon_image); |
676 AsyncOperationFinished(); | 676 AsyncOperationFinished(); |
677 } | 677 } |
678 | 678 |
679 void WebIntentPickerController::OnExtensionIconUnavailable( | 679 void WebIntentPickerController::OnExtensionIconUnavailable( |
680 const string16& extension_id) { | 680 const string16& extension_id) { |
681 AsyncOperationFinished(); | 681 AsyncOperationFinished(); |
682 } | 682 } |
683 | 683 |
| 684 bool WebIntentPickerController::ShowLocationBarPickerTool() { |
| 685 return true; |
| 686 } |
| 687 |
684 void WebIntentPickerController::OnExtensionInstallServiceAvailable( | 688 void WebIntentPickerController::OnExtensionInstallServiceAvailable( |
685 const std::vector<webkit_glue::WebIntentServiceData>& services) { | 689 const std::vector<webkit_glue::WebIntentServiceData>& services) { |
686 DCHECK(services.size() > 0); | 690 DCHECK(services.size() > 0); |
687 | 691 |
688 // TODO(binji): We're going to need to disambiguate if there are multiple | 692 // TODO(binji): We're going to need to disambiguate if there are multiple |
689 // services. For now, just choose the first. | 693 // services. For now, just choose the first. |
690 const webkit_glue::WebIntentServiceData& service_data = services[0]; | 694 const webkit_glue::WebIntentServiceData& service_data = services[0]; |
691 picker_model_->AddInstalledService( | 695 picker_model_->AddInstalledService( |
692 service_data.title, service_data.service_url, | 696 service_data.title, service_data.service_url, |
693 ConvertDisposition(service_data.disposition)); | 697 ConvertDisposition(service_data.disposition)); |
(...skipping 15 matching lines...) Expand all Loading... |
709 // If picker is non-NULL, it was set by a test. | 713 // If picker is non-NULL, it was set by a test. |
710 if (picker_ == NULL) | 714 if (picker_ == NULL) |
711 picker_ = WebIntentPicker::Create(tab_contents_, this, picker_model_.get()); | 715 picker_ = WebIntentPicker::Create(tab_contents_, this, picker_model_.get()); |
712 picker_shown_ = true; | 716 picker_shown_ = true; |
713 } | 717 } |
714 | 718 |
715 void WebIntentPickerController::ClosePicker() { | 719 void WebIntentPickerController::ClosePicker() { |
716 if (picker_) | 720 if (picker_) |
717 picker_->Close(); | 721 picker_->Close(); |
718 } | 722 } |
OLD | NEW |