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

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

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