| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2010 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_BROWSER_UI_TOOLBAR_ENCODING_MENU_CONTROLLER_H_ | |
| 6 #define CHROME_BROWSER_UI_TOOLBAR_ENCODING_MENU_CONTROLLER_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 #include <utility> | |
| 10 #include <vector> | |
| 11 | |
| 12 #include "base/gtest_prod_util.h" | |
| 13 #include "base/macros.h" | |
| 14 #include "base/strings/string16.h" | |
| 15 | |
| 16 class Profile; | |
| 17 | |
| 18 // Cross-platform logic needed for the encoding menu. | |
| 19 // For now, we don't need to track state so all methods are static. | |
| 20 class EncodingMenuController { | |
| 21 FRIEND_TEST_ALL_PREFIXES(EncodingMenuControllerTest, EncodingIDsBelongTest); | |
| 22 FRIEND_TEST_ALL_PREFIXES(EncodingMenuControllerTest, IsItemChecked); | |
| 23 | |
| 24 public: | |
| 25 typedef std::pair<int, base::string16> EncodingMenuItem; | |
| 26 typedef std::vector<EncodingMenuItem> EncodingMenuItemList; | |
| 27 | |
| 28 public: | |
| 29 EncodingMenuController() {} | |
| 30 | |
| 31 // Given a command ID, does this command belong to the encoding menu? | |
| 32 bool DoesCommandBelongToEncodingMenu(int id); | |
| 33 | |
| 34 // Returns true if the given encoding menu item (specified by item_id) | |
| 35 // is checked. Note that this header is included from objc, where the name | |
| 36 // "id" is reserved. | |
| 37 bool IsItemChecked(Profile* browser_profile, | |
| 38 const std::string& current_tab_encoding, | |
| 39 int item_id); | |
| 40 | |
| 41 // Fills in a list of menu items in the order they should appear in the menu. | |
| 42 // Items whose ids are 0 are separators. | |
| 43 void GetEncodingMenuItems(Profile* profile, | |
| 44 EncodingMenuItemList* menu_items); | |
| 45 | |
| 46 private: | |
| 47 // List of all valid encoding GUI IDs. | |
| 48 static const int kValidEncodingIds[]; | |
| 49 const int* ValidGUIEncodingIDs(); | |
| 50 int NumValidGUIEncodingIDs(); | |
| 51 | |
| 52 DISALLOW_COPY_AND_ASSIGN(EncodingMenuController); | |
| 53 }; | |
| 54 | |
| 55 #endif // CHROME_BROWSER_UI_TOOLBAR_ENCODING_MENU_CONTROLLER_H_ | |
| OLD | NEW |