Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/browser/ui/website_settings/permission_bubble_request.h" | 8 #include "chrome/browser/ui/website_settings/permission_bubble_request.h" |
| 9 #include "grit/generated_resources.h" | 9 #include "grit/generated_resources.h" |
| 10 #include "ui/base/l10n/l10n_util.h" | 10 #include "ui/base/l10n/l10n_util.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 61 : views::BubbleDelegateView(anchor, views::BubbleBorder::TOP_LEFT), | 61 : views::BubbleDelegateView(anchor, views::BubbleBorder::TOP_LEFT), |
| 62 owner_(owner), | 62 owner_(owner), |
| 63 allow_(NULL), | 63 allow_(NULL), |
| 64 deny_(NULL), | 64 deny_(NULL), |
| 65 customize_(NULL) { | 65 customize_(NULL) { |
| 66 RemoveAllChildViews(true); | 66 RemoveAllChildViews(true); |
| 67 set_close_on_esc(false); | 67 set_close_on_esc(false); |
| 68 set_close_on_deactivate(false); | 68 set_close_on_deactivate(false); |
| 69 | 69 |
| 70 SetLayoutManager(new views::BoxLayout( | 70 SetLayoutManager(new views::BoxLayout( |
| 71 views::BoxLayout::kVertical, 30, 0, 20)); | 71 views::BoxLayout::kVertical, 12, 0, 10)); |
|
markusheintz_
2014/02/12 16:52:48
I actually think it would be better to introduce c
Greg Billock
2014/02/13 21:43:39
Yeah, I'll do that. Unfortunately the numbers don'
| |
| 72 | 72 |
| 73 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 73 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 74 | 74 |
| 75 if (requests.size() == 1) { | 75 if (requests.size() == 1) { |
| 76 title_ = requests[0]->GetMessageText(); | 76 title_ = requests[0]->GetMessageText(); |
| 77 if (GetWidget()) | 77 if (GetWidget()) |
| 78 GetWidget()->UpdateWindowTitle(); | 78 GetWidget()->UpdateWindowTitle(); |
| 79 } else { | 79 } else { |
| 80 for (std::vector<PermissionBubbleRequest*>::const_iterator it = | 80 for (std::vector<PermissionBubbleRequest*>::const_iterator it = |
| 81 requests.begin(); | 81 requests.begin(); |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 99 } | 99 } |
| 100 | 100 |
| 101 views::View* button_row = new views::View(); | 101 views::View* button_row = new views::View(); |
| 102 views::GridLayout* button_layout = new views::GridLayout(button_row); | 102 views::GridLayout* button_layout = new views::GridLayout(button_row); |
| 103 views::ColumnSet* columns = button_layout->AddColumnSet(0); | 103 views::ColumnSet* columns = button_layout->AddColumnSet(0); |
| 104 columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER, | 104 columns->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER, |
| 105 100.0, views::GridLayout::USE_PREF, 0, 0); | 105 100.0, views::GridLayout::USE_PREF, 0, 0); |
| 106 columns->AddColumn(views::GridLayout::TRAILING, views::GridLayout::FILL, | 106 columns->AddColumn(views::GridLayout::TRAILING, views::GridLayout::FILL, |
| 107 0, views::GridLayout::USE_PREF, 0, 0); | 107 0, views::GridLayout::USE_PREF, 0, 0); |
| 108 if (!customization_mode) { | 108 if (!customization_mode) { |
| 109 columns->AddPaddingColumn(0, 10); // padding between buttons | 109 columns->AddPaddingColumn(0, 6); // padding between buttons |
| 110 columns->AddColumn(views::GridLayout::TRAILING, views::GridLayout::FILL, | 110 columns->AddColumn(views::GridLayout::TRAILING, views::GridLayout::FILL, |
| 111 0, views::GridLayout::USE_PREF, 0, 0); | 111 0, views::GridLayout::USE_PREF, 0, 0); |
| 112 } | 112 } |
| 113 | 113 |
| 114 button_row->SetLayoutManager(button_layout); | 114 button_row->SetLayoutManager(button_layout); |
| 115 AddChildView(button_row); | 115 AddChildView(button_row); |
| 116 | 116 |
| 117 button_layout->StartRow(0, 0); | 117 button_layout->StartRow(0, 0); |
| 118 | 118 |
| 119 // Customization case: empty "Customize" label and an "OK" button | 119 // Customization case: empty "Customize" label and an "OK" button |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 163 deny_button->SetFontList(rb.GetFontList(ui::ResourceBundle::MediumFont)); | 163 deny_button->SetFontList(rb.GetFontList(ui::ResourceBundle::MediumFont)); |
| 164 button_layout->AddView(deny_button); | 164 button_layout->AddView(deny_button); |
| 165 deny_ = deny_button; | 165 deny_ = deny_button; |
| 166 | 166 |
| 167 views::LabelButton* allow_button = new views::LabelButton(this, allow_text); | 167 views::LabelButton* allow_button = new views::LabelButton(this, allow_text); |
| 168 allow_button->SetStyle(views::Button::STYLE_BUTTON); | 168 allow_button->SetStyle(views::Button::STYLE_BUTTON); |
| 169 allow_button->SetFontList(rb.GetFontList(ui::ResourceBundle::MediumFont)); | 169 allow_button->SetFontList(rb.GetFontList(ui::ResourceBundle::MediumFont)); |
| 170 button_layout->AddView(allow_button); | 170 button_layout->AddView(allow_button); |
| 171 allow_ = allow_button; | 171 allow_ = allow_button; |
| 172 | 172 |
| 173 button_layout->AddPaddingRow(0, 30); | 173 button_layout->AddPaddingRow(0, 12); |
| 174 } | 174 } |
| 175 | 175 |
| 176 PermissionsBubbleDelegateView::~PermissionsBubbleDelegateView() { | 176 PermissionsBubbleDelegateView::~PermissionsBubbleDelegateView() { |
| 177 if (owner_) | 177 if (owner_) |
| 178 owner_->Closing(); | 178 owner_->Closing(); |
| 179 } | 179 } |
| 180 | 180 |
| 181 void PermissionsBubbleDelegateView::ResetOwner() { | 181 void PermissionsBubbleDelegateView::ResetOwner() { |
| 182 owner_ = NULL; | 182 owner_ = NULL; |
| 183 } | 183 } |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 279 | 279 |
| 280 void PermissionBubbleViewViews::Deny() { | 280 void PermissionBubbleViewViews::Deny() { |
| 281 if (delegate_) | 281 if (delegate_) |
| 282 delegate_->Deny(); | 282 delegate_->Deny(); |
| 283 } | 283 } |
| 284 | 284 |
| 285 void PermissionBubbleViewViews::SetCustomizationMode() { | 285 void PermissionBubbleViewViews::SetCustomizationMode() { |
| 286 if (delegate_) | 286 if (delegate_) |
| 287 delegate_->SetCustomizationMode(); | 287 delegate_->SetCustomizationMode(); |
| 288 } | 288 } |
| OLD | NEW |