Ignore non-active fullscreen windows for shelf state.
[chromium-blink-merge.git] / extensions / common / feature_switch.h
blobece1b01fd26b94e181ec126f2a22b60abcd399be
1 // Copyright 2013 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 #ifndef EXTENSIONS_COMMON_FEATURE_SWITCH_H_
6 #define EXTENSIONS_COMMON_FEATURE_SWITCH_H_
8 #include <string>
10 #include "base/basictypes.h"
12 class CommandLine;
14 namespace extensions {
16 // A switch that can turn a feature on or off. Typically controlled via
17 // command-line switches but can be overridden, e.g., for testing.
18 class FeatureSwitch {
19 public:
20 static FeatureSwitch* easy_off_store_install();
21 static FeatureSwitch* global_commands();
22 static FeatureSwitch* script_badges();
23 static FeatureSwitch* script_bubble();
24 static FeatureSwitch* prompt_for_external_extensions();
25 static FeatureSwitch* error_console();
27 enum DefaultValue {
28 DEFAULT_ENABLED,
29 DEFAULT_DISABLED
32 enum OverrideValue {
33 OVERRIDE_NONE,
34 OVERRIDE_ENABLED,
35 OVERRIDE_DISABLED
38 // A temporary override for the switch value.
39 class ScopedOverride {
40 public:
41 ScopedOverride(FeatureSwitch* feature, bool override_value);
42 ~ScopedOverride();
43 private:
44 FeatureSwitch* feature_;
45 FeatureSwitch::OverrideValue previous_value_;
46 DISALLOW_COPY_AND_ASSIGN(ScopedOverride);
49 FeatureSwitch(const char* switch_name,
50 DefaultValue default_value);
51 FeatureSwitch(const CommandLine* command_line,
52 const char* switch_name,
53 DefaultValue default_value);
55 // Consider using ScopedOverride instead.
56 void SetOverrideValue(OverrideValue value);
57 OverrideValue GetOverrideValue() const;
59 bool IsEnabled() const;
61 std::string GetLegacyEnableFlag() const;
62 std::string GetLegacyDisableFlag() const;
64 private:
65 void Init(const CommandLine* command_line,
66 const char* switch_name,
67 DefaultValue default_value);
69 const CommandLine* command_line_;
70 const char* switch_name_;
71 bool default_value_;
72 OverrideValue override_value_;
74 DISALLOW_COPY_AND_ASSIGN(FeatureSwitch);
77 } // namespace extensions
79 #endif // EXTENSIONS_COMMON_FEATURE_SWITCH_H_