| 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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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, layout_delegate->GetLayoutDistance( |
| 312 LayoutDelegate::LayoutDistanceType::CHECKBOX_INDENT)); | 312 LayoutDelegate::LayoutDistanceType::SUBSECTION_HORIZONTAL_INDENT)); |
| 313 indented_single_column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL, | 313 indented_single_column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL, |
| 314 1, GridLayout::USE_PREF, 0, 0); | 314 1, GridLayout::USE_PREF, 0, 0); |
| 315 | 315 |
| 316 const ContentSettingBubbleModel::RadioGroup& radio_group = | 316 const ContentSettingBubbleModel::RadioGroup& radio_group = |
| 317 bubble_content.radio_group; | 317 bubble_content.radio_group; |
| 318 if (!radio_group.radio_items.empty()) { | 318 if (!radio_group.radio_items.empty()) { |
| 319 if (!bubble_content_empty) | 319 if (!bubble_content_empty) |
| 320 layout->AddPaddingRow(0, related_control_vertical_spacing); | 320 layout->AddPaddingRow(0, related_control_vertical_spacing); |
| 321 for (ContentSettingBubbleModel::RadioItems::const_iterator i( | 321 for (ContentSettingBubbleModel::RadioItems::const_iterator i( |
| 322 radio_group.radio_items.begin()); | 322 radio_group.radio_items.begin()); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 343 // to call SetChecked() on them. | 343 // to call SetChecked() on them. |
| 344 radio_group_[radio_group.default_item]->SetChecked(true); | 344 radio_group_[radio_group.default_item]->SetChecked(true); |
| 345 } | 345 } |
| 346 | 346 |
| 347 // Layout code for the media device menus. | 347 // Layout code for the media device menus. |
| 348 if (content_setting_bubble_model_->AsMediaStreamBubbleModel()) { | 348 if (content_setting_bubble_model_->AsMediaStreamBubbleModel()) { |
| 349 const int kMediaMenuColumnSetId = 4; | 349 const int kMediaMenuColumnSetId = 4; |
| 350 views::ColumnSet* menu_column_set = | 350 views::ColumnSet* menu_column_set = |
| 351 layout->AddColumnSet(kMediaMenuColumnSetId); | 351 layout->AddColumnSet(kMediaMenuColumnSetId); |
| 352 menu_column_set->AddPaddingColumn( | 352 menu_column_set->AddPaddingColumn( |
| 353 0, layout_delegate->GetLayoutDistance( | 353 0, |
| 354 LayoutDelegate::LayoutDistanceType::CHECKBOX_INDENT)); | 354 layout_delegate->GetLayoutDistance( |
| 355 LayoutDelegate::LayoutDistanceType::SUBSECTION_HORIZONTAL_INDENT)); |
| 355 menu_column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL, 0, | 356 menu_column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL, 0, |
| 356 GridLayout::USE_PREF, 0, 0); | 357 GridLayout::USE_PREF, 0, 0); |
| 357 menu_column_set->AddPaddingColumn(0, related_control_horizontal_spacing); | 358 menu_column_set->AddPaddingColumn(0, related_control_horizontal_spacing); |
| 358 menu_column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL, 1, | 359 menu_column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL, 1, |
| 359 GridLayout::USE_PREF, 0, 0); | 360 GridLayout::USE_PREF, 0, 0); |
| 360 | 361 |
| 361 for (ContentSettingBubbleModel::MediaMenuMap::const_iterator i( | 362 for (ContentSettingBubbleModel::MediaMenuMap::const_iterator i( |
| 362 bubble_content.media_menus.begin()); | 363 bubble_content.media_menus.begin()); |
| 363 i != bubble_content.media_menus.end(); ++i) { | 364 i != bubble_content.media_menus.end(); ++i) { |
| 364 if (!bubble_content_empty) | 365 if (!bubble_content_empty) |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 DCHECK(i != list_item_links_.end()); | 511 DCHECK(i != list_item_links_.end()); |
| 511 content_setting_bubble_model_->OnListItemClicked(i->second); | 512 content_setting_bubble_model_->OnListItemClicked(i->second); |
| 512 } | 513 } |
| 513 | 514 |
| 514 void ContentSettingBubbleContents::OnPerformAction(views::Combobox* combobox) { | 515 void ContentSettingBubbleContents::OnPerformAction(views::Combobox* combobox) { |
| 515 MediaComboboxModel* model = | 516 MediaComboboxModel* model = |
| 516 static_cast<MediaComboboxModel*>(combobox->model()); | 517 static_cast<MediaComboboxModel*>(combobox->model()); |
| 517 content_setting_bubble_model_->OnMediaMenuClicked( | 518 content_setting_bubble_model_->OnMediaMenuClicked( |
| 518 model->type(), model->GetDevices()[combobox->selected_index()].id); | 519 model->type(), model->GetDevices()[combobox->selected_index()].id); |
| 519 } | 520 } |
| OLD | NEW |