| 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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 i != bubble_content.media_menus.end(); ++i) { | 297 i != bubble_content.media_menus.end(); ++i) { |
| 298 if (!bubble_content_empty) | 298 if (!bubble_content_empty) |
| 299 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 299 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
| 300 layout->StartRow(0, kMediaMenuColumnSetId); | 300 layout->StartRow(0, kMediaMenuColumnSetId); |
| 301 | 301 |
| 302 views::Label* label = | 302 views::Label* label = |
| 303 new views::Label(base::UTF8ToUTF16(i->second.label)); | 303 new views::Label(base::UTF8ToUTF16(i->second.label)); |
| 304 label->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 304 label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 305 | 305 |
| 306 views::MenuButton* menu_button = new views::MenuButton( | 306 views::MenuButton* menu_button = new views::MenuButton( |
| 307 NULL, base::UTF8ToUTF16((i->second.selected_device.name)), | 307 base::UTF8ToUTF16((i->second.selected_device.name)), this, true); |
| 308 this, true); | |
| 309 menu_button->SetStyle(views::Button::STYLE_BUTTON); | 308 menu_button->SetStyle(views::Button::STYLE_BUTTON); |
| 310 menu_button->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 309 menu_button->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 311 menu_button->set_animate_on_state_change(false); | 310 menu_button->set_animate_on_state_change(false); |
| 312 | 311 |
| 313 MediaMenuParts* menu_view = new MediaMenuParts(i->first); | 312 MediaMenuParts* menu_view = new MediaMenuParts(i->first); |
| 314 menu_view->menu_model.reset(new ContentSettingMediaMenuModel( | 313 menu_view->menu_model.reset(new ContentSettingMediaMenuModel( |
| 315 i->first, | 314 i->first, |
| 316 content_setting_bubble_model_.get(), | 315 content_setting_bubble_model_.get(), |
| 317 base::Bind(&ContentSettingBubbleContents::UpdateMenuLabel, | 316 base::Bind(&ContentSettingBubbleContents::UpdateMenuLabel, |
| 318 base::Unretained(this)))); | 317 base::Unretained(this)))); |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 // Make sure the width is at least kMinMediaMenuButtonWidth. The | 491 // Make sure the width is at least kMinMediaMenuButtonWidth. The |
| 493 // maximum width will be clamped by kMaxContentsWidth of the view. | 492 // maximum width will be clamped by kMaxContentsWidth of the view. |
| 494 menu_width = std::max(kMinMediaMenuButtonWidth, menu_width + margins); | 493 menu_width = std::max(kMinMediaMenuButtonWidth, menu_width + margins); |
| 495 | 494 |
| 496 for (MediaMenuPartsMap::const_iterator i = media_menus_.begin(); | 495 for (MediaMenuPartsMap::const_iterator i = media_menus_.begin(); |
| 497 i != media_menus_.end(); ++i) { | 496 i != media_menus_.end(); ++i) { |
| 498 i->first->SetMinSize(gfx::Size(menu_width, 0)); | 497 i->first->SetMinSize(gfx::Size(menu_width, 0)); |
| 499 i->first->SetMaxSize(gfx::Size(menu_width, 0)); | 498 i->first->SetMaxSize(gfx::Size(menu_width, 0)); |
| 500 } | 499 } |
| 501 } | 500 } |
| OLD | NEW |