| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_CHARACTER_ENCODING_H_ | 5 #ifndef CHROME_BROWSER_CHARACTER_ENCODING_H_ |
| 6 #define CHROME_BROWSER_CHARACTER_ENCODING_H_ | 6 #define CHROME_BROWSER_CHARACTER_ENCODING_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 "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/string16.h" | 13 #include "base/string16.h" |
| 14 | 14 |
| 15 class CharacterEncoding { | 15 class CharacterEncoding { |
| 16 public: | 16 public: |
| 17 // Enumeration of the types of Browser encoding name we | 17 // Enumeration of the types of Browser encoding name we |
| 18 // currently support. This is defined outside of Browser | 18 // currently support. This is defined outside of Browser |
| 19 // to avoid cyclical dependencies. | 19 // to avoid cyclical dependencies. |
| 20 | 20 |
| 21 // Structure to save encoding information. | 21 // Structure to save encoding information. |
| 22 struct EncodingInfo { | 22 struct EncodingInfo { |
| 23 explicit EncodingInfo(int id); | 23 explicit EncodingInfo(int id); |
| 24 // Gets string key of EncodingInfo. With this method, we can use | 24 // Gets string key of EncodingInfo. With this method, we can use |
| 25 // l10n_util::SortVectorWithStringKey to sort the encoding menu items | 25 // l10n_util::SortVectorWithStringKey to sort the encoding menu items |
| 26 // by current locale character sequence. We need to keep the order within | 26 // by current locale character sequence. We need to keep the order within |
| 27 // encoding category name, that's why we use category name as key. | 27 // encoding category name, that's why we use category name as key. |
| 28 const std::wstring& GetStringKey() const { return encoding_category_name; } | 28 const string16& GetStringKey() const { return encoding_category_name; } |
| 29 | 29 |
| 30 // Encoding command id. | 30 // Encoding command id. |
| 31 int encoding_id; | 31 int encoding_id; |
| 32 // Encoding display name. | 32 // Encoding display name. |
| 33 std::wstring encoding_display_name; | 33 string16 encoding_display_name; |
| 34 // Encoding category name. | 34 // Encoding category name. |
| 35 std::wstring encoding_category_name; | 35 string16 encoding_category_name; |
| 36 }; | 36 }; |
| 37 | 37 |
| 38 // Return canonical encoding name according to the command ID. | 38 // Return canonical encoding name according to the command ID. |
| 39 // THIS FUNCTION IS NOT THREADSAFE. You must run this function | 39 // THIS FUNCTION IS NOT THREADSAFE. You must run this function |
| 40 // only in UI thread. | 40 // only in UI thread. |
| 41 static std::string GetCanonicalEncodingNameByCommandId(int id); | 41 static std::string GetCanonicalEncodingNameByCommandId(int id); |
| 42 | 42 |
| 43 // Return display name of canonical encoding according to the command | 43 // Return display name of canonical encoding according to the command |
| 44 // ID. THIS FUNCTION IS NOT THREADSAFE. You must run this function | 44 // ID. THIS FUNCTION IS NOT THREADSAFE. You must run this function |
| 45 // only in UI thread. | 45 // only in UI thread. |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 // valid, return corresponding encoding command id. Otherwise return 0; | 98 // valid, return corresponding encoding command id. Otherwise return 0; |
| 99 static int GetCommandIdByCanonicalEncodingName( | 99 static int GetCommandIdByCanonicalEncodingName( |
| 100 const std::string& encoding_name); | 100 const std::string& encoding_name); |
| 101 | 101 |
| 102 private: | 102 private: |
| 103 // Disallow instantiating it since this class only contains static methods. | 103 // Disallow instantiating it since this class only contains static methods. |
| 104 DISALLOW_IMPLICIT_CONSTRUCTORS(CharacterEncoding); | 104 DISALLOW_IMPLICIT_CONSTRUCTORS(CharacterEncoding); |
| 105 }; | 105 }; |
| 106 | 106 |
| 107 #endif // CHROME_BROWSER_CHARACTER_ENCODING_H_ | 107 #endif // CHROME_BROWSER_CHARACTER_ENCODING_H_ |
| OLD | NEW |