| OLD | NEW |
| 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/content_setting_bubble_contents.h" | 5 #include "chrome/browser/ui/views/content_setting_bubble_contents.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 row++; | 301 row++; |
| 302 bubble_content_empty = false; | 302 bubble_content_empty = false; |
| 303 } | 303 } |
| 304 } | 304 } |
| 305 | 305 |
| 306 const int indented_kSingleColumnSetId = 3; | 306 const int indented_kSingleColumnSetId = 3; |
| 307 // Insert a column set with greater indent. | 307 // Insert a column set with greater indent. |
| 308 views::ColumnSet* indented_single_column_set = | 308 views::ColumnSet* indented_single_column_set = |
| 309 layout->AddColumnSet(indented_kSingleColumnSetId); | 309 layout->AddColumnSet(indented_kSingleColumnSetId); |
| 310 indented_single_column_set->AddPaddingColumn( | 310 indented_single_column_set->AddPaddingColumn( |
| 311 0, layout_delegate->GetLayoutDistance( | 311 0, |
| 312 LayoutDelegate::LayoutDistanceType::CHECKBOX_INDENT)); | 312 layout_delegate->GetLayoutDistance( |
| 313 LayoutDelegate::LayoutDistanceType::SUBSECTION_INDENT)); |
| 313 indented_single_column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL, | 314 indented_single_column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL, |
| 314 1, GridLayout::USE_PREF, 0, 0); | 315 1, GridLayout::USE_PREF, 0, 0); |
| 315 | 316 |
| 316 const ContentSettingBubbleModel::RadioGroup& radio_group = | 317 const ContentSettingBubbleModel::RadioGroup& radio_group = |
| 317 bubble_content.radio_group; | 318 bubble_content.radio_group; |
| 318 if (!radio_group.radio_items.empty()) { | 319 if (!radio_group.radio_items.empty()) { |
| 319 if (!bubble_content_empty) | 320 if (!bubble_content_empty) |
| 320 layout->AddPaddingRow(0, related_control_vertical_spacing); | 321 layout->AddPaddingRow(0, related_control_vertical_spacing); |
| 321 for (ContentSettingBubbleModel::RadioItems::const_iterator i( | 322 for (ContentSettingBubbleModel::RadioItems::const_iterator i( |
| 322 radio_group.radio_items.begin()); | 323 radio_group.radio_items.begin()); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 343 // to call SetChecked() on them. | 344 // to call SetChecked() on them. |
| 344 radio_group_[radio_group.default_item]->SetChecked(true); | 345 radio_group_[radio_group.default_item]->SetChecked(true); |
| 345 } | 346 } |
| 346 | 347 |
| 347 // Layout code for the media device menus. | 348 // Layout code for the media device menus. |
| 348 if (content_setting_bubble_model_->AsMediaStreamBubbleModel()) { | 349 if (content_setting_bubble_model_->AsMediaStreamBubbleModel()) { |
| 349 const int kMediaMenuColumnSetId = 4; | 350 const int kMediaMenuColumnSetId = 4; |
| 350 views::ColumnSet* menu_column_set = | 351 views::ColumnSet* menu_column_set = |
| 351 layout->AddColumnSet(kMediaMenuColumnSetId); | 352 layout->AddColumnSet(kMediaMenuColumnSetId); |
| 352 menu_column_set->AddPaddingColumn( | 353 menu_column_set->AddPaddingColumn( |
| 353 0, layout_delegate->GetLayoutDistance( | 354 0, |
| 354 LayoutDelegate::LayoutDistanceType::CHECKBOX_INDENT)); | 355 layout_delegate->GetLayoutDistance( |
| 356 LayoutDelegate::LayoutDistanceType::SUBSECTION_INDENT)); |
| 355 menu_column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL, 0, | 357 menu_column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL, 0, |
| 356 GridLayout::USE_PREF, 0, 0); | 358 GridLayout::USE_PREF, 0, 0); |
| 357 menu_column_set->AddPaddingColumn(0, related_control_horizontal_spacing); | 359 menu_column_set->AddPaddingColumn(0, related_control_horizontal_spacing); |
| 358 menu_column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL, 1, | 360 menu_column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL, 1, |
| 359 GridLayout::USE_PREF, 0, 0); | 361 GridLayout::USE_PREF, 0, 0); |
| 360 | 362 |
| 361 for (ContentSettingBubbleModel::MediaMenuMap::const_iterator i( | 363 for (ContentSettingBubbleModel::MediaMenuMap::const_iterator i( |
| 362 bubble_content.media_menus.begin()); | 364 bubble_content.media_menus.begin()); |
| 363 i != bubble_content.media_menus.end(); ++i) { | 365 i != bubble_content.media_menus.end(); ++i) { |
| 364 if (!bubble_content_empty) | 366 if (!bubble_content_empty) |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 DCHECK(i != list_item_links_.end()); | 512 DCHECK(i != list_item_links_.end()); |
| 511 content_setting_bubble_model_->OnListItemClicked(i->second); | 513 content_setting_bubble_model_->OnListItemClicked(i->second); |
| 512 } | 514 } |
| 513 | 515 |
| 514 void ContentSettingBubbleContents::OnPerformAction(views::Combobox* combobox) { | 516 void ContentSettingBubbleContents::OnPerformAction(views::Combobox* combobox) { |
| 515 MediaComboboxModel* model = | 517 MediaComboboxModel* model = |
| 516 static_cast<MediaComboboxModel*>(combobox->model()); | 518 static_cast<MediaComboboxModel*>(combobox->model()); |
| 517 content_setting_bubble_model_->OnMediaMenuClicked( | 519 content_setting_bubble_model_->OnMediaMenuClicked( |
| 518 model->type(), model->GetDevices()[combobox->selected_index()].id); | 520 model->type(), model->GetDevices()[combobox->selected_index()].id); |
| 519 } | 521 } |
| OLD | NEW |