| 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 21 matching lines...) Expand all Loading... |
| 32 #include "chrome/grit/chromium_strings.h" | 32 #include "chrome/grit/chromium_strings.h" |
| 33 #include "chrome/grit/generated_resources.h" | 33 #include "chrome/grit/generated_resources.h" |
| 34 #include "chrome/grit/theme_resources.h" | 34 #include "chrome/grit/theme_resources.h" |
| 35 #include "components/content_settings/core/common/content_settings_types.h" | 35 #include "components/content_settings/core/common/content_settings_types.h" |
| 36 #include "components/prefs/pref_service.h" | 36 #include "components/prefs/pref_service.h" |
| 37 #include "components/strings/grit/components_chromium_strings.h" | 37 #include "components/strings/grit/components_chromium_strings.h" |
| 38 #include "components/strings/grit/components_strings.h" | 38 #include "components/strings/grit/components_strings.h" |
| 39 #include "content/public/browser/browser_thread.h" | 39 #include "content/public/browser/browser_thread.h" |
| 40 #include "content/public/browser/user_metrics.h" | 40 #include "content/public/browser/user_metrics.h" |
| 41 #include "extensions/common/constants.h" | 41 #include "extensions/common/constants.h" |
| 42 #include "ui/accessibility/ax_enums.h" |
| 43 #include "ui/accessibility/ax_node_data.h" |
| 42 #include "ui/base/l10n/l10n_util.h" | 44 #include "ui/base/l10n/l10n_util.h" |
| 43 #include "ui/base/material_design/material_design_controller.h" | 45 #include "ui/base/material_design/material_design_controller.h" |
| 44 #include "ui/base/models/simple_menu_model.h" | 46 #include "ui/base/models/simple_menu_model.h" |
| 45 #include "ui/base/resource/resource_bundle.h" | 47 #include "ui/base/resource/resource_bundle.h" |
| 46 #include "ui/gfx/canvas.h" | 48 #include "ui/gfx/canvas.h" |
| 47 #include "ui/gfx/font_list.h" | 49 #include "ui/gfx/font_list.h" |
| 48 #include "ui/gfx/geometry/insets.h" | 50 #include "ui/gfx/geometry/insets.h" |
| 49 #include "ui/gfx/image/image.h" | 51 #include "ui/gfx/image/image.h" |
| 50 #include "ui/resources/grit/ui_resources.h" | 52 #include "ui/resources/grit/ui_resources.h" |
| 51 #include "ui/views/border.h" | 53 #include "ui/views/border.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 // Spacing between rows in the site settings section | 110 // Spacing between rows in the site settings section |
| 109 const int kPermissionsVerticalSpacing = 12; | 111 const int kPermissionsVerticalSpacing = 12; |
| 110 | 112 |
| 111 // Button/styled label/link IDs ------------------------------------------------ | 113 // Button/styled label/link IDs ------------------------------------------------ |
| 112 const int BUTTON_CLOSE = 1337; | 114 const int BUTTON_CLOSE = 1337; |
| 113 const int STYLED_LABEL_SECURITY_DETAILS = 1338; | 115 const int STYLED_LABEL_SECURITY_DETAILS = 1338; |
| 114 const int STYLED_LABEL_RESET_CERTIFICATE_DECISIONS = 1339; | 116 const int STYLED_LABEL_RESET_CERTIFICATE_DECISIONS = 1339; |
| 115 const int LINK_COOKIE_DIALOG = 1340; | 117 const int LINK_COOKIE_DIALOG = 1340; |
| 116 const int LINK_SITE_SETTINGS = 1341; | 118 const int LINK_SITE_SETTINGS = 1341; |
| 117 | 119 |
| 120 class NonAccessibleImageView : public views::ImageView { |
| 121 // Overridden from views::View. |
| 122 void GetAccessibleNodeData(ui::AXNodeData* node_data) override; |
| 123 }; |
| 124 |
| 125 void NonAccessibleImageView::GetAccessibleNodeData(ui::AXNodeData* node_data) { |
| 126 node_data->role = ui::AX_ROLE_IGNORED; |
| 127 } |
| 128 |
| 118 } // namespace | 129 } // namespace |
| 119 | 130 |
| 120 // |PopupHeaderView| is the UI element (view) that represents the header of the | 131 // |PopupHeaderView| is the UI element (view) that represents the header of the |
| 121 // |WebsiteSettingsPopupView|. The header shows the status of the site's | 132 // |WebsiteSettingsPopupView|. The header shows the status of the site's |
| 122 // identity check and the name of the site's identity. | 133 // identity check and the name of the site's identity. |
| 123 class PopupHeaderView : public views::View { | 134 class PopupHeaderView : public views::View { |
| 124 public: | 135 public: |
| 125 explicit PopupHeaderView(views::ButtonListener* button_listener, | 136 explicit PopupHeaderView(views::ButtonListener* button_listener, |
| 126 views::StyledLabelListener* styled_label_listener); | 137 views::StyledLabelListener* styled_label_listener); |
| 127 ~PopupHeaderView() override; | 138 ~PopupHeaderView() override; |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 } | 373 } |
| 363 | 374 |
| 364 // Compensate for built-in vertical padding in the anchor view's image. | 375 // Compensate for built-in vertical padding in the anchor view's image. |
| 365 set_anchor_view_insets(gfx::Insets( | 376 set_anchor_view_insets(gfx::Insets( |
| 366 GetLayoutConstant(LOCATION_BAR_BUBBLE_ANCHOR_VERTICAL_INSET), 0)); | 377 GetLayoutConstant(LOCATION_BAR_BUBBLE_ANCHOR_VERTICAL_INSET), 0)); |
| 367 | 378 |
| 368 const int kSpacing = 16; | 379 const int kSpacing = 16; |
| 369 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal, kSpacing, | 380 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal, kSpacing, |
| 370 kSpacing, kSpacing)); | 381 kSpacing, kSpacing)); |
| 371 set_margins(gfx::Insets()); | 382 set_margins(gfx::Insets()); |
| 372 views::ImageView* icon_view = new views::ImageView(); | 383 views::ImageView* icon_view = new NonAccessibleImageView(); |
| 373 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 384 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 374 icon_view->SetImage(rb.GetImageSkiaNamed(icon)); | 385 icon_view->SetImage(rb.GetImageSkiaNamed(icon)); |
| 375 AddChildView(icon_view); | 386 AddChildView(icon_view); |
| 376 | 387 |
| 377 views::Label* label = new views::Label(l10n_util::GetStringUTF16(text)); | 388 views::Label* label = new views::Label(l10n_util::GetStringUTF16(text)); |
| 378 label->SetMultiLine(true); | 389 label->SetMultiLine(true); |
| 379 label->SetAllowCharacterBreak(true); | 390 label->SetAllowCharacterBreak(true); |
| 380 label->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 391 label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 381 AddChildView(label); | 392 AddChildView(label); |
| 382 | 393 |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 612 | 623 |
| 613 layout->AddPaddingRow(0, kCookiesViewVerticalPadding); | 624 layout->AddPaddingRow(0, kCookiesViewVerticalPadding); |
| 614 | 625 |
| 615 layout->StartRow(1, cookies_view_column); | 626 layout->StartRow(1, cookies_view_column); |
| 616 WebsiteSettingsUI::PermissionInfo info; | 627 WebsiteSettingsUI::PermissionInfo info; |
| 617 info.type = CONTENT_SETTINGS_TYPE_COOKIES; | 628 info.type = CONTENT_SETTINGS_TYPE_COOKIES; |
| 618 info.setting = CONTENT_SETTING_ALLOW; | 629 info.setting = CONTENT_SETTING_ALLOW; |
| 619 info.is_incognito = | 630 info.is_incognito = |
| 620 Profile::FromBrowserContext(web_contents()->GetBrowserContext()) | 631 Profile::FromBrowserContext(web_contents()->GetBrowserContext()) |
| 621 ->IsOffTheRecord(); | 632 ->IsOffTheRecord(); |
| 622 views::ImageView* icon = new views::ImageView(); | 633 views::ImageView* icon = new NonAccessibleImageView(); |
| 623 const gfx::Image& image = WebsiteSettingsUI::GetPermissionIcon(info); | 634 const gfx::Image& image = WebsiteSettingsUI::GetPermissionIcon(info); |
| 624 icon->SetImage(image.ToImageSkia()); | 635 icon->SetImage(image.ToImageSkia()); |
| 625 layout->AddView( | 636 layout->AddView( |
| 626 icon, 1, 2, views::GridLayout::FILL, | 637 icon, 1, 2, views::GridLayout::FILL, |
| 627 // TODO: The vertical alignment may change to CENTER once Harmony is | 638 // TODO: The vertical alignment may change to CENTER once Harmony is |
| 628 // implemented. See https://crbug.com/512442#c48 | 639 // implemented. See https://crbug.com/512442#c48 |
| 629 views::GridLayout::LEADING); | 640 views::GridLayout::LEADING); |
| 630 | 641 |
| 631 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 642 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 632 const gfx::FontList& font_list = rb.GetFontListWithDelta(1); | 643 const gfx::FontList& font_list = rb.GetFontListWithDelta(1); |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 802 } | 813 } |
| 803 break; | 814 break; |
| 804 case STYLED_LABEL_RESET_CERTIFICATE_DECISIONS: | 815 case STYLED_LABEL_RESET_CERTIFICATE_DECISIONS: |
| 805 presenter_->OnRevokeSSLErrorBypassButtonPressed(); | 816 presenter_->OnRevokeSSLErrorBypassButtonPressed(); |
| 806 GetWidget()->Close(); | 817 GetWidget()->Close(); |
| 807 break; | 818 break; |
| 808 default: | 819 default: |
| 809 NOTREACHED(); | 820 NOTREACHED(); |
| 810 } | 821 } |
| 811 } | 822 } |
| OLD | NEW |