OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_EXTENSIONS_MENU_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_MENU_MANAGER_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_MENU_MANAGER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_MENU_MANAGER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 bool Contains(Context context) const { | 139 bool Contains(Context context) const { |
140 return (value_ & context) > 0; | 140 return (value_ & context) > 0; |
141 } | 141 } |
142 | 142 |
143 void Add(Context context) { | 143 void Add(Context context) { |
144 value_ |= context; | 144 value_ |= context; |
145 } | 145 } |
146 | 146 |
147 std::unique_ptr<base::Value> ToValue() const { | 147 std::unique_ptr<base::Value> ToValue() const { |
148 return std::unique_ptr<base::Value>( | 148 return std::unique_ptr<base::Value>( |
149 new base::FundamentalValue(static_cast<int>(value_))); | 149 new base::Value(static_cast<int>(value_))); |
150 } | 150 } |
151 | 151 |
152 bool Populate(const base::Value& value) { | 152 bool Populate(const base::Value& value) { |
153 int int_value; | 153 int int_value; |
154 if (!value.GetAsInteger(&int_value) || int_value < 0) | 154 if (!value.GetAsInteger(&int_value) || int_value < 0) |
155 return false; | 155 return false; |
156 value_ = int_value; | 156 value_ = int_value; |
157 return true; | 157 return true; |
158 } | 158 } |
159 | 159 |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 | 412 |
413 // Owned by ExtensionSystem. | 413 // Owned by ExtensionSystem. |
414 StateStore* store_; | 414 StateStore* store_; |
415 | 415 |
416 DISALLOW_COPY_AND_ASSIGN(MenuManager); | 416 DISALLOW_COPY_AND_ASSIGN(MenuManager); |
417 }; | 417 }; |
418 | 418 |
419 } // namespace extensions | 419 } // namespace extensions |
420 | 420 |
421 #endif // CHROME_BROWSER_EXTENSIONS_MENU_MANAGER_H_ | 421 #endif // CHROME_BROWSER_EXTENSIONS_MENU_MANAGER_H_ |
OLD | NEW |