summaryrefslogtreecommitdiffstats
path: root/chrome/browser/intents/web_intents_util.cc
blob: 848d11a4b27788cc7d38ed5350807c7eb78f78a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/intents/web_intents_util.h"

#include "base/command_line.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
#include "content/public/common/content_switches.h"

namespace web_intents {

void RegisterUserPrefs(PrefService* user_prefs) {
  user_prefs->RegisterBooleanPref(prefs::kWebIntentsEnabled, true,
                                  PrefService::SYNCABLE_PREF);
}

bool IsWebIntentsEnabled(Profile* profile) {
  return profile->GetPrefs()->GetBoolean(prefs::kWebIntentsEnabled);
}

bool IsWebIntentsEnabledInActiveBrowser() {
  Browser* browser = BrowserList::GetLastActive();
  if (!browser)
    browser = *BrowserList::begin();
  DCHECK(browser);

  return IsWebIntentsEnabled(browser->profile());
}

}  // namespace web_intents