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
3 // found in the LICENSE file.
5 #include "components/enhanced_bookmarks/enhanced_bookmark_features.h"
9 #include "base/command_line.h"
10 #include "components/enhanced_bookmarks/enhanced_bookmark_switches.h"
11 #include "components/variations/variations_associated_data.h"
13 #if defined(OS_IOS) || defined(OS_ANDROID)
15 namespace enhanced_bookmarks
{
17 const char kFieldTrialName
[] = "EnhancedBookmarks";
20 bool IsEnhancedBookmarksEnabled() {
21 // kEnhancedBookmarksExperiment flag could have values "", "1" and "0". "" -
22 // default, "0" - user opted out, "1" - user opted in. Tests also use the
23 // command line flag to force enhanced bookmark to be on.
24 std::string switch_value
=
25 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
26 switches::kEnhancedBookmarksExperiment
);
27 if (switch_value
== "1")
29 if (switch_value
== "0")
32 // Check that the "id" param is present. This is a legacy of the desktop
33 // implementation providing the extension id via param. This probably should
34 // be replaced with code that checks the experiment name instead.
35 return !variations::GetVariationParamValue(kFieldTrialName
, "id").empty();
38 } // namespace enhanced_bookmarks