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

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

Issue 2616573002: Adjust spacing in InternalPageInfoPopupView (Closed)
Patch Set: 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 | 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>
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 166
167 // views::BubbleDialogDelegateView: 167 // views::BubbleDialogDelegateView:
168 views::NonClientFrameView* CreateNonClientFrameView( 168 views::NonClientFrameView* CreateNonClientFrameView(
169 views::Widget* widget) override; 169 views::Widget* widget) override;
170 void OnWidgetDestroying(views::Widget* widget) override; 170 void OnWidgetDestroying(views::Widget* widget) override;
171 int GetDialogButtons() const override; 171 int GetDialogButtons() const override;
172 172
173 private: 173 private:
174 friend class WebsiteSettingsPopupView; 174 friend class WebsiteSettingsPopupView;
175 175
176 // Used around icon and inside bubble border.
177 const int kSpacing = 12;
Peter Kasting 2017/01/06 02:27:11 Nit: constexpr
Evan Stade 2017/01/06 20:20:20 Done.
178
176 DISALLOW_COPY_AND_ASSIGN(InternalPageInfoPopupView); 179 DISALLOW_COPY_AND_ASSIGN(InternalPageInfoPopupView);
177 }; 180 };
178 181
179 //////////////////////////////////////////////////////////////////////////////// 182 ////////////////////////////////////////////////////////////////////////////////
180 // Popup Header 183 // Popup Header
181 //////////////////////////////////////////////////////////////////////////////// 184 ////////////////////////////////////////////////////////////////////////////////
182 185
183 PopupHeaderView::PopupHeaderView( 186 PopupHeaderView::PopupHeaderView(
184 views::ButtonListener* button_listener, 187 views::ButtonListener* button_listener,
185 views::StyledLabelListener* styled_label_listener) 188 views::StyledLabelListener* styled_label_listener)
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 icon = IDR_PRODUCT_LOGO_16; 350 icon = IDR_PRODUCT_LOGO_16;
348 } else if (!url.SchemeIs(content::kChromeUIScheme) && 351 } else if (!url.SchemeIs(content::kChromeUIScheme) &&
349 !url.SchemeIs(content::kChromeDevToolsScheme)) { 352 !url.SchemeIs(content::kChromeDevToolsScheme)) {
350 NOTREACHED(); 353 NOTREACHED();
351 } 354 }
352 355
353 // Compensate for built-in vertical padding in the anchor view's image. 356 // Compensate for built-in vertical padding in the anchor view's image.
354 set_anchor_view_insets(gfx::Insets( 357 set_anchor_view_insets(gfx::Insets(
355 GetLayoutConstant(LOCATION_BAR_BUBBLE_ANCHOR_VERTICAL_INSET), 0)); 358 GetLayoutConstant(LOCATION_BAR_BUBBLE_ANCHOR_VERTICAL_INSET), 0));
356 359
357 const int kSpacing = 16;
358 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal, kSpacing, 360 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal, kSpacing,
359 kSpacing, kSpacing)); 361 kSpacing, kSpacing));
360 set_margins(gfx::Insets()); 362 set_margins(gfx::Insets());
361 views::ImageView* icon_view = new NonAccessibleImageView(); 363 views::ImageView* icon_view = new NonAccessibleImageView();
362 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 364 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
363 icon_view->SetImage(rb.GetImageSkiaNamed(icon)); 365 icon_view->SetImage(rb.GetImageSkiaNamed(icon));
364 AddChildView(icon_view); 366 AddChildView(icon_view);
365 367
366 views::Label* label = new views::Label(l10n_util::GetStringUTF16(text)); 368 views::Label* label = new views::Label(l10n_util::GetStringUTF16(text));
367 label->SetMultiLine(true); 369 label->SetMultiLine(true);
368 label->SetAllowCharacterBreak(true); 370 label->SetAllowCharacterBreak(true);
369 label->SetHorizontalAlignment(gfx::ALIGN_LEFT); 371 label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
370 AddChildView(label); 372 AddChildView(label);
371 373
372 views::BubbleDialogDelegateView::CreateBubble(this); 374 views::BubbleDialogDelegateView::CreateBubble(this);
373 } 375 }
374 376
375 InternalPageInfoPopupView::~InternalPageInfoPopupView() { 377 InternalPageInfoPopupView::~InternalPageInfoPopupView() {
376 } 378 }
377 379
378 views::NonClientFrameView* InternalPageInfoPopupView::CreateNonClientFrameView( 380 views::NonClientFrameView* InternalPageInfoPopupView::CreateNonClientFrameView(
379 views::Widget* widget) { 381 views::Widget* widget) {
380 views::BubbleFrameView* frame = static_cast<views::BubbleFrameView*>( 382 views::BubbleFrameView* frame = static_cast<views::BubbleFrameView*>(
381 BubbleDialogDelegateView::CreateNonClientFrameView(widget)); 383 BubbleDialogDelegateView::CreateNonClientFrameView(widget));
382 // 16px padding + half of icon width comes out to 24px. 384 // Padding around icon + half of icon width.
383 frame->bubble_border()->set_arrow_offset( 385 frame->bubble_border()->set_arrow_offset(
384 24 + frame->bubble_border()->GetBorderThickness()); 386 kSpacing + 8 + frame->bubble_border()->GetBorderThickness());
Peter Kasting 2017/01/06 02:27:11 Is it possible to compute this without hardcoding
Evan Stade 2017/01/06 20:20:20 I don't think the contents will have been laid out
385 return frame; 387 return frame;
386 } 388 }
387 389
388 void InternalPageInfoPopupView::OnWidgetDestroying(views::Widget* widget) { 390 void InternalPageInfoPopupView::OnWidgetDestroying(views::Widget* widget) {
389 g_shown_popup_type = WebsiteSettingsPopupView::POPUP_NONE; 391 g_shown_popup_type = WebsiteSettingsPopupView::POPUP_NONE;
390 } 392 }
391 393
392 int InternalPageInfoPopupView::GetDialogButtons() const { 394 int InternalPageInfoPopupView::GetDialogButtons() const {
393 return ui::DIALOG_BUTTON_NONE; 395 return ui::DIALOG_BUTTON_NONE;
394 } 396 }
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
779 WebsiteSettings::WEBSITE_SETTINGS_CONNECTION_HELP_OPENED); 781 WebsiteSettings::WEBSITE_SETTINGS_CONNECTION_HELP_OPENED);
780 break; 782 break;
781 case STYLED_LABEL_RESET_CERTIFICATE_DECISIONS: 783 case STYLED_LABEL_RESET_CERTIFICATE_DECISIONS:
782 presenter_->OnRevokeSSLErrorBypassButtonPressed(); 784 presenter_->OnRevokeSSLErrorBypassButtonPressed();
783 GetWidget()->Close(); 785 GetWidget()->Close();
784 break; 786 break;
785 default: 787 default:
786 NOTREACHED(); 788 NOTREACHED();
787 } 789 }
788 } 790 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698