Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(784)

Side by Side Diff: chrome/browser/ui/toolbar/encoding_menu_controller.cc

Issue 8879016: Add more per-tab preferences. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed "migration done" preference Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/ui/toolbar/encoding_menu_controller.h" 5 #include "chrome/browser/ui/toolbar/encoding_menu_controller.h"
6 6
7 #include "base/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/app/chrome_command_ids.h" 9 #include "chrome/app/chrome_command_ids.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 } 78 }
79 79
80 bool EncodingMenuController::IsItemChecked( 80 bool EncodingMenuController::IsItemChecked(
81 Profile* browser_profile, 81 Profile* browser_profile,
82 const std::string& current_tab_encoding, 82 const std::string& current_tab_encoding,
83 int item_id) { 83 int item_id) {
84 if (!DoesCommandBelongToEncodingMenu(item_id)) 84 if (!DoesCommandBelongToEncodingMenu(item_id))
85 return false; 85 return false;
86 86
87 std::string encoding = current_tab_encoding; 87 std::string encoding = current_tab_encoding;
88 if (encoding.empty()) 88 if (encoding.empty()) {
89 encoding = browser_profile->GetPrefs()->GetString(prefs::kDefaultCharset); 89 encoding =
90 browser_profile->GetPrefs()->GetString(prefs::kGlobalDefaultCharset);
91 }
90 92
91 if (item_id == IDC_ENCODING_AUTO_DETECT) { 93 if (item_id == IDC_ENCODING_AUTO_DETECT) {
92 return browser_profile->GetPrefs()->GetBoolean( 94 return browser_profile->GetPrefs()->GetBoolean(
93 prefs::kWebKitUsesUniversalDetector); 95 prefs::kWebKitUsesUniversalDetector);
94 } 96 }
95 97
96 if (!encoding.empty()) { 98 if (!encoding.empty()) {
97 return encoding == 99 return encoding ==
98 CharacterEncoding::GetCanonicalEncodingNameByCommandId(item_id); 100 CharacterEncoding::GetCanonicalEncodingNameByCommandId(item_id);
99 } 101 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 for (it = encodings->begin(); it != encodings->end(); ++it) { 133 for (it = encodings->begin(); it != encodings->end(); ++it) {
132 if (it->encoding_id) { 134 if (it->encoding_id) {
133 string16 encoding = it->encoding_display_name; 135 string16 encoding = it->encoding_display_name;
134 base::i18n::AdjustStringForLocaleDirection(&encoding); 136 base::i18n::AdjustStringForLocaleDirection(&encoding);
135 menu_items->push_back(EncodingMenuItem(it->encoding_id, encoding)); 137 menu_items->push_back(EncodingMenuItem(it->encoding_id, encoding));
136 } else { 138 } else {
137 menu_items->push_back(separator); 139 menu_items->push_back(separator);
138 } 140 }
139 } 141 }
140 } 142 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698