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

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

Issue 1673403002: Views - fix up layout of a couple dialogs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/permissions_bubble_view.h" 5 #include "chrome/browser/ui/views/website_settings/permissions_bubble_view.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
(...skipping 26 matching lines...) Expand all
37 #include "ui/views/controls/button/label_button.h" 37 #include "ui/views/controls/button/label_button.h"
38 #include "ui/views/controls/button/label_button_border.h" 38 #include "ui/views/controls/button/label_button_border.h"
39 #include "ui/views/controls/button/menu_button.h" 39 #include "ui/views/controls/button/menu_button.h"
40 #include "ui/views/controls/button/menu_button_listener.h" 40 #include "ui/views/controls/button/menu_button_listener.h"
41 #include "ui/views/controls/combobox/combobox.h" 41 #include "ui/views/controls/combobox/combobox.h"
42 #include "ui/views/controls/combobox/combobox_listener.h" 42 #include "ui/views/controls/combobox/combobox_listener.h"
43 #include "ui/views/controls/label.h" 43 #include "ui/views/controls/label.h"
44 #include "ui/views/controls/menu/menu_runner.h" 44 #include "ui/views/controls/menu/menu_runner.h"
45 #include "ui/views/layout/box_layout.h" 45 #include "ui/views/layout/box_layout.h"
46 #include "ui/views/layout/grid_layout.h" 46 #include "ui/views/layout/grid_layout.h"
47 #include "ui/views/layout/layout_constants.h"
47 48
48 namespace { 49 namespace {
49 50
50 // Spacing between major items should be 9px. 51 // Spacing between major items should be 9px.
51 const int kItemMajorSpacing = 9; 52 const int kItemMajorSpacing = 9;
52 53
53 // Button border size, draws inside the spacing distance. 54 // Button border size, draws inside the spacing distance.
54 const int kButtonBorderSize = 2; 55 const int kButtonBorderSize = 2;
55 56
56 // (Square) pixel size of icon. 57 // (Square) pixel size of icon.
57 const int kIconSize = 18; 58 const int kIconSize = 18;
58 59
59 // Number of pixels to indent the permission request labels.
60 const int kPermissionIndentSpacing = 12;
61
62 } // namespace 60 } // namespace
63 61
64 // This class is a MenuButton which is given a PermissionMenuModel. It 62 // This class is a MenuButton which is given a PermissionMenuModel. It
65 // shows the current checked item in the menu model, and notifies its listener 63 // shows the current checked item in the menu model, and notifies its listener
66 // about any updates to the state of the selection. 64 // about any updates to the state of the selection.
67 // TODO(gbillock): refactor PermissionMenuButton to work like this and re-use? 65 // TODO(gbillock): refactor PermissionMenuButton to work like this and re-use?
68 class PermissionCombobox : public views::MenuButton, 66 class PermissionCombobox : public views::MenuButton,
69 public views::MenuButtonListener { 67 public views::MenuButtonListener {
70 public: 68 public:
71 // Get notifications when the selection changes. 69 // Get notifications when the selection changes.
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 row->SetLayoutManager(row_layout); 226 row->SetLayoutManager(row_layout);
229 views::ColumnSet* columns = row_layout->AddColumnSet(0); 227 views::ColumnSet* columns = row_layout->AddColumnSet(0);
230 columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::FILL, 228 columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::FILL,
231 0, views::GridLayout::USE_PREF, 0, 0); 229 0, views::GridLayout::USE_PREF, 0, 0);
232 columns->AddColumn(views::GridLayout::TRAILING, views::GridLayout::FILL, 230 columns->AddColumn(views::GridLayout::TRAILING, views::GridLayout::FILL,
233 100, views::GridLayout::USE_PREF, 0, 0); 231 100, views::GridLayout::USE_PREF, 0, 0);
234 row_layout->StartRow(0, 0); 232 row_layout->StartRow(0, 0);
235 233
236 views::View* label_container = new views::View(); 234 views::View* label_container = new views::View();
237 label_container->SetLayoutManager(new views::BoxLayout( 235 label_container->SetLayoutManager(new views::BoxLayout(
238 views::BoxLayout::kHorizontal, kPermissionIndentSpacing, 0, 0)); 236 views::BoxLayout::kHorizontal, views::kCheckboxIndent, 0,
Evan Stade 2016/02/08 23:00:49 this 0 used to be kBubbleOuterMargin (5) but I del
msw 2016/02/09 00:04:36 Is this for 585076? It doesn't seem like a 0 here
Evan Stade 2016/02/09 23:47:58 sorry, wrong bug, should have been crbug.com/58501
237 views::kItemLabelSpacing));
239 views::ImageView* icon = new views::ImageView(); 238 views::ImageView* icon = new views::ImageView();
240 gfx::VectorIconId vector_id = requests[index]->GetVectorIconId(); 239 gfx::VectorIconId vector_id = requests[index]->GetVectorIconId();
241 if (vector_id != gfx::VectorIconId::VECTOR_ICON_NONE) { 240 if (vector_id != gfx::VectorIconId::VECTOR_ICON_NONE) {
242 icon->SetImage( 241 icon->SetImage(
243 gfx::CreateVectorIcon(vector_id, kIconSize, gfx::kChromeIconGrey)); 242 gfx::CreateVectorIcon(vector_id, kIconSize, gfx::kChromeIconGrey));
244 } else { 243 } else {
245 icon->SetImage(bundle.GetImageSkiaNamed(requests.at(index)->GetIconId())); 244 icon->SetImage(bundle.GetImageSkiaNamed(requests.at(index)->GetIconId()));
246 icon->SetImageSize(gfx::Size(kIconSize, kIconSize)); 245 icon->SetImageSize(gfx::Size(kIconSize, kIconSize));
247 } 246 }
248 icon->SetTooltipText(base::string16()); // Redundant with the text fragment 247 icon->SetTooltipText(base::string16()); // Redundant with the text fragment
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 495
497 void PermissionBubbleViewViews::Accept() { 496 void PermissionBubbleViewViews::Accept() {
498 if (delegate_) 497 if (delegate_)
499 delegate_->Accept(); 498 delegate_->Accept();
500 } 499 }
501 500
502 void PermissionBubbleViewViews::Deny() { 501 void PermissionBubbleViewViews::Deny() {
503 if (delegate_) 502 if (delegate_)
504 delegate_->Deny(); 503 delegate_->Deny();
505 } 504 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698