Rename GetIconID to GetIconId
[chromium-blink-merge.git] / components / enhanced_bookmarks / enhanced_bookmark_features.cc
blob4ec0712320b0d1ea59bbba7571858bc494b131d6
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"
7 #include <string>
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 {
16 namespace {
17 const char kFieldTrialName[] = "EnhancedBookmarks";
18 } // namespace
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")
28 return true;
29 if (switch_value == "0")
30 return false;
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
40 #endif