Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(214)

Side by Side Diff: chrome/browser/intents/web_intents_util.cc

Issue 10387155: Web Intents: Remove the flag and compile-time define. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "chrome/browser/intents/web_intents_util.h" 5 #include "chrome/browser/intents/web_intents_util.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "chrome/browser/prefs/pref_service.h" 8 #include "chrome/browser/prefs/pref_service.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/ui/browser_list.h" 10 #include "chrome/browser/ui/browser_list.h"
11 #include "chrome/common/pref_names.h" 11 #include "chrome/common/pref_names.h"
12 #include "chrome/common/url_constants.h" 12 #include "chrome/common/url_constants.h"
13 #include "content/public/common/content_switches.h" 13 #include "content/public/common/content_switches.h"
14 14
15 namespace web_intents { 15 namespace web_intents {
16 16
17 void RegisterUserPrefs(PrefService* user_prefs) { 17 void RegisterUserPrefs(PrefService* user_prefs) {
18 user_prefs->RegisterBooleanPref(prefs::kWebIntentsEnabled, true, 18 user_prefs->RegisterBooleanPref(prefs::kWebIntentsEnabled, true,
19 PrefService::SYNCABLE_PREF); 19 PrefService::SYNCABLE_PREF);
20 } 20 }
21 21
22 bool IsWebIntentsEnabled(Profile* profile) { 22 bool IsWebIntentsEnabled(Profile* profile) {
23 bool disabled_flag = CommandLine::ForCurrentProcess()->HasSwitch( 23 return profile->GetPrefs()->GetBoolean(prefs::kWebIntentsEnabled);
24 switches::kDisableWebIntents);
25
26 bool enabled_pref = profile->GetPrefs()->GetBoolean(
27 prefs::kWebIntentsEnabled);
28
29 return !disabled_flag && enabled_pref;
30 } 24 }
31 25
32 bool IsWebIntentsEnabledInActiveBrowser() { 26 bool IsWebIntentsEnabledInActiveBrowser() {
33 Browser* browser = BrowserList::GetLastActive(); 27 Browser* browser = BrowserList::GetLastActive();
34 if (!browser) 28 if (!browser)
35 browser = *BrowserList::begin(); 29 browser = *BrowserList::begin();
36 DCHECK(browser); 30 DCHECK(browser);
37 31
38 return IsWebIntentsEnabled(browser->profile()); 32 return IsWebIntentsEnabled(browser->profile());
39 } 33 }
40 34
41 } // namespace web_intents 35 } // namespace web_intents
OLDNEW
« no previous file with comments | « chrome/browser/content_settings/host_content_settings_map.cc ('k') | chrome/browser/prefs/browser_prefs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698