diff options
author | sdefresne <sdefresne@chromium.org> | 2015-07-27 12:18:00 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-07-27 19:18:57 +0000 |
commit | 0f2ef35a2de53103f42a7ab62ccc07aa34481e41 (patch) | |
tree | 7e6b89bd5a67371f5ba652948ce7886782970412 /chrome/browser/bookmarks | |
parent | f7701e71c321e821163217db2336241d240c563b (diff) | |
download | chromium_src-0f2ef35a2de53103f42a7ab62ccc07aa34481e41.zip chromium_src-0f2ef35a2de53103f42a7ab62ccc07aa34481e41.tar.gz chromium_src-0f2ef35a2de53103f42a7ab62ccc07aa34481e41.tar.bz2 |
Componentize enhanced_bookmark_features.{h,cc}.
Enhanced bookmarks and the DOM distiller are (or will be) used on
iOS and android. Move the function checking whether the features
are enabled into the respective component to allow sharing the code.
Move IsEnhancedBookmarksEnabled() function to the enhanced_bookmarks
component with supporting switches.
Move IsEnableDomDistillerSet() and IsEnableSyncArticlesSet() functions
to the dom_distiller component with supporting switches.
BUG=359565
Review URL: https://codereview.chromium.org/1253953002
Cr-Commit-Position: refs/heads/master@{#340526}
Diffstat (limited to 'chrome/browser/bookmarks')
-rw-r--r-- | chrome/browser/bookmarks/enhanced_bookmarks_features.cc | 67 | ||||
-rw-r--r-- | chrome/browser/bookmarks/enhanced_bookmarks_features.h | 17 |
2 files changed, 0 insertions, 84 deletions
diff --git a/chrome/browser/bookmarks/enhanced_bookmarks_features.cc b/chrome/browser/bookmarks/enhanced_bookmarks_features.cc deleted file mode 100644 index 4a33c1e..0000000 --- a/chrome/browser/bookmarks/enhanced_bookmarks_features.cc +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/bookmarks/enhanced_bookmarks_features.h" - -#include <string> - -#include "base/command_line.h" -#include "base/prefs/pref_service.h" -#include "build/build_config.h" -#include "chrome/common/chrome_switches.h" -#include "components/variations/variations_associated_data.h" - -namespace { - -const char kFieldTrialName[] = "EnhancedBookmarks"; - -} // namespace - -bool IsEnhancedBookmarksEnabled() { - // Enhanced bookmarks is not used on desktop, so it shouldn't be calling this - // function. -#if !defined(OS_IOS) && !defined(OS_ANDROID) - NOTREACHED(); -#endif // !defined(OS_IOS) || !defined(OS_ANDROID) - - // kEnhancedBookmarksExperiment flag could have values "", "1" and "0". "" - - // default, "0" - user opted out, "1" - user opted in. Tests also use the - // command line flag to force enhanced bookmark to be on. - std::string switch_value = - base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( - switches::kEnhancedBookmarksExperiment); - if (switch_value == "1") - return true; - if (switch_value == "0") - return false; - - // Check that the "id" param is present. This is a legacy of the desktop - // implementation providing the extension id via param. This probably should - // be replaced with code that checks the experiment name instead. - return !variations::GetVariationParamValue(kFieldTrialName, "id").empty(); -} - -bool IsEnableDomDistillerSet() { - if (base::CommandLine::ForCurrentProcess()->HasSwitch( - switches::kEnableDomDistiller)) { - return true; - } - if (variations::GetVariationParamValue(kFieldTrialName, - "enable-dom-distiller") == "1") - return true; - - return false; -} - -bool IsEnableSyncArticlesSet() { - if (base::CommandLine::ForCurrentProcess()->HasSwitch( - switches::kEnableSyncArticles)) { - return true; - } - if (variations::GetVariationParamValue(kFieldTrialName, - "enable-sync-articles") == "1") - return true; - - return false; -} diff --git a/chrome/browser/bookmarks/enhanced_bookmarks_features.h b/chrome/browser/bookmarks/enhanced_bookmarks_features.h deleted file mode 100644 index 3786f59..0000000 --- a/chrome/browser/bookmarks/enhanced_bookmarks_features.h +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_BOOKMARKS_ENHANCED_BOOKMARKS_FEATURES_H_ -#define CHROME_BROWSER_BOOKMARKS_ENHANCED_BOOKMARKS_FEATURES_H_ - -// Returns true if enhanced bookmarks is enabled. -bool IsEnhancedBookmarksEnabled(); - -// Returns true when flag enable-dom-distiller is set or enabled from Finch. -bool IsEnableDomDistillerSet(); - -// Returns true when flag enable-sync-articles is set or enabled from Finch. -bool IsEnableSyncArticlesSet(); - -#endif // CHROME_BROWSER_BOOKMARKS_ENHANCED_BOOKMARKS_FEATURES_H_ |