Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(268)

Side by Side Diff: chrome/browser/ui/intents/web_intent_picker_controller.cc

Issue 10828172: Allow platform apps to respond to Web Intents (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Added WebIntentCallbacks profile keyed class to manage callbacks Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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_);
koz (OOO until 15th September) 2012/08/08 04:47:30 Hm. So looking at the code below a bit more it see
thorogood 2012/08/08 07:15:49 We'd need to call postFailure with null, which is
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 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
768 // If picker is non-NULL, it was set by a test. 764 // If picker is non-NULL, it was set by a test.
769 if (picker_ == NULL) 765 if (picker_ == NULL)
770 picker_ = WebIntentPicker::Create(tab_contents_, this, picker_model_.get()); 766 picker_ = WebIntentPicker::Create(tab_contents_, this, picker_model_.get());
771 picker_shown_ = true; 767 picker_shown_ = true;
772 } 768 }
773 769
774 void WebIntentPickerController::ClosePicker() { 770 void WebIntentPickerController::ClosePicker() {
775 if (picker_) 771 if (picker_)
776 picker_->Close(); 772 picker_->Close();
777 } 773 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698