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 #include <string> | |
6 | |
7 #include "chrome/browser/api/infobars/infobar_service.h" | |
8 #include "chrome/browser/favicon/favicon_service.h" | |
9 #include "chrome/browser/favicon/favicon_service_factory.h" | |
10 #include "chrome/browser/intents/register_intent_handler_infobar_delegate.h" | |
11 #include "chrome/browser/intents/web_intents_registry_factory.h" | |
12 #include "chrome/browser/intents/web_intents_util.h" | |
13 #include "chrome/browser/profiles/profile.h" | |
14 #include "chrome/browser/ui/browser.h" | |
15 #include "content/public/browser/web_contents.h" | |
16 #include "webkit/glue/web_intent_service_data.h" | |
17 | |
18 using content::WebContents; | |
19 | |
20 // static | |
21 void Browser::RegisterIntentHandlerHelper( | |
22 WebContents* web_contents, | |
23 const webkit_glue::WebIntentServiceData& data, | |
24 bool user_gesture) { | |
25 Profile* profile = | |
26 Profile::FromBrowserContext(web_contents->GetBrowserContext()); | |
27 if (profile->IsOffTheRecord()) | |
28 return; | |
29 | |
30 if (!web_intents::IsWebIntentsEnabledForProfile(profile)) | |
31 return; | |
32 | |
33 FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( | |
34 profile, Profile::EXPLICIT_ACCESS); | |
35 | |
36 RegisterIntentHandlerInfoBarDelegate::MaybeShowIntentInfoBar( | |
37 InfoBarService::FromWebContents(web_contents), | |
38 WebIntentsRegistryFactory::GetForProfile(profile), | |
39 data, | |
40 favicon_service, | |
41 web_contents->GetURL()); | |
42 } | |
OLD | NEW |