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

Side by Side Diff: chrome/browser/content_setting_combo_model.cc

Issue 3159031: Remove wstrings from bookmarks, part 12. (Closed)
Patch Set: rebased ToT Created 10 years, 4 months 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
OLDNEW
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 #include "chrome/browser/content_setting_combo_model.h" 5 #include "chrome/browser/content_setting_combo_model.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/string16.h"
9 #include "chrome/common/chrome_switches.h" 10 #include "chrome/common/chrome_switches.h"
10 #include "grit/generated_resources.h" 11 #include "grit/generated_resources.h"
11 12
12 namespace { 13 namespace {
13 14
14 // The settings shown in the combobox if show_session_ is false; 15 // The settings shown in the combobox if show_session_ is false;
15 const ContentSetting kNoSessionSettings[] = { CONTENT_SETTING_ALLOW, 16 const ContentSetting kNoSessionSettings[] = { CONTENT_SETTING_ALLOW,
16 CONTENT_SETTING_BLOCK }; 17 CONTENT_SETTING_BLOCK };
17 18
18 // The settings shown in the combobox if show_session_ is true; 19 // The settings shown in the combobox if show_session_ is true;
(...skipping 21 matching lines...) Expand all
40 41
41 int ContentSettingComboModel::GetItemCount() { 42 int ContentSettingComboModel::GetItemCount() {
42 if (show_session_) { 43 if (show_session_) {
43 return disable_cookie_prompt_ ? 44 return disable_cookie_prompt_ ?
44 arraysize(kSessionSettings) : arraysize(kSessionAskSettings); 45 arraysize(kSessionSettings) : arraysize(kSessionAskSettings);
45 } else { 46 } else {
46 return arraysize(kNoSessionSettings); 47 return arraysize(kNoSessionSettings);
47 } 48 }
48 } 49 }
49 50
50 std::wstring ContentSettingComboModel::GetItemAt(int index) { 51 string16 ContentSettingComboModel::GetItemAt(int index) {
51 switch (SettingForIndex(index)) { 52 switch (SettingForIndex(index)) {
52 case CONTENT_SETTING_ALLOW: 53 case CONTENT_SETTING_ALLOW:
53 return l10n_util::GetString(IDS_EXCEPTIONS_ALLOW_BUTTON); 54 return l10n_util::GetStringUTF16(IDS_EXCEPTIONS_ALLOW_BUTTON);
54 case CONTENT_SETTING_BLOCK: 55 case CONTENT_SETTING_BLOCK:
55 return l10n_util::GetString(IDS_EXCEPTIONS_BLOCK_BUTTON); 56 return l10n_util::GetStringUTF16(IDS_EXCEPTIONS_BLOCK_BUTTON);
56 case CONTENT_SETTING_ASK: 57 case CONTENT_SETTING_ASK:
57 return l10n_util::GetString(IDS_EXCEPTIONS_ASK_BUTTON); 58 return l10n_util::GetStringUTF16(IDS_EXCEPTIONS_ASK_BUTTON);
58 case CONTENT_SETTING_SESSION_ONLY: 59 case CONTENT_SETTING_SESSION_ONLY:
59 return l10n_util::GetString(IDS_EXCEPTIONS_SESSION_ONLY_BUTTON); 60 return l10n_util::GetStringUTF16(IDS_EXCEPTIONS_SESSION_ONLY_BUTTON);
60 default: 61 default:
61 NOTREACHED(); 62 NOTREACHED();
62 } 63 }
63 return std::wstring(); 64 return string16();
64 } 65 }
65 66
66 ContentSetting ContentSettingComboModel::SettingForIndex(int index) { 67 ContentSetting ContentSettingComboModel::SettingForIndex(int index) {
67 if (show_session_) { 68 if (show_session_) {
68 return disable_cookie_prompt_ ? 69 return disable_cookie_prompt_ ?
69 kSessionSettings[index] : kSessionAskSettings[index]; 70 kSessionSettings[index] : kSessionAskSettings[index];
70 } else { 71 } else {
71 return kNoSessionSettings[index]; 72 return kNoSessionSettings[index];
72 } 73 }
73 } 74 }
74 75
75 int ContentSettingComboModel::IndexForSetting(ContentSetting setting) { 76 int ContentSettingComboModel::IndexForSetting(ContentSetting setting) {
76 for (int i = 0; i < GetItemCount(); ++i) 77 for (int i = 0; i < GetItemCount(); ++i)
77 if (SettingForIndex(i) == setting) 78 if (SettingForIndex(i) == setting)
78 return i; 79 return i;
79 NOTREACHED(); 80 NOTREACHED();
80 return 0; 81 return 0;
81 } 82 }
82 83
OLDNEW
« no previous file with comments | « chrome/browser/content_setting_combo_model.h ('k') | chrome/browser/default_encoding_combo_model.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698