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

Side by Side Diff: components/enhanced_bookmarks/enhanced_bookmark_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
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/bookmarks/enhanced_bookmarks_features.h" 5 #include "components/enhanced_bookmarks/enhanced_bookmark_features.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/prefs/pref_service.h" 10 #include "components/enhanced_bookmarks/enhanced_bookmark_switches.h"
11 #include "build/build_config.h"
12 #include "chrome/common/chrome_switches.h"
13 #include "components/variations/variations_associated_data.h" 11 #include "components/variations/variations_associated_data.h"
14 12
13 #if defined(OS_IOS) || defined(OS_ANDROID)
14
15 namespace enhanced_bookmarks {
15 namespace { 16 namespace {
16
17 const char kFieldTrialName[] = "EnhancedBookmarks"; 17 const char kFieldTrialName[] = "EnhancedBookmarks";
18
19 } // namespace 18 } // namespace
20 19
21 bool IsEnhancedBookmarksEnabled() { 20 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". "" - 21 // kEnhancedBookmarksExperiment flag could have values "", "1" and "0". "" -
29 // default, "0" - user opted out, "1" - user opted in. Tests also use the 22 // default, "0" - user opted out, "1" - user opted in. Tests also use the
30 // command line flag to force enhanced bookmark to be on. 23 // command line flag to force enhanced bookmark to be on.
31 std::string switch_value = 24 std::string switch_value =
32 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 25 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
33 switches::kEnhancedBookmarksExperiment); 26 switches::kEnhancedBookmarksExperiment);
34 if (switch_value == "1") 27 if (switch_value == "1")
35 return true; 28 return true;
36 if (switch_value == "0") 29 if (switch_value == "0")
37 return false; 30 return false;
38 31
39 // Check that the "id" param is present. This is a legacy of the desktop 32 // 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 33 // implementation providing the extension id via param. This probably should
41 // be replaced with code that checks the experiment name instead. 34 // be replaced with code that checks the experiment name instead.
42 return !variations::GetVariationParamValue(kFieldTrialName, "id").empty(); 35 return !variations::GetVariationParamValue(kFieldTrialName, "id").empty();
43 } 36 }
44 37
45 bool IsEnableDomDistillerSet() { 38 } // namespace enhanced_bookmarks
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 39
54 return false; 40 #endif
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
« no previous file with comments | « components/enhanced_bookmarks/enhanced_bookmark_features.h ('k') | components/enhanced_bookmarks/enhanced_bookmark_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698