| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // static |
| 6 void Browser::RegisterIntentHandlerHelper(WebContents* tab, |
| 7 const string16& action, |
| 8 const string16& type, |
| 9 const string16& href, |
| 10 const string16& title, |
| 11 const string16& disposition) { |
| 12 if (!web_intents::IsWebIntentsEnabled()) |
| 13 return; |
| 14 |
| 15 TabContentsWrapper* tcw = TabContentsWrapper::GetCurrentWrapperForContents( |
| 16 tab); |
| 17 if (!tcw || tcw->profile()->IsOffTheRecord()) |
| 18 return; |
| 19 |
| 20 FaviconService* favicon_service = |
| 21 tcw->profile()->GetFaviconService(Profile::EXPLICIT_ACCESS); |
| 22 |
| 23 // |href| can be relative to originating URL. Resolve if necessary. |
| 24 GURL service_url(href); |
| 25 if (!service_url.is_valid()) { |
| 26 const GURL& url = tab->GetURL(); |
| 27 service_url = url.Resolve(href); |
| 28 } |
| 29 |
| 30 webkit_glue::WebIntentServiceData service; |
| 31 service.service_url = service_url; |
| 32 service.action = action; |
| 33 service.type = type; |
| 34 service.title = title; |
| 35 service.setDisposition(disposition); |
| 36 |
| 37 RegisterIntentHandlerInfoBarDelegate::MaybeShowIntentInfoBar( |
| 38 tcw->infobar_tab_helper(), |
| 39 WebIntentsRegistryFactory::GetForProfile(tcw->profile()), |
| 40 service, |
| 41 favicon_service, |
| 42 tab->GetURL()); |
| 43 } |
| 44 |
| OLD | NEW |