OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 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_DEFAULT_ENCODING_COMBO_MODEL_H_ | 5 #ifndef CHROME_BROWSER_DEFAULT_ENCODING_COMBO_MODEL_H_ |
6 #define CHROME_BROWSER_DEFAULT_ENCODING_COMBO_MODEL_H_ | 6 #define CHROME_BROWSER_DEFAULT_ENCODING_COMBO_MODEL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "app/combobox_model.h" | 12 #include "app/combobox_model.h" |
13 #include "chrome/browser/character_encoding.h" | 13 #include "chrome/browser/character_encoding.h" |
14 | 14 |
15 class Profile; | 15 class Profile; |
16 | 16 |
17 class DefaultEncodingComboboxModel : public ComboboxModel { | 17 class DefaultEncodingComboboxModel : public ComboboxModel { |
18 public: | 18 public: |
19 DefaultEncodingComboboxModel(); | 19 DefaultEncodingComboboxModel(); |
20 virtual ~DefaultEncodingComboboxModel() {} | 20 virtual ~DefaultEncodingComboboxModel(); |
21 | 21 |
22 // Overridden from ComboboxModel. | 22 // Overridden from ComboboxModel. |
23 virtual int GetItemCount() { | 23 virtual int GetItemCount(); |
24 return static_cast<int>(sorted_encoding_list_.size()); | |
25 } | |
26 | 24 |
27 virtual string16 GetItemAt(int index); | 25 virtual string16 GetItemAt(int index); |
28 | 26 |
29 std::string GetEncodingCharsetByIndex(int index); | 27 std::string GetEncodingCharsetByIndex(int index); |
30 | 28 |
31 int GetSelectedEncodingIndex(Profile* profile); | 29 int GetSelectedEncodingIndex(Profile* profile); |
32 | 30 |
33 private: | 31 private: |
34 std::vector<CharacterEncoding::EncodingInfo> sorted_encoding_list_; | 32 std::vector<CharacterEncoding::EncodingInfo> sorted_encoding_list_; |
35 | 33 |
36 DISALLOW_COPY_AND_ASSIGN(DefaultEncodingComboboxModel); | 34 DISALLOW_COPY_AND_ASSIGN(DefaultEncodingComboboxModel); |
37 }; | 35 }; |
38 | 36 |
39 #endif // CHROME_BROWSER_DEFAULT_ENCODING_COMBO_MODEL_H_ | 37 #endif // CHROME_BROWSER_DEFAULT_ENCODING_COMBO_MODEL_H_ |
OLD | NEW |