| 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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 | 180 |
| 181 ContentSettingBubbleContents::~ContentSettingBubbleContents() { | 181 ContentSettingBubbleContents::~ContentSettingBubbleContents() { |
| 182 // Must remove the children here so the comboboxes get destroyed before | 182 // Must remove the children here so the comboboxes get destroyed before |
| 183 // their associated models. | 183 // their associated models. |
| 184 RemoveAllChildViews(true); | 184 RemoveAllChildViews(true); |
| 185 } | 185 } |
| 186 | 186 |
| 187 gfx::Size ContentSettingBubbleContents::GetPreferredSize() const { | 187 gfx::Size ContentSettingBubbleContents::GetPreferredSize() const { |
| 188 gfx::Size preferred_size(views::View::GetPreferredSize()); | 188 gfx::Size preferred_size(views::View::GetPreferredSize()); |
| 189 int preferred_width = | 189 int preferred_width = |
| 190 ChromeLayoutProvider::Get()->GetDialogPreferredWidth(DialogWidth::SMALL); | 190 (!content_setting_bubble_model_->bubble_content().domain_lists.empty() && |
| 191 if (!preferred_width) | 191 (kMinMultiLineContentsWidth > preferred_size.width())) |
| 192 preferred_width = (!content_setting_bubble_model_->bubble_content() | 192 ? kMinMultiLineContentsWidth |
| 193 .domain_lists.empty() && | 193 : preferred_size.width(); |
| 194 (kMinMultiLineContentsWidth > preferred_size.width())) | |
| 195 ? kMinMultiLineContentsWidth | |
| 196 : preferred_size.width(); | |
| 197 else | |
| 198 preferred_width -= margins().width(); | |
| 199 if (content_setting_bubble_model_->AsSubresourceFilterBubbleModel()) { | 194 if (content_setting_bubble_model_->AsSubresourceFilterBubbleModel()) { |
| 200 preferred_size.set_width(std::min(preferred_width, | 195 preferred_size.set_width(std::min(preferred_width, |
| 201 kMaxDefaultContentsWidth)); | 196 kMaxDefaultContentsWidth)); |
| 202 } else { | 197 } else { |
| 203 preferred_size.set_width(std::min(preferred_width, kMaxContentsWidth)); | 198 preferred_size.set_width(std::min(preferred_width, kMaxContentsWidth)); |
| 204 } | 199 } |
| 205 return preferred_size; | 200 return preferred_size; |
| 206 } | 201 } |
| 207 | 202 |
| 208 void ContentSettingBubbleContents::Init() { | 203 void ContentSettingBubbleContents::Init() { |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 DCHECK(i != list_item_links_.end()); | 507 DCHECK(i != list_item_links_.end()); |
| 513 content_setting_bubble_model_->OnListItemClicked(i->second); | 508 content_setting_bubble_model_->OnListItemClicked(i->second); |
| 514 } | 509 } |
| 515 | 510 |
| 516 void ContentSettingBubbleContents::OnPerformAction(views::Combobox* combobox) { | 511 void ContentSettingBubbleContents::OnPerformAction(views::Combobox* combobox) { |
| 517 MediaComboboxModel* model = | 512 MediaComboboxModel* model = |
| 518 static_cast<MediaComboboxModel*>(combobox->model()); | 513 static_cast<MediaComboboxModel*>(combobox->model()); |
| 519 content_setting_bubble_model_->OnMediaMenuClicked( | 514 content_setting_bubble_model_->OnMediaMenuClicked( |
| 520 model->type(), model->GetDevices()[combobox->selected_index()].id); | 515 model->type(), model->GetDevices()[combobox->selected_index()].id); |
| 521 } | 516 } |
| OLD | NEW |