| 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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 ClosePicker(); | 280 ClosePicker(); |
| 281 } | 281 } |
| 282 | 282 |
| 283 void WebIntentPickerController::OnServiceChosen(const GURL& url, | 283 void WebIntentPickerController::OnServiceChosen(const GURL& url, |
| 284 Disposition disposition) { | 284 Disposition disposition) { |
| 285 ExtensionService* service = tab_contents_->profile()->GetExtensionService(); | 285 ExtensionService* service = tab_contents_->profile()->GetExtensionService(); |
| 286 DCHECK(service); | 286 DCHECK(service); |
| 287 const extensions::Extension* extension = service->GetInstalledApp(url); | 287 const extensions::Extension* extension = service->GetInstalledApp(url); |
| 288 if (extension && extension->is_platform_app()) { | 288 if (extension && extension->is_platform_app()) { |
| 289 extensions::LaunchPlatformAppWithWebIntent(tab_contents_->profile(), | 289 extensions::LaunchPlatformAppWithWebIntent(tab_contents_->profile(), |
| 290 extension, intents_dispatcher_->GetIntent()); | 290 extension, intents_dispatcher_, tab_contents_->web_contents()); |
| 291 // TODO(benwells): hook up return pathway to allow platform app to post | |
| 292 // success or failure. | |
| 293 intents_dispatcher_->SendReplyMessage( | |
| 294 webkit_glue::WEB_INTENT_REPLY_SUCCESS, string16()); | |
| 295 ClosePicker(); | 291 ClosePicker(); |
| 296 return; | 292 return; |
| 297 } | 293 } |
| 298 | 294 |
| 299 switch (disposition) { | 295 switch (disposition) { |
| 300 case WebIntentPickerModel::DISPOSITION_INLINE: | 296 case WebIntentPickerModel::DISPOSITION_INLINE: |
| 301 // Set the model to inline disposition. It will notify the picker which | 297 // Set the model to inline disposition. It will notify the picker which |
| 302 // will respond (via OnInlineDispositionWebContentsCreated) with the | 298 // will respond (via OnInlineDispositionWebContentsCreated) with the |
| 303 // WebContents to dispatch the intent to. | 299 // WebContents to dispatch the intent to. |
| 304 picker_model_->SetInlineDisposition(url); | 300 picker_model_->SetInlineDisposition(url); |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 766 // If picker is non-NULL, it was set by a test. | 762 // If picker is non-NULL, it was set by a test. |
| 767 if (picker_ == NULL) | 763 if (picker_ == NULL) |
| 768 picker_ = WebIntentPicker::Create(tab_contents_, this, picker_model_.get()); | 764 picker_ = WebIntentPicker::Create(tab_contents_, this, picker_model_.get()); |
| 769 picker_shown_ = true; | 765 picker_shown_ = true; |
| 770 } | 766 } |
| 771 | 767 |
| 772 void WebIntentPickerController::ClosePicker() { | 768 void WebIntentPickerController::ClosePicker() { |
| 773 if (picker_) | 769 if (picker_) |
| 774 picker_->Close(); | 770 picker_->Close(); |
| 775 } | 771 } |
| OLD | NEW |