| 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 #include "chrome/browser/encoding_menu_controller_delegate.h" | 5 #include "chrome/browser/encoding_menu_controller_delegate.h" |
| 6 | 6 |
| 7 #include "chrome/app/chrome_dll_resource.h" | 7 #include "chrome/app/chrome_dll_resource.h" |
| 8 #include "chrome/browser/browser.h" | 8 #include "chrome/browser/browser.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/character_encoding.h" | 10 #include "chrome/browser/character_encoding.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 browser_(browser) { | 21 browser_(browser) { |
| 22 } | 22 } |
| 23 | 23 |
| 24 bool EncodingMenuControllerDelegate::IsItemChecked(int id) const { | 24 bool EncodingMenuControllerDelegate::IsItemChecked(int id) const { |
| 25 Profile* profile = browser_->profile(); | 25 Profile* profile = browser_->profile(); |
| 26 if (!profile) | 26 if (!profile) |
| 27 return false; | 27 return false; |
| 28 TabContents* current_tab = browser_->GetSelectedTabContents(); | 28 TabContents* current_tab = browser_->GetSelectedTabContents(); |
| 29 if (!current_tab) | 29 if (!current_tab) |
| 30 return false; | 30 return false; |
| 31 std::wstring encoding_name = current_tab->GetEncoding(); | 31 std::wstring encoding_name = current_tab->encoding(); |
| 32 if (encoding_name.empty()) | 32 if (encoding_name.empty()) |
| 33 encoding_name = profile->GetPrefs()->GetString(prefs::kDefaultCharset); | 33 encoding_name = profile->GetPrefs()->GetString(prefs::kDefaultCharset); |
| 34 switch (id) { | 34 switch (id) { |
| 35 case IDC_ENCODING_AUTO_DETECT: | 35 case IDC_ENCODING_AUTO_DETECT: |
| 36 return profile->GetPrefs()->GetBoolean( | 36 return profile->GetPrefs()->GetBoolean( |
| 37 prefs::kWebKitUsesUniversalDetector); | 37 prefs::kWebKitUsesUniversalDetector); |
| 38 case IDC_ENCODING_UTF8: | 38 case IDC_ENCODING_UTF8: |
| 39 case IDC_ENCODING_UTF16LE: | 39 case IDC_ENCODING_UTF16LE: |
| 40 case IDC_ENCODING_ISO88591: | 40 case IDC_ENCODING_ISO88591: |
| 41 case IDC_ENCODING_WINDOWS1252: | 41 case IDC_ENCODING_WINDOWS1252: |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 if (l10n_util::AdjustStringForLocaleDirection(encoding, | 110 if (l10n_util::AdjustStringForLocaleDirection(encoding, |
| 111 &bidi_safe_encoding)) | 111 &bidi_safe_encoding)) |
| 112 encoding.swap(bidi_safe_encoding); | 112 encoding.swap(bidi_safe_encoding); |
| 113 encoding_menu->AppendMenuItem(*it, encoding, Menu::RADIO); | 113 encoding_menu->AppendMenuItem(*it, encoding, Menu::RADIO); |
| 114 } | 114 } |
| 115 else | 115 else |
| 116 encoding_menu->AppendSeparator(); | 116 encoding_menu->AppendSeparator(); |
| 117 } | 117 } |
| 118 } | 118 } |
| 119 | 119 |
| OLD | NEW |