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

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

Issue 10805054: Fix broken paddings of the WebsiteSettingsPopopView. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: " Created 8 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/views/website_settings/permission_selector_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 "base/string_number_conversions.h" 7 #include "base/string_number_conversions.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/certificate_viewer.h" 9 #include "chrome/browser/certificate_viewer.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 27 matching lines...) Expand all
38 #include "ui/views/controls/separator.h" 38 #include "ui/views/controls/separator.h"
39 #include "ui/views/controls/tabbed_pane/tabbed_pane.h" 39 #include "ui/views/controls/tabbed_pane/tabbed_pane.h"
40 #include "ui/views/layout/box_layout.h" 40 #include "ui/views/layout/box_layout.h"
41 #include "ui/views/layout/grid_layout.h" 41 #include "ui/views/layout/grid_layout.h"
42 #include "ui/views/layout/layout_manager.h" 42 #include "ui/views/layout/layout_manager.h"
43 #include "ui/views/view.h" 43 #include "ui/views/view.h"
44 44
45 namespace { 45 namespace {
46 46
47 // Padding values for sections on the connection tab. 47 // Padding values for sections on the connection tab.
48 const int kConnectionSectionPaddingBottom = 10; 48 const int kConnectionSectionPaddingBottom = 16;
49 const int kConnectionSectionPaddingLeft = 10; 49 const int kConnectionSectionPaddingLeft = 18;
50 const int kConnectionSectionPaddingTop = 10; 50 const int kConnectionSectionPaddingTop = 16;
51 const int kConnectionSectionPaddingRight = 10; 51 const int kConnectionSectionPaddingRight = 18;
52
53 // In order to make the arrow of the bubble point directly at the location icon
54 // in the Omnibox rather then the bottom border of the Omnibox, the position of
55 // the bubble must be adjusted. This is the number of pixel the bubble must be
56 // moved towards the top of the screen (starting from the bottom border of the
57 // Omnibox).
58 const int kLocationIconBottomMargin = 5;
59 52
60 // Font size of the label for the site identity. 53 // Font size of the label for the site identity.
61 const int kIdentityNameFontSize = 14; 54 const int kIdentityNameFontSize = 14;
62 // The text color that is used for the site identity status text, if the site's 55 // The text color that is used for the site identity status text, if the site's
63 // identity was sucessfully verified. 56 // identity was sucessfully verified.
64 const int kIdentityVerifiedTextColor = 0xFF298a27; 57 const int kIdentityVerifiedTextColor = 0xFF298a27;
65 58
66 // Left icon margin. 59 // Left icon margin.
67 const int kIconMarginLeft = 4; 60 const int kIconMarginLeft = 6;
68 61
69 // Margin and padding values for the |PopupHeaderView|. 62 // Margin and padding values for the |PopupHeaderView|.
70 const int kHeaderMarginBottom = 10; 63 const int kHeaderMarginBottom = 10;
71 const int kHeaderPaddingBottom = 12; 64 const int kHeaderPaddingBottom = 12;
72 const int kHeaderPaddingLeft = 18; 65 const int kHeaderPaddingLeft = 18;
73 const int kHeaderPaddingRight = 8; 66 const int kHeaderPaddingRight = 8;
74 const int kHeaderPaddingTop = 12; 67 const int kHeaderPaddingTop = 12;
75 68
76 // Spacing between the site identity label and the site identity status text in 69 // Spacing between the site identity label and the site identity status text in
77 // the popup header. 70 // the popup header.
78 const int kHeaderRowSpacing = 4; 71 const int kHeaderRowSpacing = 4;
79 72
73 // In order to make the arrow of the bubble point directly at the location icon
74 // in the Omnibox rather then the bottom border of the Omnibox, the position of
75 // the bubble must be adjusted. This is the number of pixel the bubble must be
76 // moved towards the top of the screen (starting from the bottom border of the
77 // Omnibox).
78 const int kLocationIconBottomMargin = 5;
79
80 // The margins between the popup border and the popup content. 80 // The margins between the popup border and the popup content.
81 const int kPopupMarginTop = 4; 81 const int kPopupMarginTop = 4;
82 const int kPopupMarginLeft = 0; 82 const int kPopupMarginLeft = 0;
83 const int kPopupMarginBottom = 10; 83 const int kPopupMarginBottom = 10;
84 const int kPopupMarginRight = 0; 84 const int kPopupMarginRight = 0;
85 85
86 // Padding values for sections.
87 const int kSectionPaddingBottom = 6;
88 const int kSectionPaddingLeft = 18;
89 const int kSectionPaddingTop = 16;
90
91 // Space between a section headline and the section content.
92 const int kSectionHeadlineMarginBottom = 12;
93 // The content of the "Permissions" section and of the "Cookies and Site Data"
94 // section, is structured in individual rows. |kSectionRowSpaceing| is the
95 // space between these rows.
96 const int kSectionRowSpacing = 6;
97
98 // Padding values for sections on the permissions tab. 86 // Padding values for sections on the permissions tab.
99 const int kPermissionsSectionPaddingBottom = 6; 87 const int kPermissionsSectionPaddingBottom = 6;
100 const int kPermissionsSectionPaddingLeft = 10; 88 const int kPermissionsSectionPaddingLeft = 18;
101 const int kPermissionsSectionPaddingTop = 14; 89 const int kPermissionsSectionPaddingTop = 16;
102 // Space between the headline and the content of a section on the permissions 90 // Space between the headline and the content of a section on the permissions
103 // tab. 91 // tab.
104 const int kPermissionsSectionHeadlineMarginBottom = 10; 92 const int kPermissionsSectionHeadlineMarginBottom = 10;
105 // The content of the "Permissions" section and the "Cookies and Site Data" 93 // The content of the "Permissions" section and the "Cookies and Site Data"
106 // section is structured in individual rows. |kPermissionsSectionRowSpacing| 94 // section is structured in individual rows. |kPermissionsSectionRowSpacing|
107 // is the space between these rows. 95 // is the space between these rows.
108 const int kPermissionsSectionRowSpacing = 6; 96 const int kPermissionsSectionRowSpacing = 2;
109 97
110 // The max width of the popup. 98 // The max width of the popup.
111 const int kPopupWidth = 310; 99 const int kPopupWidth = 310;
112 100
101 const int kSiteDataIconColumnWidth = 20;
102 const int kSiteDataSectionRowSpacing = 11;
103
113 // Returns true if the passed |url| refers to an internal chrome page. 104 // Returns true if the passed |url| refers to an internal chrome page.
114 bool InternalChromePage(const GURL& url) { 105 bool InternalChromePage(const GURL& url) {
115 return url.SchemeIs(chrome::kChromeInternalScheme) || 106 return url.SchemeIs(chrome::kChromeInternalScheme) ||
116 url.SchemeIs(chrome::kChromeUIScheme); 107 url.SchemeIs(chrome::kChromeUIScheme);
117 } 108 }
118 109
119 } // namespace 110 } // namespace
120 111
121 // |PopupHeaderView| is the UI element (view) that represents the header of the 112 // |PopupHeaderView| is the UI element (view) that represents the header of the
122 // |WebsiteSettingsPopupView|. The header shows the status of the site's 113 // |WebsiteSettingsPopupView|. The header shows the status of the site's
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 386
396 views::GridLayout* layout = new views::GridLayout(site_data_content_); 387 views::GridLayout* layout = new views::GridLayout(site_data_content_);
397 site_data_content_->SetLayoutManager(layout); 388 site_data_content_->SetLayoutManager(layout);
398 389
399 const int site_data_content_column = 0; 390 const int site_data_content_column = 0;
400 views::ColumnSet* column_set = 391 views::ColumnSet* column_set =
401 layout->AddColumnSet(site_data_content_column); 392 layout->AddColumnSet(site_data_content_column);
402 column_set->AddColumn(views::GridLayout::FILL, 393 column_set->AddColumn(views::GridLayout::FILL,
403 views::GridLayout::FILL, 394 views::GridLayout::FILL,
404 1, 395 1,
405 views::GridLayout::USE_PREF, 396 views::GridLayout::FIXED,
406 0, 397 kSiteDataIconColumnWidth,
407 0); 398 0);
408 column_set->AddPaddingColumn(0, kIconMarginLeft); 399 column_set->AddPaddingColumn(0, kIconMarginLeft);
409 column_set->AddColumn(views::GridLayout::FILL, 400 column_set->AddColumn(views::GridLayout::FILL,
410 views::GridLayout::FILL, 401 views::GridLayout::FILL,
411 1, 402 1,
412 views::GridLayout::USE_PREF, 403 views::GridLayout::USE_PREF,
413 0, 404 0,
414 0); 405 0);
415 406
407 layout->AddPaddingRow(1, 5);
416 for (CookieInfoList::const_iterator i(cookie_info_list.begin()); 408 for (CookieInfoList::const_iterator i(cookie_info_list.begin());
417 i != cookie_info_list.end(); 409 i != cookie_info_list.end();
418 ++i) { 410 ++i) {
419 string16 label_text = l10n_util::GetStringFUTF16( 411 string16 label_text = l10n_util::GetStringFUTF16(
420 IDS_WEBSITE_SETTINGS_SITE_DATA_STATS_LINE, 412 IDS_WEBSITE_SETTINGS_SITE_DATA_STATS_LINE,
421 UTF8ToUTF16(i->cookie_source), 413 UTF8ToUTF16(i->cookie_source),
422 base::IntToString16(i->allowed), 414 base::IntToString16(i->allowed),
423 base::IntToString16(i->blocked)); 415 base::IntToString16(i->blocked));
416 if (i != cookie_info_list.begin())
417 layout->AddPaddingRow(1, kSiteDataSectionRowSpacing);
424 layout->StartRow(1, site_data_content_column); 418 layout->StartRow(1, site_data_content_column);
425 views::ImageView* icon = new views::ImageView(); 419 views::ImageView* icon = new views::ImageView();
426 const gfx::Image& image = WebsiteSettingsUI::GetPermissionIcon( 420 const gfx::Image& image = WebsiteSettingsUI::GetPermissionIcon(
427 CONTENT_SETTINGS_TYPE_COOKIES, CONTENT_SETTING_ALLOW); 421 CONTENT_SETTINGS_TYPE_COOKIES, CONTENT_SETTING_ALLOW);
428 icon->SetImage(image.ToImageSkia()); 422 icon->SetImage(image.ToImageSkia());
429 layout->AddView(icon); 423 layout->AddView(icon, 1, 1, views::GridLayout::CENTER,
430 layout->AddView(new views::Label(label_text),
431 1,
432 1,
433 views::GridLayout::LEADING,
434 views::GridLayout::CENTER); 424 views::GridLayout::CENTER);
435 425 layout->AddView(new views::Label(label_text), 1, 1,
436 layout->AddPaddingRow(1, kPermissionsSectionRowSpacing); 426 views::GridLayout::LEADING, views::GridLayout::CENTER);
437 } 427 }
428 layout->AddPaddingRow(1, 6);
438 429
439 layout->Layout(site_data_content_); 430 layout->Layout(site_data_content_);
440 SizeToContents(); 431 SizeToContents();
441 } 432 }
442 433
443 void WebsiteSettingsPopupView::SetPermissionInfo( 434 void WebsiteSettingsPopupView::SetPermissionInfo(
444 const PermissionInfoList& permission_info_list) { 435 const PermissionInfoList& permission_info_list) {
445 permissions_content_->RemoveAllChildViews(true); 436 permissions_content_->RemoveAllChildViews(true);
446 437
447 views::GridLayout* layout = 438 views::GridLayout* layout =
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 687
697 if (link) { 688 if (link) {
698 content_layout->StartRow(1, 0); 689 content_layout->StartRow(1, 0);
699 content_layout->AddView(link); 690 content_layout->AddView(link);
700 } 691 }
701 692
702 layout->AddView(content_pane, 1, 1, views::GridLayout::LEADING, 693 layout->AddView(content_pane, 1, 1, views::GridLayout::LEADING,
703 views::GridLayout::LEADING); 694 views::GridLayout::LEADING);
704 layout->AddPaddingRow(0, kConnectionSectionPaddingBottom); 695 layout->AddPaddingRow(0, kConnectionSectionPaddingBottom);
705 } 696 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/website_settings/permission_selector_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698