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

Side by Side Diff: chrome/browser/bookmarks/enhanced_bookmarks_features.cc

Issue 1253953002: Componentize enhanced_bookmark_features.{h,cc}. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert change in //chrome/common/DEPS that broke checkdeps Created 5 years, 4 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
OLDNEW
(Empty)
1 // Copyright 2013 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 "chrome/browser/bookmarks/enhanced_bookmarks_features.h"
6
7 #include <string>
8
9 #include "base/command_line.h"
10 #include "base/prefs/pref_service.h"
11 #include "build/build_config.h"
12 #include "chrome/common/chrome_switches.h"
13 #include "components/variations/variations_associated_data.h"
14
15 namespace {
16
17 const char kFieldTrialName[] = "EnhancedBookmarks";
18
19 } // namespace
20
21 bool IsEnhancedBookmarksEnabled() {
22 // Enhanced bookmarks is not used on desktop, so it shouldn't be calling this
23 // function.
24 #if !defined(OS_IOS) && !defined(OS_ANDROID)
25 NOTREACHED();
26 #endif // !defined(OS_IOS) || !defined(OS_ANDROID)
27
28 // kEnhancedBookmarksExperiment flag could have values "", "1" and "0". "" -
29 // default, "0" - user opted out, "1" - user opted in. Tests also use the
30 // command line flag to force enhanced bookmark to be on.
31 std::string switch_value =
32 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
33 switches::kEnhancedBookmarksExperiment);
34 if (switch_value == "1")
35 return true;
36 if (switch_value == "0")
37 return false;
38
39 // Check that the "id" param is present. This is a legacy of the desktop
40 // implementation providing the extension id via param. This probably should
41 // be replaced with code that checks the experiment name instead.
42 return !variations::GetVariationParamValue(kFieldTrialName, "id").empty();
43 }
44
45 bool IsEnableDomDistillerSet() {
46 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
47 switches::kEnableDomDistiller)) {
48 return true;
49 }
50 if (variations::GetVariationParamValue(kFieldTrialName,
51 "enable-dom-distiller") == "1")
52 return true;
53
54 return false;
55 }
56
57 bool IsEnableSyncArticlesSet() {
58 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
59 switches::kEnableSyncArticles)) {
60 return true;
61 }
62 if (variations::GetVariationParamValue(kFieldTrialName,
63 "enable-sync-articles") == "1")
64 return true;
65
66 return false;
67 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698