Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Side by Side Diff: chrome/browser/ui/views/website_settings/website_settings_popup_view.cc

Issue 2713803002: Views/Harmony: Use LayoutDelegate::GetMetric for views::kPanelVertMargin. (Closed)
Patch Set: Rebase. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/views/webshare/webshare_target_picker_view.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
11 11
12 #include "base/i18n/rtl.h" 12 #include "base/i18n/rtl.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/ptr_util.h" 14 #include "base/memory/ptr_util.h"
15 #include "base/strings/string16.h" 15 #include "base/strings/string16.h"
16 #include "base/strings/string_util.h" 16 #include "base/strings/string_util.h"
17 #include "base/strings/utf_string_conversions.h" 17 #include "base/strings/utf_string_conversions.h"
18 #include "chrome/browser/certificate_viewer.h" 18 #include "chrome/browser/certificate_viewer.h"
19 #include "chrome/browser/infobars/infobar_service.h" 19 #include "chrome/browser/infobars/infobar_service.h"
20 #include "chrome/browser/profiles/profile.h" 20 #include "chrome/browser/profiles/profile.h"
21 #include "chrome/browser/ui/browser.h" 21 #include "chrome/browser/ui/browser.h"
22 #include "chrome/browser/ui/browser_dialogs.h" 22 #include "chrome/browser/ui/browser_dialogs.h"
23 #include "chrome/browser/ui/layout_constants.h" 23 #include "chrome/browser/ui/layout_constants.h"
24 #include "chrome/browser/ui/views/collected_cookies_views.h" 24 #include "chrome/browser/ui/views/collected_cookies_views.h"
25 #include "chrome/browser/ui/views/harmony/layout_delegate.h"
25 #include "chrome/browser/ui/views/website_settings/chosen_object_row.h" 26 #include "chrome/browser/ui/views/website_settings/chosen_object_row.h"
26 #include "chrome/browser/ui/views/website_settings/non_accessible_image_view.h" 27 #include "chrome/browser/ui/views/website_settings/non_accessible_image_view.h"
27 #include "chrome/browser/ui/views/website_settings/permission_selector_row.h" 28 #include "chrome/browser/ui/views/website_settings/permission_selector_row.h"
28 #include "chrome/browser/ui/website_settings/website_settings.h" 29 #include "chrome/browser/ui/website_settings/website_settings.h"
29 #include "chrome/common/url_constants.h" 30 #include "chrome/common/url_constants.h"
30 #include "chrome/grit/chromium_strings.h" 31 #include "chrome/grit/chromium_strings.h"
31 #include "chrome/grit/generated_resources.h" 32 #include "chrome/grit/generated_resources.h"
32 #include "chrome/grit/theme_resources.h" 33 #include "chrome/grit/theme_resources.h"
33 #include "components/content_settings/core/common/content_settings_types.h" 34 #include "components/content_settings/core/common/content_settings_types.h"
34 #include "components/strings/grit/components_chromium_strings.h" 35 #include "components/strings/grit/components_chromium_strings.h"
(...skipping 12 matching lines...) Expand all
47 #include "ui/resources/grit/ui_resources.h" 48 #include "ui/resources/grit/ui_resources.h"
48 #include "ui/views/border.h" 49 #include "ui/views/border.h"
49 #include "ui/views/controls/button/image_button.h" 50 #include "ui/views/controls/button/image_button.h"
50 #include "ui/views/controls/button/md_text_button.h" 51 #include "ui/views/controls/button/md_text_button.h"
51 #include "ui/views/controls/image_view.h" 52 #include "ui/views/controls/image_view.h"
52 #include "ui/views/controls/label.h" 53 #include "ui/views/controls/label.h"
53 #include "ui/views/controls/link.h" 54 #include "ui/views/controls/link.h"
54 #include "ui/views/controls/styled_label.h" 55 #include "ui/views/controls/styled_label.h"
55 #include "ui/views/layout/box_layout.h" 56 #include "ui/views/layout/box_layout.h"
56 #include "ui/views/layout/grid_layout.h" 57 #include "ui/views/layout/grid_layout.h"
57 #include "ui/views/layout/layout_constants.h"
58 #include "ui/views/layout/layout_manager.h" 58 #include "ui/views/layout/layout_manager.h"
59 #include "ui/views/view.h" 59 #include "ui/views/view.h"
60 #include "ui/views/widget/widget.h" 60 #include "ui/views/widget/widget.h"
61 #include "url/gurl.h" 61 #include "url/gurl.h"
62 62
63 namespace { 63 namespace {
64 64
65 // NOTE(jdonnelly): This use of this process-wide variable assumes that there's 65 // NOTE(jdonnelly): This use of this process-wide variable assumes that there's
66 // never more than one website settings popup shown and that it's associated 66 // never more than one website settings popup shown and that it's associated
67 // with the current window. If this assumption fails in the future, we'll need 67 // with the current window. If this assumption fails in the future, we'll need
68 // to return a weak pointer from ShowPopup so callers can associate it with the 68 // to return a weak pointer from ShowPopup so callers can associate it with the
69 // current window (or other context) and check if the popup they care about is 69 // current window (or other context) and check if the popup they care about is
70 // showing. 70 // showing.
71 WebsiteSettingsPopupView::PopupType g_shown_popup_type = 71 WebsiteSettingsPopupView::PopupType g_shown_popup_type =
72 WebsiteSettingsPopupView::POPUP_NONE; 72 WebsiteSettingsPopupView::POPUP_NONE;
73 73
74 // General constants ----------------------------------------------------------- 74 // General constants -----------------------------------------------------------
75 75
76 // Popup width constraints. 76 // Popup width constraints.
77 const int kMinPopupWidth = 320; 77 const int kMinPopupWidth = 320;
78 const int kMaxPopupWidth = 1000; 78 const int kMaxPopupWidth = 1000;
79 79
80 // Security Section (PopupHeaderView) ------------------------------------------ 80 // Security Section (PopupHeaderView) ------------------------------------------
81 81
82 // Margin and padding values for the |PopupHeaderView|. 82 // Margin and padding values for the |PopupHeaderView|.
83 const int kHeaderMarginBottom = 10; 83 const int kHeaderMarginBottom = 10;
84 const int kHeaderPaddingBottom = views::kPanelVertMargin; 84 const int kHeaderPaddingBottom = 13;
85 85
86 // Spacing between labels in the header. 86 // Spacing between labels in the header.
87 const int kHeaderLabelSpacing = 4; 87 const int kHeaderLabelSpacing = 4;
88 88
89 // Site Settings Section ------------------------------------------------------- 89 // Site Settings Section -------------------------------------------------------
90 90
91 // Spacing above and below the cookies view. 91 // Spacing above and below the cookies view.
92 const int kCookiesViewVerticalPadding = 6; 92 const int kCookiesViewVerticalPadding = 6;
93 93
94 // Spacing between a permission image and the text. 94 // Spacing between a permission image and the text.
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 layout->AddPaddingRow(1, kHeaderMarginBottom); 432 layout->AddPaddingRow(1, kHeaderMarginBottom);
433 layout->StartRow(1, content_column); 433 layout->StartRow(1, content_column);
434 434
435 site_settings_view_ = CreateSiteSettingsView(side_margin); 435 site_settings_view_ = CreateSiteSettingsView(side_margin);
436 layout->AddView(site_settings_view_); 436 layout->AddView(site_settings_view_);
437 437
438 if (!ui::MaterialDesignController::IsSecondaryUiMaterial()) { 438 if (!ui::MaterialDesignController::IsSecondaryUiMaterial()) {
439 // In non-material, titles are inset from the dialog margin. Ensure the 439 // In non-material, titles are inset from the dialog margin. Ensure the
440 // horizontal insets match. 440 // horizontal insets match.
441 set_title_margins( 441 set_title_margins(
442 gfx::Insets(views::kPanelVertMargin, side_margin, 0, side_margin)); 442 gfx::Insets(LayoutDelegate::Get()->GetMetric(
443 LayoutDelegate::Metric::PANEL_CONTENT_MARGIN),
444 side_margin, 0, side_margin));
443 } 445 }
444 views::BubbleDialogDelegateView::CreateBubble(this); 446 views::BubbleDialogDelegateView::CreateBubble(this);
445 447
446 presenter_.reset(new WebsiteSettings( 448 presenter_.reset(new WebsiteSettings(
447 this, profile, TabSpecificContentSettings::FromWebContents(web_contents), 449 this, profile, TabSpecificContentSettings::FromWebContents(web_contents),
448 web_contents, url, security_info)); 450 web_contents, url, security_info));
449 } 451 }
450 452
451 void WebsiteSettingsPopupView::RenderFrameDeleted( 453 void WebsiteSettingsPopupView::RenderFrameDeleted(
452 content::RenderFrameHost* render_frame_host) { 454 content::RenderFrameHost* render_frame_host) {
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 WebsiteSettings::WEBSITE_SETTINGS_CONNECTION_HELP_OPENED); 743 WebsiteSettings::WEBSITE_SETTINGS_CONNECTION_HELP_OPENED);
742 break; 744 break;
743 case STYLED_LABEL_RESET_CERTIFICATE_DECISIONS: 745 case STYLED_LABEL_RESET_CERTIFICATE_DECISIONS:
744 presenter_->OnRevokeSSLErrorBypassButtonPressed(); 746 presenter_->OnRevokeSSLErrorBypassButtonPressed();
745 GetWidget()->Close(); 747 GetWidget()->Close();
746 break; 748 break;
747 default: 749 default:
748 NOTREACHED(); 750 NOTREACHED();
749 } 751 }
750 } 752 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/webshare/webshare_target_picker_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698