app_shell: Add version number in user agent
[chromium-blink-merge.git] / chrome / browser / ui / toolbar / encoding_menu_controller.h
blobea4563ac6c9df9adb0e100538730c48b188e8afb
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.
5 #ifndef CHROME_BROWSER_UI_TOOLBAR_ENCODING_MENU_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_TOOLBAR_ENCODING_MENU_CONTROLLER_H_
8 #include <utility>
9 #include <string>
10 #include <vector>
12 #include "base/basictypes.h" // For DISALLOW_COPY_AND_ASSIGN
13 #include "base/gtest_prod_util.h"
14 #include "base/strings/string16.h"
16 class Profile;
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);
24 public:
25 typedef std::pair<int, base::string16> EncodingMenuItem;
26 typedef std::vector<EncodingMenuItem> EncodingMenuItemList;
28 public:
29 EncodingMenuController() {}
31 // Given a command ID, does this command belong to the encoding menu?
32 bool DoesCommandBelongToEncodingMenu(int id);
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);
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);
46 private:
47 // List of all valid encoding GUI IDs.
48 static const int kValidEncodingIds[];
49 const int* ValidGUIEncodingIDs();
50 int NumValidGUIEncodingIDs();
52 DISALLOW_COPY_AND_ASSIGN(EncodingMenuController);
55 #endif // CHROME_BROWSER_UI_TOOLBAR_ENCODING_MENU_CONTROLLER_H_