| 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 if (!bubble_content.title.empty()) { | 193 if (!bubble_content.title.empty()) { |
| 194 views::Label* title_label = new views::Label(UTF8ToUTF16( | 194 views::Label* title_label = new views::Label(UTF8ToUTF16( |
| 195 bubble_content.title)); | 195 bubble_content.title)); |
| 196 title_label->SetMultiLine(true); | 196 title_label->SetMultiLine(true); |
| 197 title_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 197 title_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 198 layout->StartRow(0, kSingleColumnSetId); | 198 layout->StartRow(0, kSingleColumnSetId); |
| 199 layout->AddView(title_label); | 199 layout->AddView(title_label); |
| 200 bubble_content_empty = false; | 200 bubble_content_empty = false; |
| 201 } | 201 } |
| 202 | 202 |
| 203 const std::set<std::string>& plugins = bubble_content.resource_identifiers; | |
| 204 if (!plugins.empty()) { | |
| 205 if (!bubble_content_empty) | |
| 206 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | |
| 207 PluginFinder* finder = PluginFinder::GetInstance(); | |
| 208 for (std::set<std::string>::const_iterator i(plugins.begin()); | |
| 209 i != plugins.end(); ++i) { | |
| 210 base::string16 name = finder->FindPluginNameWithIdentifier(*i); | |
| 211 layout->StartRow(0, kSingleColumnSetId); | |
| 212 layout->AddView(new views::Label(name)); | |
| 213 bubble_content_empty = false; | |
| 214 } | |
| 215 } | |
| 216 | |
| 217 if (content_setting_bubble_model_->content_type() == | 203 if (content_setting_bubble_model_->content_type() == |
| 218 CONTENT_SETTINGS_TYPE_POPUPS) { | 204 CONTENT_SETTINGS_TYPE_POPUPS) { |
| 219 const int kPopupColumnSetId = 2; | 205 const int kPopupColumnSetId = 2; |
| 220 views::ColumnSet* popup_column_set = | 206 views::ColumnSet* popup_column_set = |
| 221 layout->AddColumnSet(kPopupColumnSetId); | 207 layout->AddColumnSet(kPopupColumnSetId); |
| 222 popup_column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL, 0, | 208 popup_column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL, 0, |
| 223 GridLayout::USE_PREF, 0, 0); | 209 GridLayout::USE_PREF, 0, 0); |
| 224 popup_column_set->AddPaddingColumn( | 210 popup_column_set->AddPaddingColumn( |
| 225 0, views::kRelatedControlHorizontalSpacing); | 211 0, views::kRelatedControlHorizontalSpacing); |
| 226 popup_column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL, 1, | 212 popup_column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL, 1, |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 int width = button->GetPreferredSize().width(); | 453 int width = button->GetPreferredSize().width(); |
| 468 for (int i = 0; i < menu_model->GetItemCount(); ++i) { | 454 for (int i = 0; i < menu_model->GetItemCount(); ++i) { |
| 469 button->SetText(menu_model->GetLabelAt(i)); | 455 button->SetText(menu_model->GetLabelAt(i)); |
| 470 width = std::max(width, button->GetPreferredSize().width()); | 456 width = std::max(width, button->GetPreferredSize().width()); |
| 471 } | 457 } |
| 472 | 458 |
| 473 // Recover the title for the menu button. | 459 // Recover the title for the menu button. |
| 474 button->SetText(title); | 460 button->SetText(title); |
| 475 return width; | 461 return width; |
| 476 } | 462 } |
| OLD | NEW |