| 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 28 matching lines...) Expand all Loading... |
| 39 #include "ui/base/l10n/l10n_util.h" | 39 #include "ui/base/l10n/l10n_util.h" |
| 40 #include "ui/base/material_design/material_design_controller.h" | 40 #include "ui/base/material_design/material_design_controller.h" |
| 41 #include "ui/base/models/simple_menu_model.h" | 41 #include "ui/base/models/simple_menu_model.h" |
| 42 #include "ui/base/resource/resource_bundle.h" | 42 #include "ui/base/resource/resource_bundle.h" |
| 43 #include "ui/gfx/canvas.h" | 43 #include "ui/gfx/canvas.h" |
| 44 #include "ui/gfx/font_list.h" | 44 #include "ui/gfx/font_list.h" |
| 45 #include "ui/gfx/geometry/insets.h" | 45 #include "ui/gfx/geometry/insets.h" |
| 46 #include "ui/gfx/image/image.h" | 46 #include "ui/gfx/image/image.h" |
| 47 #include "ui/resources/grit/ui_resources.h" | 47 #include "ui/resources/grit/ui_resources.h" |
| 48 #include "ui/views/border.h" | 48 #include "ui/views/border.h" |
| 49 #include "ui/views/bubble/bubble_frame_view.h" | |
| 50 #include "ui/views/controls/button/image_button.h" | 49 #include "ui/views/controls/button/image_button.h" |
| 51 #include "ui/views/controls/button/md_text_button.h" | 50 #include "ui/views/controls/button/md_text_button.h" |
| 52 #include "ui/views/controls/image_view.h" | 51 #include "ui/views/controls/image_view.h" |
| 53 #include "ui/views/controls/label.h" | 52 #include "ui/views/controls/label.h" |
| 54 #include "ui/views/controls/link.h" | 53 #include "ui/views/controls/link.h" |
| 55 #include "ui/views/controls/styled_label.h" | 54 #include "ui/views/controls/styled_label.h" |
| 56 #include "ui/views/layout/box_layout.h" | 55 #include "ui/views/layout/box_layout.h" |
| 57 #include "ui/views/layout/grid_layout.h" | 56 #include "ui/views/layout/grid_layout.h" |
| 58 #include "ui/views/layout/layout_constants.h" | 57 #include "ui/views/layout/layout_constants.h" |
| 59 #include "ui/views/layout/layout_manager.h" | 58 #include "ui/views/layout/layout_manager.h" |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 class InternalPageInfoPopupView : public views::BubbleDialogDelegateView { | 162 class InternalPageInfoPopupView : public views::BubbleDialogDelegateView { |
| 164 public: | 163 public: |
| 165 // If |anchor_view| is nullptr, or has no Widget, |parent_window| may be | 164 // If |anchor_view| is nullptr, or has no Widget, |parent_window| may be |
| 166 // provided to ensure this bubble is closed when the parent closes. | 165 // provided to ensure this bubble is closed when the parent closes. |
| 167 InternalPageInfoPopupView(views::View* anchor_view, | 166 InternalPageInfoPopupView(views::View* anchor_view, |
| 168 gfx::NativeView parent_window, | 167 gfx::NativeView parent_window, |
| 169 const GURL& url); | 168 const GURL& url); |
| 170 ~InternalPageInfoPopupView() override; | 169 ~InternalPageInfoPopupView() override; |
| 171 | 170 |
| 172 // views::BubbleDialogDelegateView: | 171 // views::BubbleDialogDelegateView: |
| 173 views::NonClientFrameView* CreateNonClientFrameView( | |
| 174 views::Widget* widget) override; | |
| 175 void OnWidgetDestroying(views::Widget* widget) override; | 172 void OnWidgetDestroying(views::Widget* widget) override; |
| 176 int GetDialogButtons() const override; | 173 int GetDialogButtons() const override; |
| 177 | 174 |
| 178 private: | 175 private: |
| 179 friend class WebsiteSettingsPopupView; | 176 friend class WebsiteSettingsPopupView; |
| 180 | 177 |
| 181 // Used around icon and inside bubble border. | 178 // Used around icon and inside bubble border. |
| 182 static constexpr int kSpacing = 12; | 179 static constexpr int kSpacing = 12; |
| 183 | 180 |
| 184 DISALLOW_COPY_AND_ASSIGN(InternalPageInfoPopupView); | 181 DISALLOW_COPY_AND_ASSIGN(InternalPageInfoPopupView); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 label->SetAllowCharacterBreak(true); | 316 label->SetAllowCharacterBreak(true); |
| 320 label->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 317 label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 321 AddChildView(label); | 318 AddChildView(label); |
| 322 | 319 |
| 323 views::BubbleDialogDelegateView::CreateBubble(this); | 320 views::BubbleDialogDelegateView::CreateBubble(this); |
| 324 } | 321 } |
| 325 | 322 |
| 326 InternalPageInfoPopupView::~InternalPageInfoPopupView() { | 323 InternalPageInfoPopupView::~InternalPageInfoPopupView() { |
| 327 } | 324 } |
| 328 | 325 |
| 329 views::NonClientFrameView* InternalPageInfoPopupView::CreateNonClientFrameView( | |
| 330 views::Widget* widget) { | |
| 331 views::BubbleFrameView* frame = static_cast<views::BubbleFrameView*>( | |
| 332 BubbleDialogDelegateView::CreateNonClientFrameView(widget)); | |
| 333 // Padding around icon + half of icon width. | |
| 334 frame->bubble_border()->set_arrow_offset( | |
| 335 kSpacing + 8 + frame->bubble_border()->GetBorderThickness()); | |
| 336 return frame; | |
| 337 } | |
| 338 | |
| 339 void InternalPageInfoPopupView::OnWidgetDestroying(views::Widget* widget) { | 326 void InternalPageInfoPopupView::OnWidgetDestroying(views::Widget* widget) { |
| 340 g_shown_popup_type = WebsiteSettingsPopupView::POPUP_NONE; | 327 g_shown_popup_type = WebsiteSettingsPopupView::POPUP_NONE; |
| 341 } | 328 } |
| 342 | 329 |
| 343 int InternalPageInfoPopupView::GetDialogButtons() const { | 330 int InternalPageInfoPopupView::GetDialogButtons() const { |
| 344 return ui::DIALOG_BUTTON_NONE; | 331 return ui::DIALOG_BUTTON_NONE; |
| 345 } | 332 } |
| 346 | 333 |
| 347 //////////////////////////////////////////////////////////////////////////////// | 334 //////////////////////////////////////////////////////////////////////////////// |
| 348 // WebsiteSettingsPopupView | 335 // WebsiteSettingsPopupView |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 754 WebsiteSettings::WEBSITE_SETTINGS_CONNECTION_HELP_OPENED); | 741 WebsiteSettings::WEBSITE_SETTINGS_CONNECTION_HELP_OPENED); |
| 755 break; | 742 break; |
| 756 case STYLED_LABEL_RESET_CERTIFICATE_DECISIONS: | 743 case STYLED_LABEL_RESET_CERTIFICATE_DECISIONS: |
| 757 presenter_->OnRevokeSSLErrorBypassButtonPressed(); | 744 presenter_->OnRevokeSSLErrorBypassButtonPressed(); |
| 758 GetWidget()->Close(); | 745 GetWidget()->Close(); |
| 759 break; | 746 break; |
| 760 default: | 747 default: |
| 761 NOTREACHED(); | 748 NOTREACHED(); |
| 762 } | 749 } |
| 763 } | 750 } |
| OLD | NEW |