diff options
author | benwells@chromium.org <benwells@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-02 19:26:02 +0000 |
---|---|---|
committer | benwells@chromium.org <benwells@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-02 19:26:02 +0000 |
commit | 203da21fa0290e4f013ad31fa98b23c24b9ba64a (patch) | |
tree | 28b21dd883dc0678c2d25656e6991dd18168ac4a /chrome/browser/intents | |
parent | a73a2806e6ee567801677cb64aa68405434d97d8 (diff) | |
download | chromium_src-203da21fa0290e4f013ad31fa98b23c24b9ba64a.zip chromium_src-203da21fa0290e4f013ad31fa98b23c24b9ba64a.tar.gz chromium_src-203da21fa0290e4f013ad31fa98b23c24b9ba64a.tar.bz2 |
Remove browser from web intents UI code.
BUG=None
TEST=Tested WebIntents still work
Review URL: http://codereview.chromium.org/10134026
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@134964 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/intents')
-rw-r--r-- | chrome/browser/intents/register_intent_handler_helper.cc | 6 | ||||
-rw-r--r-- | chrome/browser/intents/web_intents_util.cc | 15 | ||||
-rw-r--r-- | chrome/browser/intents/web_intents_util.h | 11 |
3 files changed, 21 insertions, 11 deletions
diff --git a/chrome/browser/intents/register_intent_handler_helper.cc b/chrome/browser/intents/register_intent_handler_helper.cc index f142d91..371b670 100644 --- a/chrome/browser/intents/register_intent_handler_helper.cc +++ b/chrome/browser/intents/register_intent_handler_helper.cc @@ -23,14 +23,14 @@ void Browser::RegisterIntentHandlerHelper(WebContents* tab, const string16& href, const string16& title, const string16& disposition) { - if (!web_intents::IsWebIntentsEnabled()) - return; - TabContentsWrapper* tcw = TabContentsWrapper::GetCurrentWrapperForContents( tab); if (!tcw || tcw->profile()->IsOffTheRecord()) return; + if (!web_intents::IsWebIntentsEnabled(tcw->profile())) + return; + FaviconService* favicon_service = tcw->profile()->GetFaviconService(Profile::EXPLICIT_ACCESS); diff --git a/chrome/browser/intents/web_intents_util.cc b/chrome/browser/intents/web_intents_util.cc index 7141d30..7261f5a 100644 --- a/chrome/browser/intents/web_intents_util.cc +++ b/chrome/browser/intents/web_intents_util.cc @@ -19,19 +19,24 @@ void RegisterUserPrefs(PrefService* user_prefs) { PrefService::SYNCABLE_PREF); } -bool IsWebIntentsEnabled() { +bool IsWebIntentsEnabled(Profile* profile) { bool disabled_flag = CommandLine::ForCurrentProcess()->HasSwitch( switches::kDisableWebIntents); + bool enabled_pref = profile->GetPrefs()->GetBoolean( + prefs::kWebIntentsEnabled); + + return !disabled_flag && enabled_pref; +} + +bool IsWebIntentsEnabledInActiveBrowser() { Browser* browser = BrowserList::GetLastActive(); if (!browser) browser = *BrowserList::begin(); + DCHECK(browser); Profile* profile = browser->GetProfile(); - bool enabled_pref = profile->GetPrefs()->GetBoolean( - prefs::kWebIntentsEnabled); - - return !disabled_flag && enabled_pref; + return IsWebIntentsEnabled(profile); } } // namespace web_intents diff --git a/chrome/browser/intents/web_intents_util.h b/chrome/browser/intents/web_intents_util.h index 74557f5..cd47ca2 100644 --- a/chrome/browser/intents/web_intents_util.h +++ b/chrome/browser/intents/web_intents_util.h @@ -6,6 +6,7 @@ #define CHROME_BROWSER_INTENTS_WEB_INTENTS_UTIL_H_ #pragma once +class Profile; class PrefService; namespace web_intents { @@ -13,9 +14,13 @@ namespace web_intents { // Registers the preferences related to Web Intents. void RegisterUserPrefs(PrefService* user_prefs); -// Returns true if Web Intent is enabled due to various factors. |profile| is -// the current, active Profile. -bool IsWebIntentsEnabled(); +// Returns true if WebIntents are enabled due to various factors. |profile| is +// the Profile to check that WebIntents are enabled for. +bool IsWebIntentsEnabled(Profile* profile); + +// Returns true if WebIntents are enabled due to various factors. Check using +// the profile of the currently active Browser. +bool IsWebIntentsEnabledInActiveBrowser(); } // namespace web_intents |