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

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: about to submit Created 8 years, 3 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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 const GURL& url, 292 const GURL& url,
293 webkit_glue::WebIntentServiceData::Disposition disposition) { 293 webkit_glue::WebIntentServiceData::Disposition disposition) {
294 web_intents::RecordServiceInvoke(uma_bucket_); 294 web_intents::RecordServiceInvoke(uma_bucket_);
295 ExtensionService* service = tab_contents_->profile()->GetExtensionService(); 295 ExtensionService* service = tab_contents_->profile()->GetExtensionService();
296 DCHECK(service); 296 DCHECK(service);
297 const extensions::Extension* extension = service->GetInstalledApp(url); 297 const extensions::Extension* extension = service->GetInstalledApp(url);
298 298
299 // TODO(smckay): this basically smells like another disposition. 299 // TODO(smckay): this basically smells like another disposition.
300 if (extension && extension->is_platform_app()) { 300 if (extension && extension->is_platform_app()) {
301 extensions::LaunchPlatformAppWithWebIntent(tab_contents_->profile(), 301 extensions::LaunchPlatformAppWithWebIntent(tab_contents_->profile(),
302 extension, intents_dispatcher_->GetIntent()); 302 extension, intents_dispatcher_, tab_contents_->web_contents());
303 // TODO(benwells): hook up return pathway to allow platform app to post
304 // success or failure.
305 intents_dispatcher_->SendReplyMessage(
306 webkit_glue::WEB_INTENT_REPLY_SUCCESS, string16());
307 ClosePicker(); 303 ClosePicker();
308 return; 304 return;
309 } 305 }
310 306
311 switch (disposition) { 307 switch (disposition) {
312 case webkit_glue::WebIntentServiceData::DISPOSITION_INLINE: 308 case webkit_glue::WebIntentServiceData::DISPOSITION_INLINE:
313 // Set the model to inline disposition. It will notify the picker which 309 // Set the model to inline disposition. It will notify the picker which
314 // will respond (via OnInlineDispositionWebContentsCreated) with the 310 // will respond (via OnInlineDispositionWebContentsCreated) with the
315 // WebContents to dispatch the intent to. 311 // WebContents to dispatch the intent to.
316 picker_model_->SetInlineDisposition(url); 312 picker_model_->SetInlineDisposition(url);
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after
935 UTF16ToUTF8(picker_model_->action()))); 931 UTF16ToUTF8(picker_model_->action())));
936 web_intents::RecordPickerShow(uma_bucket_); 932 web_intents::RecordPickerShow(uma_bucket_);
937 picker_shown_ = true; 933 picker_shown_ = true;
938 } 934 }
939 935
940 void WebIntentPickerController::ClosePicker() { 936 void WebIntentPickerController::ClosePicker() {
941 SetDialogState(kPickerHidden); 937 SetDialogState(kPickerHidden);
942 if (picker_) 938 if (picker_)
943 picker_->Close(); 939 picker_->Close();
944 } 940 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/web_intent_callbacks.cc ('k') | chrome/chrome_browser_extensions.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698