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