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

Side by Side Diff: chrome/browser/ui/views/content_setting_bubble_contents.cc

Issue 8113031: Change std::wstring to string16 for views::Label and views::Link (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 9 years, 2 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/views/content_setting_bubble_contents.h" 5 #include "chrome/browser/ui/views/content_setting_bubble_contents.h"
6 6
7 #if defined(TOOLKIT_USES_GTK) 7 #if defined(TOOLKIT_USES_GTK)
8 #include <gdk/gdk.h> 8 #include <gdk/gdk.h>
9 #endif 9 #endif
10 10
11 #include <algorithm>
12 #include <string>
13 #include <set>
14 #include <vector>
15
11 #include "base/utf_string_conversions.h" 16 #include "base/utf_string_conversions.h"
12 #include "chrome/browser/content_settings/host_content_settings_map.h" 17 #include "chrome/browser/content_settings/host_content_settings_map.h"
13 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" 19 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h"
15 #include "chrome/browser/ui/views/browser_dialogs.h" 20 #include "chrome/browser/ui/views/browser_dialogs.h"
16 #include "chrome/browser/ui/views/bubble/bubble.h" 21 #include "chrome/browser/ui/views/bubble/bubble.h"
17 #include "content/browser/tab_contents/tab_contents.h" 22 #include "content/browser/tab_contents/tab_contents.h"
18 #include "content/common/content_notification_types.h" 23 #include "content/common/content_notification_types.h"
19 #include "content/common/notification_source.h" 24 #include "content/common/notification_source.h"
20 #include "grit/generated_resources.h" 25 #include "grit/generated_resources.h"
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 const int single_column_set_id = 0; 192 const int single_column_set_id = 0;
188 views::ColumnSet* column_set = layout->AddColumnSet(single_column_set_id); 193 views::ColumnSet* column_set = layout->AddColumnSet(single_column_set_id);
189 column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL, 1, 194 column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL, 1,
190 GridLayout::USE_PREF, 0, 0); 195 GridLayout::USE_PREF, 0, 0);
191 196
192 const ContentSettingBubbleModel::BubbleContent& bubble_content = 197 const ContentSettingBubbleModel::BubbleContent& bubble_content =
193 content_setting_bubble_model_->bubble_content(); 198 content_setting_bubble_model_->bubble_content();
194 bool bubble_content_empty = true; 199 bool bubble_content_empty = true;
195 200
196 if (!bubble_content.title.empty()) { 201 if (!bubble_content.title.empty()) {
197 views::Label* title_label = new views::Label(UTF8ToWide( 202 views::Label* title_label = new views::Label(UTF8ToUTF16(
198 bubble_content.title)); 203 bubble_content.title));
199 layout->StartRow(0, single_column_set_id); 204 layout->StartRow(0, single_column_set_id);
200 layout->AddView(title_label); 205 layout->AddView(title_label);
201 bubble_content_empty = false; 206 bubble_content_empty = false;
202 } 207 }
203 208
204 const std::set<std::string>& plugins = bubble_content.resource_identifiers; 209 const std::set<std::string>& plugins = bubble_content.resource_identifiers;
205 if (!plugins.empty()) { 210 if (!plugins.empty()) {
206 if (!bubble_content_empty) 211 if (!bubble_content_empty)
207 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); 212 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
208 for (std::set<std::string>::const_iterator it = plugins.begin(); 213 for (std::set<std::string>::const_iterator it = plugins.begin();
209 it != plugins.end(); ++it) { 214 it != plugins.end(); ++it) {
210 std::wstring name = UTF16ToWide( 215 string16 name =
211 webkit::npapi::PluginList::Singleton()->GetPluginGroupName(*it)); 216 webkit::npapi::PluginList::Singleton()->GetPluginGroupName(*it);
212 if (name.empty()) 217 if (name.empty())
213 name = UTF8ToWide(*it); 218 name = UTF8ToUTF16(*it);
214 layout->StartRow(0, single_column_set_id); 219 layout->StartRow(0, single_column_set_id);
215 layout->AddView(new views::Label(name)); 220 layout->AddView(new views::Label(name));
216 bubble_content_empty = false; 221 bubble_content_empty = false;
217 } 222 }
218 } 223 }
219 224
220 if (content_setting_bubble_model_->content_type() == 225 if (content_setting_bubble_model_->content_type() ==
221 CONTENT_SETTINGS_TYPE_POPUPS) { 226 CONTENT_SETTINGS_TYPE_POPUPS) {
222 const int popup_column_set_id = 2; 227 const int popup_column_set_id = 2;
223 views::ColumnSet* popup_column_set = 228 views::ColumnSet* popup_column_set =
224 layout->AddColumnSet(popup_column_set_id); 229 layout->AddColumnSet(popup_column_set_id);
225 popup_column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL, 0, 230 popup_column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL, 0,
226 GridLayout::USE_PREF, 0, 0); 231 GridLayout::USE_PREF, 0, 0);
227 popup_column_set->AddPaddingColumn( 232 popup_column_set->AddPaddingColumn(
228 0, views::kRelatedControlHorizontalSpacing); 233 0, views::kRelatedControlHorizontalSpacing);
229 popup_column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL, 1, 234 popup_column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL, 1,
230 GridLayout::USE_PREF, 0, 0); 235 GridLayout::USE_PREF, 0, 0);
231 236
232 for (std::vector<ContentSettingBubbleModel::PopupItem>::const_iterator 237 for (std::vector<ContentSettingBubbleModel::PopupItem>::const_iterator
233 i(bubble_content.popup_items.begin()); 238 i(bubble_content.popup_items.begin());
234 i != bubble_content.popup_items.end(); ++i) { 239 i != bubble_content.popup_items.end(); ++i) {
235 if (!bubble_content_empty) 240 if (!bubble_content_empty)
236 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); 241 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
237 layout->StartRow(0, popup_column_set_id); 242 layout->StartRow(0, popup_column_set_id);
238 243
239 views::Link* link = new views::Link(UTF8ToWide(i->title)); 244 views::Link* link = new views::Link(UTF8ToUTF16(i->title));
240 link->set_listener(this); 245 link->set_listener(this);
241 link->SetElideInMiddle(true); 246 link->SetElideInMiddle(true);
242 popup_links_[link] = i - bubble_content.popup_items.begin(); 247 popup_links_[link] = i - bubble_content.popup_items.begin();
243 layout->AddView(new Favicon((*i).bitmap, this, link)); 248 layout->AddView(new Favicon((*i).bitmap, this, link));
244 layout->AddView(link); 249 layout->AddView(link);
245 bubble_content_empty = false; 250 bubble_content_empty = false;
246 } 251 }
247 } 252 }
248 253
249 const ContentSettingBubbleModel::RadioGroup& radio_group = 254 const ContentSettingBubbleModel::RadioGroup& radio_group =
(...skipping 24 matching lines...) Expand all
274 views::ColumnSet* indented_single_column_set = 279 views::ColumnSet* indented_single_column_set =
275 layout->AddColumnSet(indented_single_column_set_id); 280 layout->AddColumnSet(indented_single_column_set_id);
276 indented_single_column_set->AddPaddingColumn( 281 indented_single_column_set->AddPaddingColumn(
277 0, views::kPanelHorizIndentation); 282 0, views::kPanelHorizIndentation);
278 indented_single_column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL, 283 indented_single_column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL,
279 1, GridLayout::USE_PREF, 0, 0); 284 1, GridLayout::USE_PREF, 0, 0);
280 for (std::vector<ContentSettingBubbleModel::DomainList>::const_iterator i = 285 for (std::vector<ContentSettingBubbleModel::DomainList>::const_iterator i =
281 bubble_content.domain_lists.begin(); 286 bubble_content.domain_lists.begin();
282 i != bubble_content.domain_lists.end(); ++i) { 287 i != bubble_content.domain_lists.end(); ++i) {
283 layout->StartRow(0, single_column_set_id); 288 layout->StartRow(0, single_column_set_id);
284 views::Label* section_title = new views::Label(UTF8ToWide(i->title)); 289 views::Label* section_title = new views::Label(UTF8ToUTF16(i->title));
285 section_title->SetMultiLine(true); 290 section_title->SetMultiLine(true);
286 section_title->SetHorizontalAlignment(views::Label::ALIGN_LEFT); 291 section_title->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
287 layout->AddView(section_title, 1, 1, GridLayout::FILL, GridLayout::LEADING); 292 layout->AddView(section_title, 1, 1, GridLayout::FILL, GridLayout::LEADING);
288 for (std::set<std::string>::const_iterator j = i->hosts.begin(); 293 for (std::set<std::string>::const_iterator j = i->hosts.begin();
289 j != i->hosts.end(); ++j) { 294 j != i->hosts.end(); ++j) {
290 layout->StartRow(0, indented_single_column_set_id); 295 layout->StartRow(0, indented_single_column_set_id);
291 layout->AddView(new views::Label(UTF8ToWide(*j), domain_font)); 296 layout->AddView(new views::Label(UTF8ToUTF16(*j), domain_font));
292 } 297 }
293 bubble_content_empty = false; 298 bubble_content_empty = false;
294 } 299 }
295 300
296 if (!bubble_content.custom_link.empty()) { 301 if (!bubble_content.custom_link.empty()) {
297 custom_link_ = new views::Link(UTF8ToWide(bubble_content.custom_link)); 302 custom_link_ = new views::Link(UTF8ToUTF16(bubble_content.custom_link));
298 custom_link_->SetEnabled(bubble_content.custom_link_enabled); 303 custom_link_->SetEnabled(bubble_content.custom_link_enabled);
299 custom_link_->set_listener(this); 304 custom_link_->set_listener(this);
300 if (!bubble_content_empty) 305 if (!bubble_content_empty)
301 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); 306 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
302 layout->StartRow(0, single_column_set_id); 307 layout->StartRow(0, single_column_set_id);
303 layout->AddView(custom_link_); 308 layout->AddView(custom_link_);
304 bubble_content_empty = false; 309 bubble_content_empty = false;
305 } 310 }
306 311
307 if (!bubble_content_empty) { 312 if (!bubble_content_empty) {
308 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); 313 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
309 layout->StartRow(0, single_column_set_id); 314 layout->StartRow(0, single_column_set_id);
310 layout->AddView(new views::Separator, 1, 1, 315 layout->AddView(new views::Separator, 1, 1,
311 GridLayout::FILL, GridLayout::FILL); 316 GridLayout::FILL, GridLayout::FILL);
312 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); 317 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
313 } 318 }
314 319
315 const int double_column_set_id = 1; 320 const int double_column_set_id = 1;
316 views::ColumnSet* double_column_set = 321 views::ColumnSet* double_column_set =
317 layout->AddColumnSet(double_column_set_id); 322 layout->AddColumnSet(double_column_set_id);
318 double_column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 1, 323 double_column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 1,
319 GridLayout::USE_PREF, 0, 0); 324 GridLayout::USE_PREF, 0, 0);
320 double_column_set->AddPaddingColumn( 325 double_column_set->AddPaddingColumn(
321 0, views::kUnrelatedControlHorizontalSpacing); 326 0, views::kUnrelatedControlHorizontalSpacing);
322 double_column_set->AddColumn(GridLayout::TRAILING, GridLayout::CENTER, 0, 327 double_column_set->AddColumn(GridLayout::TRAILING, GridLayout::CENTER, 0,
323 GridLayout::USE_PREF, 0, 0); 328 GridLayout::USE_PREF, 0, 0);
324 329
325 layout->StartRow(0, double_column_set_id); 330 layout->StartRow(0, double_column_set_id);
326 manage_link_ = new views::Link(UTF8ToWide(bubble_content.manage_link)); 331 manage_link_ = new views::Link(UTF8ToUTF16(bubble_content.manage_link));
327 manage_link_->set_listener(this); 332 manage_link_->set_listener(this);
328 layout->AddView(manage_link_); 333 layout->AddView(manage_link_);
329 334
330 close_button_ = 335 close_button_ =
331 new views::NativeTextButton(this, 336 new views::NativeTextButton(this,
332 UTF16ToWide(l10n_util::GetStringUTF16(IDS_DONE))); 337 UTF16ToWide(l10n_util::GetStringUTF16(IDS_DONE)));
333 layout->AddView(close_button_); 338 layout->AddView(close_button_);
334 } 339 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/collected_cookies_win.cc ('k') | chrome/browser/ui/views/create_application_shortcut_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698