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

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

Issue 2640593002: Fix alignment of title/content on the OIB / Site Settings bubble. (Closed)
Patch Set: respond to comments Created 3 years, 11 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 | « no previous file | ui/views/bubble/bubble_dialog_delegate.h » ('j') | 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>
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 // showing. 71 // showing.
72 WebsiteSettingsPopupView::PopupType g_shown_popup_type = 72 WebsiteSettingsPopupView::PopupType g_shown_popup_type =
73 WebsiteSettingsPopupView::POPUP_NONE; 73 WebsiteSettingsPopupView::POPUP_NONE;
74 74
75 // General constants ----------------------------------------------------------- 75 // General constants -----------------------------------------------------------
76 76
77 // Popup width constraints. 77 // Popup width constraints.
78 const int kMinPopupWidth = 320; 78 const int kMinPopupWidth = 320;
79 const int kMaxPopupWidth = 1000; 79 const int kMaxPopupWidth = 1000;
80 80
81 // Margin and padding values shared by all sections.
82 const int kSectionPaddingHorizontal = views::kPanelHorizMargin;
83
84 // Padding for the bottom of the bubble.
85 const int kPopupMarginBottom = views::kPanelVertMargin;
86
87 // Security Section (PopupHeaderView) ------------------------------------------ 81 // Security Section (PopupHeaderView) ------------------------------------------
88 82
89 // Margin and padding values for the |PopupHeaderView|. 83 // Margin and padding values for the |PopupHeaderView|.
90 const int kHeaderMarginBottom = 10; 84 const int kHeaderMarginBottom = 10;
91 const int kHeaderPaddingBottom = views::kPanelVertMargin; 85 const int kHeaderPaddingBottom = views::kPanelVertMargin;
92 86
93 // Spacing between labels in the header. 87 // Spacing between labels in the header.
94 const int kHeaderLabelSpacing = 4; 88 const int kHeaderLabelSpacing = 4;
95 89
96 // Site Settings Section ------------------------------------------------------- 90 // Site Settings Section -------------------------------------------------------
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 : styled_label_listener_(styled_label_listener), 183 : styled_label_listener_(styled_label_listener),
190 details_label_(nullptr), 184 details_label_(nullptr),
191 reset_decisions_label_container_(nullptr), 185 reset_decisions_label_container_(nullptr),
192 reset_decisions_label_(nullptr) { 186 reset_decisions_label_(nullptr) {
193 views::GridLayout* layout = new views::GridLayout(this); 187 views::GridLayout* layout = new views::GridLayout(this);
194 SetLayoutManager(layout); 188 SetLayoutManager(layout);
195 189
196 const int label_column_status = 1; 190 const int label_column_status = 1;
197 views::ColumnSet* column_set_status = 191 views::ColumnSet* column_set_status =
198 layout->AddColumnSet(label_column_status); 192 layout->AddColumnSet(label_column_status);
199 column_set_status->AddPaddingColumn(0, kSectionPaddingHorizontal);
200 column_set_status->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 193 column_set_status->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL,
201 1, views::GridLayout::USE_PREF, 0, 0); 194 1, views::GridLayout::USE_PREF, 0, 0);
202 column_set_status->AddPaddingColumn(0, kSectionPaddingHorizontal);
203 195
204 layout->AddPaddingRow(0, kHeaderLabelSpacing); 196 layout->AddPaddingRow(0, kHeaderLabelSpacing);
205 197
206 layout->StartRow(0, label_column_status); 198 layout->StartRow(0, label_column_status);
207 details_label_ = 199 details_label_ =
208 new views::StyledLabel(base::string16(), styled_label_listener); 200 new views::StyledLabel(base::string16(), styled_label_listener);
209 details_label_->set_id(STYLED_LABEL_SECURITY_DETAILS); 201 details_label_->set_id(STYLED_LABEL_SECURITY_DETAILS);
210 layout->AddView(details_label_, 1, 1, views::GridLayout::FILL, 202 layout->AddView(details_label_, 1, 1, views::GridLayout::FILL,
211 views::GridLayout::LEADING); 203 views::GridLayout::LEADING);
212 204
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 layout->StartRow(0, content_column); 420 layout->StartRow(0, content_column);
429 separator_ = new views::Separator(views::Separator::HORIZONTAL); 421 separator_ = new views::Separator(views::Separator::HORIZONTAL);
430 layout->AddView(separator_); 422 layout->AddView(separator_);
431 423
432 layout->AddPaddingRow(1, kHeaderMarginBottom); 424 layout->AddPaddingRow(1, kHeaderMarginBottom);
433 layout->StartRow(1, content_column); 425 layout->StartRow(1, content_column);
434 426
435 site_settings_view_ = CreateSiteSettingsView(); 427 site_settings_view_ = CreateSiteSettingsView();
436 layout->AddView(site_settings_view_); 428 layout->AddView(site_settings_view_);
437 429
438 // Each section handles its own padding. 430 // Remove the top margin from the client area so there is less space below the
439 set_margins(gfx::Insets(0, 0, kPopupMarginBottom, 0)); 431 // dialog title.
432 set_margins(
433 gfx::Insets(0, margins().left(), margins().bottom(), margins().right()));
434 if (!ui::MaterialDesignController::IsSecondaryUiMaterial()) {
435 // In non-material, titles are inset from the dialog margin. Ensure the
436 // horizontal insets match.
437 set_title_margins(gfx::Insets(views::kPanelVertMargin, margins().left(), 0,
438 margins().right()));
439 }
440 views::BubbleDialogDelegateView::CreateBubble(this); 440 views::BubbleDialogDelegateView::CreateBubble(this);
441 441
442 presenter_.reset(new WebsiteSettings( 442 presenter_.reset(new WebsiteSettings(
443 this, profile, TabSpecificContentSettings::FromWebContents(web_contents), 443 this, profile, TabSpecificContentSettings::FromWebContents(web_contents),
444 web_contents, url, security_info)); 444 web_contents, url, security_info));
445 } 445 }
446 446
447 void WebsiteSettingsPopupView::RenderFrameDeleted( 447 void WebsiteSettingsPopupView::RenderFrameDeleted(
448 content::RenderFrameHost* render_frame_host) { 448 content::RenderFrameHost* render_frame_host) {
449 if (render_frame_host == web_contents()->GetMainFrame()) 449 if (render_frame_host == web_contents()->GetMainFrame())
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 SizeToContents(); 681 SizeToContents();
682 } 682 }
683 683
684 views::View* WebsiteSettingsPopupView::CreateSiteSettingsView() { 684 views::View* WebsiteSettingsPopupView::CreateSiteSettingsView() {
685 views::View* site_settings_view = new views::View(); 685 views::View* site_settings_view = new views::View();
686 views::BoxLayout* box_layout = 686 views::BoxLayout* box_layout =
687 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0); 687 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0);
688 site_settings_view->SetLayoutManager(box_layout); 688 site_settings_view->SetLayoutManager(box_layout);
689 box_layout->set_cross_axis_alignment( 689 box_layout->set_cross_axis_alignment(
690 views::BoxLayout::CROSS_AXIS_ALIGNMENT_STRETCH); 690 views::BoxLayout::CROSS_AXIS_ALIGNMENT_STRETCH);
691 box_layout->set_inside_border_insets(
692 gfx::Insets(0, kSectionPaddingHorizontal));
693 691
694 // Add cookies view. 692 // Add cookies view.
695 cookies_view_ = new views::View(); 693 cookies_view_ = new views::View();
696 site_settings_view->AddChildView(cookies_view_); 694 site_settings_view->AddChildView(cookies_view_);
697 695
698 return site_settings_view; 696 return site_settings_view;
699 } 697 }
700 698
701 void WebsiteSettingsPopupView::HandleLinkClickedAsync(views::Link* source) { 699 void WebsiteSettingsPopupView::HandleLinkClickedAsync(views::Link* source) {
702 // Both switch cases require accessing web_contents(), so we check it here. 700 // Both switch cases require accessing web_contents(), so we check it here.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 WebsiteSettings::WEBSITE_SETTINGS_CONNECTION_HELP_OPENED); 737 WebsiteSettings::WEBSITE_SETTINGS_CONNECTION_HELP_OPENED);
740 break; 738 break;
741 case STYLED_LABEL_RESET_CERTIFICATE_DECISIONS: 739 case STYLED_LABEL_RESET_CERTIFICATE_DECISIONS:
742 presenter_->OnRevokeSSLErrorBypassButtonPressed(); 740 presenter_->OnRevokeSSLErrorBypassButtonPressed();
743 GetWidget()->Close(); 741 GetWidget()->Close();
744 break; 742 break;
745 default: 743 default:
746 NOTREACHED(); 744 NOTREACHED();
747 } 745 }
748 } 746 }
OLDNEW
« no previous file with comments | « no previous file | ui/views/bubble/bubble_dialog_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698