OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/website_settings/website_settings_popup_view.h
" | 5 #include "chrome/browser/ui/views/website_settings/website_settings_popup_view.h
" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <vector> | 10 #include <vector> |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 | 166 |
167 // views::BubbleDialogDelegateView: | 167 // views::BubbleDialogDelegateView: |
168 views::NonClientFrameView* CreateNonClientFrameView( | 168 views::NonClientFrameView* CreateNonClientFrameView( |
169 views::Widget* widget) override; | 169 views::Widget* widget) override; |
170 void OnWidgetDestroying(views::Widget* widget) override; | 170 void OnWidgetDestroying(views::Widget* widget) override; |
171 int GetDialogButtons() const override; | 171 int GetDialogButtons() const override; |
172 | 172 |
173 private: | 173 private: |
174 friend class WebsiteSettingsPopupView; | 174 friend class WebsiteSettingsPopupView; |
175 | 175 |
| 176 // Used around icon and inside bubble border. |
| 177 static constexpr int kSpacing = 12; |
| 178 |
176 DISALLOW_COPY_AND_ASSIGN(InternalPageInfoPopupView); | 179 DISALLOW_COPY_AND_ASSIGN(InternalPageInfoPopupView); |
177 }; | 180 }; |
178 | 181 |
179 //////////////////////////////////////////////////////////////////////////////// | 182 //////////////////////////////////////////////////////////////////////////////// |
180 // Popup Header | 183 // Popup Header |
181 //////////////////////////////////////////////////////////////////////////////// | 184 //////////////////////////////////////////////////////////////////////////////// |
182 | 185 |
183 PopupHeaderView::PopupHeaderView( | 186 PopupHeaderView::PopupHeaderView( |
184 views::ButtonListener* button_listener, | 187 views::ButtonListener* button_listener, |
185 views::StyledLabelListener* styled_label_listener) | 188 views::StyledLabelListener* styled_label_listener) |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 icon = IDR_PRODUCT_LOGO_16; | 350 icon = IDR_PRODUCT_LOGO_16; |
348 } else if (!url.SchemeIs(content::kChromeUIScheme) && | 351 } else if (!url.SchemeIs(content::kChromeUIScheme) && |
349 !url.SchemeIs(content::kChromeDevToolsScheme)) { | 352 !url.SchemeIs(content::kChromeDevToolsScheme)) { |
350 NOTREACHED(); | 353 NOTREACHED(); |
351 } | 354 } |
352 | 355 |
353 // Compensate for built-in vertical padding in the anchor view's image. | 356 // Compensate for built-in vertical padding in the anchor view's image. |
354 set_anchor_view_insets(gfx::Insets( | 357 set_anchor_view_insets(gfx::Insets( |
355 GetLayoutConstant(LOCATION_BAR_BUBBLE_ANCHOR_VERTICAL_INSET), 0)); | 358 GetLayoutConstant(LOCATION_BAR_BUBBLE_ANCHOR_VERTICAL_INSET), 0)); |
356 | 359 |
357 const int kSpacing = 16; | |
358 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal, kSpacing, | 360 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal, kSpacing, |
359 kSpacing, kSpacing)); | 361 kSpacing, kSpacing)); |
360 set_margins(gfx::Insets()); | 362 set_margins(gfx::Insets()); |
361 views::ImageView* icon_view = new NonAccessibleImageView(); | 363 views::ImageView* icon_view = new NonAccessibleImageView(); |
362 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 364 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
363 icon_view->SetImage(rb.GetImageSkiaNamed(icon)); | 365 icon_view->SetImage(rb.GetImageSkiaNamed(icon)); |
364 AddChildView(icon_view); | 366 AddChildView(icon_view); |
365 | 367 |
366 views::Label* label = new views::Label(l10n_util::GetStringUTF16(text)); | 368 views::Label* label = new views::Label(l10n_util::GetStringUTF16(text)); |
367 label->SetMultiLine(true); | 369 label->SetMultiLine(true); |
368 label->SetAllowCharacterBreak(true); | 370 label->SetAllowCharacterBreak(true); |
369 label->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 371 label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
370 AddChildView(label); | 372 AddChildView(label); |
371 | 373 |
372 views::BubbleDialogDelegateView::CreateBubble(this); | 374 views::BubbleDialogDelegateView::CreateBubble(this); |
373 } | 375 } |
374 | 376 |
375 InternalPageInfoPopupView::~InternalPageInfoPopupView() { | 377 InternalPageInfoPopupView::~InternalPageInfoPopupView() { |
376 } | 378 } |
377 | 379 |
378 views::NonClientFrameView* InternalPageInfoPopupView::CreateNonClientFrameView( | 380 views::NonClientFrameView* InternalPageInfoPopupView::CreateNonClientFrameView( |
379 views::Widget* widget) { | 381 views::Widget* widget) { |
380 views::BubbleFrameView* frame = static_cast<views::BubbleFrameView*>( | 382 views::BubbleFrameView* frame = static_cast<views::BubbleFrameView*>( |
381 BubbleDialogDelegateView::CreateNonClientFrameView(widget)); | 383 BubbleDialogDelegateView::CreateNonClientFrameView(widget)); |
382 // 16px padding + half of icon width comes out to 24px. | 384 // Padding around icon + half of icon width. |
383 frame->bubble_border()->set_arrow_offset( | 385 frame->bubble_border()->set_arrow_offset( |
384 24 + frame->bubble_border()->GetBorderThickness()); | 386 kSpacing + 8 + frame->bubble_border()->GetBorderThickness()); |
385 return frame; | 387 return frame; |
386 } | 388 } |
387 | 389 |
388 void InternalPageInfoPopupView::OnWidgetDestroying(views::Widget* widget) { | 390 void InternalPageInfoPopupView::OnWidgetDestroying(views::Widget* widget) { |
389 g_shown_popup_type = WebsiteSettingsPopupView::POPUP_NONE; | 391 g_shown_popup_type = WebsiteSettingsPopupView::POPUP_NONE; |
390 } | 392 } |
391 | 393 |
392 int InternalPageInfoPopupView::GetDialogButtons() const { | 394 int InternalPageInfoPopupView::GetDialogButtons() const { |
393 return ui::DIALOG_BUTTON_NONE; | 395 return ui::DIALOG_BUTTON_NONE; |
394 } | 396 } |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
775 WebsiteSettings::WEBSITE_SETTINGS_CONNECTION_HELP_OPENED); | 777 WebsiteSettings::WEBSITE_SETTINGS_CONNECTION_HELP_OPENED); |
776 break; | 778 break; |
777 case STYLED_LABEL_RESET_CERTIFICATE_DECISIONS: | 779 case STYLED_LABEL_RESET_CERTIFICATE_DECISIONS: |
778 presenter_->OnRevokeSSLErrorBypassButtonPressed(); | 780 presenter_->OnRevokeSSLErrorBypassButtonPressed(); |
779 GetWidget()->Close(); | 781 GetWidget()->Close(); |
780 break; | 782 break; |
781 default: | 783 default: |
782 NOTREACHED(); | 784 NOTREACHED(); |
783 } | 785 } |
784 } | 786 } |
OLD | NEW |