Chromium Code Reviews| Index: chrome/browser/ui/views/website_settings/website_settings_popup_view.cc |
| diff --git a/chrome/browser/ui/views/website_settings/website_settings_popup_view.cc b/chrome/browser/ui/views/website_settings/website_settings_popup_view.cc |
| index ac90cc17e7dcd8a8e4fe33b98eb3fd1457520fdd..3feac946e9d9e63c9c98fe0ce91e4fa23a3ae0fb 100644 |
| --- a/chrome/browser/ui/views/website_settings/website_settings_popup_view.cc |
| +++ b/chrome/browser/ui/views/website_settings/website_settings_popup_view.cc |
| @@ -153,16 +153,16 @@ class PopupHeaderView : public views::View { |
| DISALLOW_COPY_AND_ASSIGN(PopupHeaderView); |
| }; |
| -// Website Settings are not supported for internal Chrome pages. Instead of the |
| -// |WebsiteSettingsPopupView|, the |InternalPageInfoPopupView| is |
| -// displayed. |
| +// Website Settings are not supported for internal Chrome pages and extension |
| +// pages. Instead of the |WebsiteSettingsPopupView|, the |
| +// |InternalPageInfoPopupView| is displayed. |
| class InternalPageInfoPopupView : public views::BubbleDialogDelegateView { |
| public: |
| // If |anchor_view| is nullptr, or has no Widget, |parent_window| may be |
| // provided to ensure this bubble is closed when the parent closes. |
| InternalPageInfoPopupView(views::View* anchor_view, |
| gfx::NativeView parent_window, |
| - bool is_extension_page); |
| + const GURL& url); |
| ~InternalPageInfoPopupView() override; |
| // views::BubbleDialogDelegateView: |
| @@ -324,10 +324,20 @@ void PopupHeaderView::AddResetDecisionsButton() { |
| InternalPageInfoPopupView::InternalPageInfoPopupView( |
| views::View* anchor_view, |
| gfx::NativeView parent_window, |
| - bool is_extension_page) |
| + const GURL& url) |
| : BubbleDialogDelegateView(anchor_view, views::BubbleBorder::TOP_LEFT) { |
| set_parent_window(parent_window); |
| + int text = IDS_PAGE_INFO_INTERNAL_PAGE; |
| + int icon = IDR_PRODUCT_LOGO_16; |
| + if (url.SchemeIs(extensions::kExtensionScheme)) { |
| + text = IDS_PAGE_INFO_EXTENSION_PAGE; |
| + icon = IDR_PLUGINS_FAVICON; |
| + } else if (url.SchemeIs(content::kViewSourceScheme)) { |
| + // view-source scheme uses the same icon as other internal pages. |
| + text = IDS_PAGE_INFO_VIEW_SOURCE_PAGE; |
|
felt
2016/08/12 23:58:43
can you copy the same logic here too, with the com
|
| + } |
| + |
| // Compensate for built-in vertical padding in the anchor view's image. |
| set_anchor_view_insets(gfx::Insets( |
| GetLayoutConstant(LOCATION_BAR_BUBBLE_ANCHOR_VERTICAL_INSET), 0)); |
| @@ -338,13 +348,10 @@ InternalPageInfoPopupView::InternalPageInfoPopupView( |
| set_margins(gfx::Insets()); |
| views::ImageView* icon_view = new views::ImageView(); |
| ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| - icon_view->SetImage(rb.GetImageSkiaNamed( |
| - is_extension_page ? IDR_PLUGINS_FAVICON : IDR_PRODUCT_LOGO_16)); |
| + icon_view->SetImage(rb.GetImageSkiaNamed(icon)); |
| AddChildView(icon_view); |
| - views::Label* label = new views::Label(l10n_util::GetStringUTF16( |
| - is_extension_page ? IDS_PAGE_INFO_EXTENSION_PAGE |
| - : IDS_PAGE_INFO_INTERNAL_PAGE)); |
| + views::Label* label = new views::Label(l10n_util::GetStringUTF16(text)); |
| label->SetMultiLine(true); |
| label->SetAllowCharacterBreak(true); |
| label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| @@ -393,10 +400,11 @@ void WebsiteSettingsPopupView::ShowPopup( |
| gfx::NativeView parent_window = |
| anchor_view ? nullptr : web_contents->GetNativeView(); |
| if (url.SchemeIs(content::kChromeUIScheme) || |
| - url.SchemeIs(extensions::kExtensionScheme)) { |
| + url.SchemeIs(extensions::kExtensionScheme) || |
| + url.SchemeIs(content::kViewSourceScheme)) { |
| // Use the concrete type so that |SetAnchorRect| can be called as a friend. |
| - InternalPageInfoPopupView* popup = new InternalPageInfoPopupView( |
| - anchor_view, parent_window, url.SchemeIs(extensions::kExtensionScheme)); |
| + InternalPageInfoPopupView* popup = |
| + new InternalPageInfoPopupView(anchor_view, parent_window, url); |
| if (!anchor_view) |
| popup->SetAnchorRect(anchor_rect); |
| popup->GetWidget()->Show(); |