blob: d362f68e6ec175c6b43885620aef2e8617cb2bad (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_ENCODING_MENU_CONTROLLER_H_
#define CHROME_BROWSER_ENCODING_MENU_CONTROLLER_H_
#include <utility>
#include <string>
#include <vector>
#include "base/basictypes.h" // For DISALLOW_COPY_AND_ASSIGN
#include "base/string16.h"
#include "testing/gtest/include/gtest/gtest_prod.h" // For FRIEND_TEST
class Browser;
class Profile;
// Cross-platform logic needed for the encoding menu.
// For now, we don't need to track state so all methods are static.
class EncodingMenuController {
FRIEND_TEST(EncodingMenuControllerTest, EncodingIDsBelongTest);
FRIEND_TEST(EncodingMenuControllerTest, IsItemChecked);
public:
typedef std::pair<int, string16> EncodingMenuItem;
typedef std::vector<EncodingMenuItem> EncodingMenuItemList;
public:
EncodingMenuController() {}
// Given a command ID, does this command belong to the encoding menu?
bool DoesCommandBelongToEncodingMenu(int id);
// Returns true if the given encoding menu item (specified by item_id)
// is checked. Note that this header is included from objc, where the name
// "id" is reserved.
bool IsItemChecked(Profile* browser_profile,
const std::string& current_tab_encoding,
int item_id);
// Fills in a list of menu items in the order they should appear in the menu.
// Items whose ids are 0 are separators.
void GetEncodingMenuItems(Profile* profile,
EncodingMenuItemList* menuItems);
private:
// List of all valid encoding GUI IDs.
static const int kValidEncodingIds[];
const int* ValidGUIEncodingIDs();
int NumValidGUIEncodingIDs();
DISALLOW_COPY_AND_ASSIGN(EncodingMenuController);
};
#endif // CHROME_BROWSER_ENCODING_MENU_CONTROLLER_H_
|