1// Copyright 2014 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#ifndef CHROME_COMMON_EXTENSIONS_FEATURES_CHROME_CHANNEL_FEATURE_FILTER_H_
6#define CHROME_COMMON_EXTENSIONS_FEATURES_CHROME_CHANNEL_FEATURE_FILTER_H_
7
8#include "chrome/common/chrome_version_info.h"
9#include "extensions/common/features/simple_feature_filter.h"
10
11namespace extensions {
12
13// This filter parses a "channel" key from feature value data and makes features
14// unavailable if they aren't stable enough for the current channel.
15class ChromeChannelFeatureFilter : public SimpleFeatureFilter {
16 public:
17  explicit ChromeChannelFeatureFilter(SimpleFeature* feature);
18  virtual ~ChromeChannelFeatureFilter();
19
20  // SimpleFeatureFilter implementation.
21  virtual std::string Parse(const base::DictionaryValue* value) OVERRIDE;
22  virtual Feature::Availability IsAvailableToManifest(
23      const std::string& extension_id,
24      Manifest::Type type,
25      Manifest::Location location,
26      int manifest_version,
27      Feature::Platform platform) const OVERRIDE;
28
29 private:
30  bool channel_has_been_set_;
31  chrome::VersionInfo::Channel channel_;
32};
33
34}  // namespace extensions
35
36#endif  // CHROME_COMMON_EXTENSIONS_FEATURES_CHROME_CHANNEL_FEATURE_FILTER_H_
37