| OLD | NEW | 
|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/options/exceptions_view.h" | 5 #include "chrome/browser/ui/views/options/exceptions_view.h" | 
| 6 | 6 | 
| 7 #include <algorithm> | 7 #include <algorithm> | 
| 8 #include <vector> | 8 #include <vector> | 
| 9 | 9 | 
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" | 
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 77       NOTREACHED(); | 77       NOTREACHED(); | 
| 78   } | 78   } | 
| 79 } | 79 } | 
| 80 | 80 | 
| 81 void ExceptionsView::Layout() { | 81 void ExceptionsView::Layout() { | 
| 82   views::NativeButton* buttons[] = { add_button_, edit_button_, | 82   views::NativeButton* buttons[] = { add_button_, edit_button_, | 
| 83                                      remove_button_, remove_all_button_ }; | 83                                      remove_button_, remove_all_button_ }; | 
| 84 | 84 | 
| 85   // The buttons are placed in the parent, but we need to lay them out. | 85   // The buttons are placed in the parent, but we need to lay them out. | 
| 86   int max_y = | 86   int max_y = | 
| 87       GetParent()->GetContentsBounds().bottom() - views::kButtonVEdgeMargin; | 87       parent()->GetContentsBounds().bottom() - views::kButtonVEdgeMargin; | 
| 88   int x = kPanelHorizMargin; | 88   int x = kPanelHorizMargin; | 
| 89 | 89 | 
| 90   for (size_t i = 0; i < arraysize(buttons); ++i) { | 90   for (size_t i = 0; i < arraysize(buttons); ++i) { | 
| 91     gfx::Size pref = buttons[i]->GetPreferredSize(); | 91     gfx::Size pref = buttons[i]->GetPreferredSize(); | 
| 92     buttons[i]->SetBounds(x, max_y - pref.height(), pref.width(), | 92     buttons[i]->SetBounds(x, max_y - pref.height(), pref.width(), | 
| 93                           pref.height()); | 93                           pref.height()); | 
| 94     x += pref.width() + kRelatedControlHorizontalSpacing; | 94     x += pref.width() + kRelatedControlHorizontalSpacing; | 
| 95   } | 95   } | 
| 96 | 96 | 
| 97   // Lay out the rest of this view. | 97   // Lay out the rest of this view. | 
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 189   edit_button_->set_tag(IDS_EXCEPTIONS_EDIT_BUTTON); | 189   edit_button_->set_tag(IDS_EXCEPTIONS_EDIT_BUTTON); | 
| 190   remove_button_ = new views::NativeButton( | 190   remove_button_ = new views::NativeButton( | 
| 191       this, | 191       this, | 
| 192       UTF16ToWide(l10n_util::GetStringUTF16(IDS_EXCEPTIONS_REMOVE_BUTTON))); | 192       UTF16ToWide(l10n_util::GetStringUTF16(IDS_EXCEPTIONS_REMOVE_BUTTON))); | 
| 193   remove_button_->set_tag(IDS_EXCEPTIONS_REMOVE_BUTTON); | 193   remove_button_->set_tag(IDS_EXCEPTIONS_REMOVE_BUTTON); | 
| 194   remove_all_button_ = new views::NativeButton( | 194   remove_all_button_ = new views::NativeButton( | 
| 195       this, | 195       this, | 
| 196       UTF16ToWide(l10n_util::GetStringUTF16(IDS_EXCEPTIONS_REMOVEALL_BUTTON))); | 196       UTF16ToWide(l10n_util::GetStringUTF16(IDS_EXCEPTIONS_REMOVEALL_BUTTON))); | 
| 197   remove_all_button_->set_tag(IDS_EXCEPTIONS_REMOVEALL_BUTTON); | 197   remove_all_button_->set_tag(IDS_EXCEPTIONS_REMOVEALL_BUTTON); | 
| 198 | 198 | 
| 199   View* parent = GetParent(); | 199   parent()->AddChildView(add_button_); | 
| 200   parent->AddChildView(add_button_); | 200   parent()->AddChildView(edit_button_); | 
| 201   parent->AddChildView(edit_button_); | 201   parent()->AddChildView(remove_button_); | 
| 202   parent->AddChildView(remove_button_); | 202   parent()->AddChildView(remove_all_button_); | 
| 203   parent->AddChildView(remove_all_button_); |  | 
| 204 | 203 | 
| 205   GridLayout* layout = new GridLayout(this); | 204   GridLayout* layout = new GridLayout(this); | 
| 206   layout->SetInsets(kExceptionsViewInsetSize, kExceptionsViewInsetSize, | 205   layout->SetInsets(kExceptionsViewInsetSize, kExceptionsViewInsetSize, | 
| 207                     kExceptionsViewInsetSize, kExceptionsViewInsetSize); | 206                     kExceptionsViewInsetSize, kExceptionsViewInsetSize); | 
| 208   SetLayoutManager(layout); | 207   SetLayoutManager(layout); | 
| 209 | 208 | 
| 210   const int single_column_layout_id = 0; | 209   const int single_column_layout_id = 0; | 
| 211   views::ColumnSet* column_set = layout->AddColumnSet(single_column_layout_id); | 210   views::ColumnSet* column_set = layout->AddColumnSet(single_column_layout_id); | 
| 212   column_set->AddPaddingColumn(0, kRelatedControlHorizontalSpacing); | 211   column_set->AddPaddingColumn(0, kRelatedControlHorizontalSpacing); | 
| 213   column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, 1, | 212   column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, 1, | 
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 273   } | 272   } | 
| 274 | 273 | 
| 275   UpdateButtonState(); | 274   UpdateButtonState(); | 
| 276 } | 275 } | 
| 277 | 276 | 
| 278 void ExceptionsView::RemoveAll() { | 277 void ExceptionsView::RemoveAll() { | 
| 279   model_.RemoveAll(); | 278   model_.RemoveAll(); | 
| 280 | 279 | 
| 281   UpdateButtonState(); | 280   UpdateButtonState(); | 
| 282 } | 281 } | 
| OLD | NEW | 
|---|