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

Side by Side Diff: chrome/browser/ui/views/page_info_bubble_view.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/page_info_bubble_view.h" 5 #include "chrome/browser/ui/views/page_info_bubble_view.h"
6 6
7 #include <algorithm>
8
7 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/certificate_viewer.h" 10 #include "chrome/browser/certificate_viewer.h"
9 #include "chrome/browser/google/google_util.h" 11 #include "chrome/browser/google/google_util.h"
10 #include "chrome/browser/ui/browser_list.h" 12 #include "chrome/browser/ui/browser_list.h"
11 #include "chrome/browser/ui/views/bubble/bubble.h" 13 #include "chrome/browser/ui/views/bubble/bubble.h"
12 #include "chrome/browser/ui/views/frame/browser_view.h" 14 #include "chrome/browser/ui/views/frame/browser_view.h"
13 #include "chrome/browser/ui/views/toolbar_view.h" 15 #include "chrome/browser/ui/views/toolbar_view.h"
14 #include "chrome/common/url_constants.h" 16 #include "chrome/common/url_constants.h"
15 #include "content/browser/cert_store.h" 17 #include "content/browser/cert_store.h"
16 #include "grit/generated_resources.h" 18 #include "grit/generated_resources.h"
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 layout->StartRow(0, 0); 217 layout->StartRow(0, 0);
216 layout->AddView(new views::Separator()); 218 layout->AddView(new views::Separator());
217 layout->AddPaddingRow(0, kPaddingBelowSeparator); 219 layout->AddPaddingRow(0, kPaddingBelowSeparator);
218 } 220 }
219 } 221 }
220 222
221 // Then add the help center link at the bottom. 223 // Then add the help center link at the bottom.
222 if (!only_internal_section) { 224 if (!only_internal_section) {
223 layout->StartRow(0, 1); 225 layout->StartRow(0, 1);
224 help_center_link_ = new views::Link( 226 help_center_link_ = new views::Link(
225 UTF16ToWide(l10n_util::GetStringUTF16(IDS_PAGE_INFO_HELP_CENTER_LINK))); 227 l10n_util::GetStringUTF16(IDS_PAGE_INFO_HELP_CENTER_LINK));
226 help_center_link_->set_listener(this); 228 help_center_link_->set_listener(this);
227 layout->AddView(help_center_link_); 229 layout->AddView(help_center_link_);
228 } 230 }
229 231
230 layout->Layout(this); 232 layout->Layout(this);
231 } 233 }
232 234
233 gfx::Size PageInfoBubbleView::GetPreferredSize() { 235 gfx::Size PageInfoBubbleView::GetPreferredSize() {
234 gfx::Size size(views::Widget::GetLocalizedContentsSize( 236 gfx::Size size(views::Widget::GetLocalizedContentsSize(
235 IDS_PAGEINFOBUBBLE_WIDTH_CHARS, IDS_PAGEINFOBUBBLE_HEIGHT_LINES)); 237 IDS_PAGEINFOBUBBLE_WIDTH_CHARS, IDS_PAGEINFOBUBBLE_HEIGHT_LINES));
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 headline_label_->SetReadOnly(true); 357 headline_label_->SetReadOnly(true);
356 headline_label_->RemoveBorder(); 358 headline_label_->RemoveBorder();
357 headline_label_->SetTextColor(SK_ColorBLACK); 359 headline_label_->SetTextColor(SK_ColorBLACK);
358 headline_label_->SetBackgroundColor(SK_ColorWHITE); 360 headline_label_->SetBackgroundColor(SK_ColorWHITE);
359 headline_label_->SetFont( 361 headline_label_->SetFont(
360 headline_label_->font().DeriveFont(0, gfx::Font::BOLD)); 362 headline_label_->font().DeriveFont(0, gfx::Font::BOLD));
361 AddChildView(headline_label_); 363 AddChildView(headline_label_);
362 364
363 // Can't make this a text field to enable copying until multiline support is 365 // Can't make this a text field to enable copying until multiline support is
364 // added to text fields. 366 // added to text fields.
365 description_label_ = new views::Label(UTF16ToWideHack(info_.description)); 367 description_label_ = new views::Label(info_.description);
366 description_label_->set_background( 368 description_label_->set_background(
367 views::Background::CreateSolidBackground(SK_ColorWHITE)); 369 views::Background::CreateSolidBackground(SK_ColorWHITE));
368 description_label_->SetMultiLine(true); 370 description_label_->SetMultiLine(true);
369 description_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); 371 description_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
370 // Allow linebreaking in the middle of words if necessary, so that extremely 372 // Allow linebreaking in the middle of words if necessary, so that extremely
371 // long hostnames (longer than one line) will still be completely shown. 373 // long hostnames (longer than one line) will still be completely shown.
372 description_label_->SetAllowCharacterBreak(true); 374 description_label_->SetAllowCharacterBreak(true);
373 AddChildView(description_label_); 375 AddChildView(description_label_);
374 376
375 if (info_.type == PageInfoModel::SECTION_INFO_IDENTITY && show_cert) { 377 if (info_.type == PageInfoModel::SECTION_INFO_IDENTITY && show_cert) {
376 link_ = new views::Link( 378 link_ = new views::Link(
377 UTF16ToWide(l10n_util::GetStringUTF16(IDS_PAGEINFO_CERT_INFO_BUTTON))); 379 l10n_util::GetStringUTF16(IDS_PAGEINFO_CERT_INFO_BUTTON));
378 link_->set_listener(this); 380 link_->set_listener(this);
379 AddChildView(link_); 381 AddChildView(link_);
380 } 382 }
381 } 383 }
382 384
383 Section::~Section() { 385 Section::~Section() {
384 } 386 }
385 387
386 void Section::SetAnimationStage(double animation_stage) { 388 void Section::SetAnimationStage(double animation_stage) {
387 animation_value_ = animation_stage; 389 animation_value_ = animation_stage;
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 // Show the bubble. If the bubble already exist - it will be closed first. 497 // Show the bubble. If the bubble already exist - it will be closed first.
496 PageInfoBubbleView* page_info_bubble = 498 PageInfoBubbleView* page_info_bubble =
497 new PageInfoBubbleView(browser_view->GetNativeHandle(), 499 new PageInfoBubbleView(browser_view->GetNativeHandle(),
498 profile, url, ssl, show_history); 500 profile, url, ssl, show_history);
499 Bubble* bubble = 501 Bubble* bubble =
500 Bubble::Show(browser_view->GetWidget(), bounds, 502 Bubble::Show(browser_view->GetWidget(), bounds,
501 views::BubbleBorder::TOP_LEFT, 503 views::BubbleBorder::TOP_LEFT,
502 page_info_bubble, page_info_bubble); 504 page_info_bubble, page_info_bubble);
503 page_info_bubble->set_bubble(bubble); 505 page_info_bubble->set_bubble(bubble);
504 } 506 }
505
506 } 507 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/notifications/balloon_view.cc ('k') | chrome/browser/ui/views/sad_tab_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698