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