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: Adds basic test 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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 } 288 }
289 289
290 void WebIntentPickerController::OnServiceChosen( 290 void WebIntentPickerController::OnServiceChosen(
291 const GURL& url, 291 const GURL& url,
292 webkit_glue::WebIntentServiceData::Disposition disposition) { 292 webkit_glue::WebIntentServiceData::Disposition disposition) {
293 ExtensionService* service = tab_contents_->profile()->GetExtensionService(); 293 ExtensionService* service = tab_contents_->profile()->GetExtensionService();
294 DCHECK(service); 294 DCHECK(service);
295 const extensions::Extension* extension = service->GetInstalledApp(url); 295 const extensions::Extension* extension = service->GetInstalledApp(url);
296 if (extension && extension->is_platform_app()) { 296 if (extension && extension->is_platform_app()) {
297 extensions::LaunchPlatformAppWithWebIntent(tab_contents_->profile(), 297 extensions::LaunchPlatformAppWithWebIntent(tab_contents_->profile(),
298 extension, intents_dispatcher_->GetIntent()); 298 extension, intents_dispatcher_, tab_contents_->web_contents());
299 // TODO(benwells): hook up return pathway to allow platform app to post
300 // success or failure.
301 intents_dispatcher_->SendReplyMessage(
302 webkit_glue::WEB_INTENT_REPLY_SUCCESS, string16());
303 ClosePicker(); 299 ClosePicker();
304 return; 300 return;
305 } 301 }
306 302
307 switch (disposition) { 303 switch (disposition) {
308 case webkit_glue::WebIntentServiceData::DISPOSITION_INLINE: 304 case webkit_glue::WebIntentServiceData::DISPOSITION_INLINE:
309 // Set the model to inline disposition. It will notify the picker which 305 // Set the model to inline disposition. It will notify the picker which
310 // will respond (via OnInlineDispositionWebContentsCreated) with the 306 // will respond (via OnInlineDispositionWebContentsCreated) with the
311 // WebContents to dispatch the intent to. 307 // WebContents to dispatch the intent to.
312 picker_model_->SetInlineDisposition(url); 308 picker_model_->SetInlineDisposition(url);
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after
942 picker_->SetActionString(GetIntentActionString( 938 picker_->SetActionString(GetIntentActionString(
943 UTF16ToUTF8(picker_model_->action()))); 939 UTF16ToUTF8(picker_model_->action())));
944 picker_shown_ = true; 940 picker_shown_ = true;
945 } 941 }
946 942
947 void WebIntentPickerController::ClosePicker() { 943 void WebIntentPickerController::ClosePicker() {
948 SetDialogState(kPickerHidden); 944 SetDialogState(kPickerHidden);
949 if (picker_) 945 if (picker_)
950 picker_->Close(); 946 picker_->Close();
951 } 947 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698