Chromium Code Reviews| 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> |
| 11 | 11 |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/stl_util.h" | 14 #include "base/stl_util.h" |
| 15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
| 16 #include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h" | 16 #include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h" |
| 17 #include "chrome/browser/plugins/plugin_finder.h" | 17 #include "chrome/browser/plugins/plugin_finder.h" |
| 18 #include "chrome/browser/plugins/plugin_metadata.h" | 18 #include "chrome/browser/plugins/plugin_metadata.h" |
| 19 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" | 19 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" |
| 20 #include "chrome/browser/ui/layout_constants.h" | 20 #include "chrome/browser/ui/layout_constants.h" |
| 21 #include "chrome/browser/ui/views/harmony/layout_delegate.h" | |
| 21 #include "chrome/grit/generated_resources.h" | 22 #include "chrome/grit/generated_resources.h" |
| 22 #include "components/content_settings/core/browser/host_content_settings_map.h" | 23 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 23 #include "components/strings/grit/components_strings.h" | 24 #include "components/strings/grit/components_strings.h" |
| 24 #include "content/public/browser/plugin_service.h" | 25 #include "content/public/browser/plugin_service.h" |
| 25 #include "content/public/browser/web_contents.h" | 26 #include "content/public/browser/web_contents.h" |
| 26 #include "ui/base/cursor/cursor.h" | 27 #include "ui/base/cursor/cursor.h" |
| 28 #include "ui/base/default_style.h" | |
| 27 #include "ui/base/l10n/l10n_util.h" | 29 #include "ui/base/l10n/l10n_util.h" |
| 28 #include "ui/base/models/simple_menu_model.h" | 30 #include "ui/base/models/simple_menu_model.h" |
| 29 #include "ui/base/resource/resource_bundle.h" | 31 #include "ui/base/resource/resource_bundle.h" |
| 30 #include "ui/gfx/font_list.h" | 32 #include "ui/gfx/font_list.h" |
| 31 #include "ui/gfx/text_utils.h" | 33 #include "ui/gfx/text_utils.h" |
| 34 #include "ui/views/controls/button/label_button_border.h" | |
| 32 #include "ui/views/controls/button/md_text_button.h" | 35 #include "ui/views/controls/button/md_text_button.h" |
| 33 #include "ui/views/controls/button/menu_button.h" | 36 #include "ui/views/controls/button/menu_button.h" |
| 34 #include "ui/views/controls/button/radio_button.h" | 37 #include "ui/views/controls/button/radio_button.h" |
| 35 #include "ui/views/controls/combobox/combobox.h" | 38 #include "ui/views/controls/combobox/combobox.h" |
| 36 #include "ui/views/controls/image_view.h" | 39 #include "ui/views/controls/image_view.h" |
| 37 #include "ui/views/controls/label.h" | 40 #include "ui/views/controls/label.h" |
| 38 #include "ui/views/controls/link.h" | 41 #include "ui/views/controls/link.h" |
| 39 #include "ui/views/controls/menu/menu_config.h" | 42 #include "ui/views/controls/menu/menu_config.h" |
| 40 #include "ui/views/controls/menu/menu_runner.h" | 43 #include "ui/views/controls/menu/menu_runner.h" |
| 41 #include "ui/views/controls/separator.h" | 44 #include "ui/views/controls/separator.h" |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 174 } | 177 } |
| 175 | 178 |
| 176 ContentSettingBubbleContents::~ContentSettingBubbleContents() { | 179 ContentSettingBubbleContents::~ContentSettingBubbleContents() { |
| 177 // Must remove the children here so the comboboxes get destroyed before | 180 // Must remove the children here so the comboboxes get destroyed before |
| 178 // their associated models. | 181 // their associated models. |
| 179 RemoveAllChildViews(true); | 182 RemoveAllChildViews(true); |
| 180 } | 183 } |
| 181 | 184 |
| 182 gfx::Size ContentSettingBubbleContents::GetPreferredSize() const { | 185 gfx::Size ContentSettingBubbleContents::GetPreferredSize() const { |
| 183 gfx::Size preferred_size(views::View::GetPreferredSize()); | 186 gfx::Size preferred_size(views::View::GetPreferredSize()); |
| 184 int preferred_width = | 187 int preferred_width = LayoutDelegate::Get()->GetDialogPreferredWidth( |
| 185 (!content_setting_bubble_model_->bubble_content().domain_lists.empty() && | 188 LayoutDelegate::DialogWidthType::SMALL); |
| 186 (kMinMultiLineContentsWidth > preferred_size.width())) | 189 if (!preferred_width) |
| 187 ? kMinMultiLineContentsWidth | 190 preferred_width = (!content_setting_bubble_model_->bubble_content() |
| 188 : preferred_size.width(); | 191 .domain_lists.empty() && |
| 192 (kMinMultiLineContentsWidth > preferred_size.width())) | |
| 193 ? kMinMultiLineContentsWidth | |
| 194 : preferred_size.width(); | |
| 195 else | |
| 196 preferred_width -= margins().width(); | |
| 189 if (content_setting_bubble_model_->AsSubresourceFilterBubbleModel()) { | 197 if (content_setting_bubble_model_->AsSubresourceFilterBubbleModel()) { |
| 190 preferred_size.set_width(std::min(preferred_width, | 198 preferred_size.set_width(std::min(preferred_width, |
| 191 kMaxDefaultContentsWidth)); | 199 kMaxDefaultContentsWidth)); |
| 192 } else { | 200 } else { |
| 193 preferred_size.set_width(std::min(preferred_width, kMaxContentsWidth)); | 201 preferred_size.set_width(std::min(preferred_width, kMaxContentsWidth)); |
| 194 } | 202 } |
| 195 return preferred_size; | 203 return preferred_size; |
| 196 } | 204 } |
| 197 | 205 |
| 198 void ContentSettingBubbleContents::Init() { | 206 void ContentSettingBubbleContents::Init() { |
| 199 using views::GridLayout; | 207 using views::GridLayout; |
| 200 | 208 |
| 201 GridLayout* layout = new views::GridLayout(this); | 209 GridLayout* layout = new views::GridLayout(this); |
| 202 SetLayoutManager(layout); | 210 SetLayoutManager(layout); |
| 211 const LayoutDelegate* layout_delegate = LayoutDelegate::Get(); | |
| 212 const int related_control_horizontal_spacing = | |
| 213 layout_delegate->GetLayoutDistance( | |
| 214 LayoutDelegate::LayoutDistanceType:: | |
| 215 RELATED_CONTROL_HORIZONTAL_SPACING); | |
| 216 const int related_control_vertical_spacing = | |
| 217 layout_delegate->GetLayoutDistance( | |
| 218 LayoutDelegate::LayoutDistanceType::RELATED_CONTROL_VERTICAL_SPACING); | |
| 219 const int unrelated_control_vertical_spacing = | |
| 220 layout_delegate->GetLayoutDistance( | |
| 221 LayoutDelegate::LayoutDistanceType::RELATED_CONTROL_VERTICAL_SPACING); | |
|
sky
2017/01/05 23:26:40
Isn't this the same as 216 above?
kylix_rd
2017/01/06 14:36:50
Wrong constant. Will fix.
| |
| 203 | 222 |
| 204 const int kSingleColumnSetId = 0; | 223 const int kSingleColumnSetId = 0; |
| 205 views::ColumnSet* column_set = layout->AddColumnSet(kSingleColumnSetId); | 224 views::ColumnSet* column_set = layout->AddColumnSet(kSingleColumnSetId); |
| 206 column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL, 1, | 225 column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL, 1, |
| 207 GridLayout::USE_PREF, 0, 0); | 226 GridLayout::USE_PREF, 0, 0); |
| 208 column_set->AddPaddingColumn(0, views::kRelatedControlHorizontalSpacing); | 227 column_set->AddPaddingColumn(0, related_control_horizontal_spacing); |
| 209 column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL, 1, | 228 column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL, 1, |
| 210 GridLayout::USE_PREF, 0, 0); | 229 GridLayout::USE_PREF, 0, 0); |
| 211 | 230 |
| 212 const ContentSettingBubbleModel::BubbleContent& bubble_content = | 231 const ContentSettingBubbleModel::BubbleContent& bubble_content = |
| 213 content_setting_bubble_model_->bubble_content(); | 232 content_setting_bubble_model_->bubble_content(); |
| 214 bool bubble_content_empty = true; | 233 bool bubble_content_empty = true; |
| 215 | 234 |
| 216 if (!bubble_content.title.empty()) { | 235 if (!bubble_content.title.empty()) { |
| 217 views::Label* title_label = new views::Label(bubble_content.title); | 236 views::Label* title_label = new views::Label(bubble_content.title); |
| 218 title_label->SetMultiLine(true); | 237 title_label->SetMultiLine(true); |
| 219 title_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 238 title_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 239 if (layout_delegate->IsHarmonyMode()) { | |
| 240 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | |
| 241 title_label->SetFontList( | |
| 242 rb.GetFontListWithDelta(ui::kTitleFontSizeDelta)); | |
| 243 } | |
| 220 layout->StartRow(0, kSingleColumnSetId); | 244 layout->StartRow(0, kSingleColumnSetId); |
| 221 layout->AddView(title_label); | 245 layout->AddView(title_label); |
| 222 bubble_content_empty = false; | 246 bubble_content_empty = false; |
| 223 } | 247 } |
| 224 | 248 |
| 225 if (!bubble_content.message.empty()) { | 249 if (!bubble_content.message.empty()) { |
| 226 views::Label* message_label = new views::Label(bubble_content.message); | 250 views::Label* message_label = new views::Label(bubble_content.message); |
| 227 layout->AddPaddingRow(0, views::kUnrelatedControlVerticalSpacing); | 251 layout->AddPaddingRow(0, unrelated_control_vertical_spacing); |
| 228 message_label->SetMultiLine(true); | 252 message_label->SetMultiLine(true); |
| 229 message_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 253 message_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 230 layout->StartRow(0, kSingleColumnSetId); | 254 layout->StartRow(0, kSingleColumnSetId); |
| 231 layout->AddView(message_label); | 255 layout->AddView(message_label); |
| 232 bubble_content_empty = false; | 256 bubble_content_empty = false; |
| 233 } | 257 } |
| 234 | 258 |
| 235 if (!bubble_content.learn_more_link.empty()) { | 259 if (!bubble_content.learn_more_link.empty()) { |
| 236 learn_more_link_ = | 260 learn_more_link_ = |
| 237 new views::Link(base::UTF8ToUTF16(bubble_content.learn_more_link)); | 261 new views::Link(base::UTF8ToUTF16(bubble_content.learn_more_link)); |
| 238 learn_more_link_->set_listener(this); | 262 learn_more_link_->set_listener(this); |
| 239 learn_more_link_->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 263 learn_more_link_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 240 layout->AddView(learn_more_link_); | 264 layout->AddView(learn_more_link_); |
| 241 bubble_content_empty = false; | 265 bubble_content_empty = false; |
| 242 } | 266 } |
| 243 | 267 |
| 244 // Layout for the item list (blocked plugins and popups). | 268 // Layout for the item list (blocked plugins and popups). |
| 245 if (!bubble_content.list_items.empty()) { | 269 if (!bubble_content.list_items.empty()) { |
| 246 const int kItemListColumnSetId = 2; | 270 const int kItemListColumnSetId = 2; |
| 247 views::ColumnSet* item_list_column_set = | 271 views::ColumnSet* item_list_column_set = |
| 248 layout->AddColumnSet(kItemListColumnSetId); | 272 layout->AddColumnSet(kItemListColumnSetId); |
| 249 item_list_column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL, 0, | 273 item_list_column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL, 0, |
| 250 GridLayout::USE_PREF, 0, 0); | 274 GridLayout::USE_PREF, 0, 0); |
| 251 item_list_column_set->AddPaddingColumn( | 275 item_list_column_set->AddPaddingColumn(0, |
| 252 0, views::kRelatedControlHorizontalSpacing); | 276 related_control_horizontal_spacing); |
| 253 item_list_column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL, 1, | 277 item_list_column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL, 1, |
| 254 GridLayout::USE_PREF, 0, 0); | 278 GridLayout::USE_PREF, 0, 0); |
| 255 | 279 |
| 256 int row = 0; | 280 int row = 0; |
| 257 for (const ContentSettingBubbleModel::ListItem& list_item : | 281 for (const ContentSettingBubbleModel::ListItem& list_item : |
| 258 bubble_content.list_items) { | 282 bubble_content.list_items) { |
| 259 if (!bubble_content_empty) | 283 if (!bubble_content_empty) |
| 260 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 284 layout->AddPaddingRow(0, related_control_vertical_spacing); |
| 261 layout->StartRow(0, kItemListColumnSetId); | 285 layout->StartRow(0, kItemListColumnSetId); |
| 262 if (list_item.has_link) { | 286 if (list_item.has_link) { |
| 263 views::Link* link = new views::Link(base::UTF8ToUTF16(list_item.title)); | 287 views::Link* link = new views::Link(base::UTF8ToUTF16(list_item.title)); |
| 264 link->set_listener(this); | 288 link->set_listener(this); |
| 265 link->SetElideBehavior(gfx::ELIDE_MIDDLE); | 289 link->SetElideBehavior(gfx::ELIDE_MIDDLE); |
| 266 list_item_links_[link] = row; | 290 list_item_links_[link] = row; |
| 267 layout->AddView(new Favicon(list_item.image, this, link)); | 291 layout->AddView(new Favicon(list_item.image, this, link)); |
| 268 layout->AddView(link); | 292 layout->AddView(link); |
| 269 } else { | 293 } else { |
| 270 views::ImageView* icon = new views::ImageView(); | 294 views::ImageView* icon = new views::ImageView(); |
| 271 icon->SetImage(list_item.image.AsImageSkia()); | 295 icon->SetImage(list_item.image.AsImageSkia()); |
| 272 layout->AddView(icon); | 296 layout->AddView(icon); |
| 273 layout->AddView(new views::Label(base::UTF8ToUTF16(list_item.title))); | 297 layout->AddView(new views::Label(base::UTF8ToUTF16(list_item.title))); |
| 274 } | 298 } |
| 275 row++; | 299 row++; |
| 276 bubble_content_empty = false; | 300 bubble_content_empty = false; |
| 277 } | 301 } |
| 278 } | 302 } |
| 279 | 303 |
| 280 const int indented_kSingleColumnSetId = 3; | 304 const int indented_kSingleColumnSetId = 3; |
| 281 // Insert a column set with greater indent. | 305 // Insert a column set with greater indent. |
| 282 views::ColumnSet* indented_single_column_set = | 306 views::ColumnSet* indented_single_column_set = |
| 283 layout->AddColumnSet(indented_kSingleColumnSetId); | 307 layout->AddColumnSet(indented_kSingleColumnSetId); |
| 284 indented_single_column_set->AddPaddingColumn(0, views::kCheckboxIndent); | 308 indented_single_column_set->AddPaddingColumn( |
| 309 0, layout_delegate->GetLayoutDistance( | |
| 310 LayoutDelegate::LayoutDistanceType::CHECKBOX_INDENT)); | |
| 285 indented_single_column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL, | 311 indented_single_column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL, |
| 286 1, GridLayout::USE_PREF, 0, 0); | 312 1, GridLayout::USE_PREF, 0, 0); |
| 287 | 313 |
| 288 const ContentSettingBubbleModel::RadioGroup& radio_group = | 314 const ContentSettingBubbleModel::RadioGroup& radio_group = |
| 289 bubble_content.radio_group; | 315 bubble_content.radio_group; |
| 290 if (!radio_group.radio_items.empty()) { | 316 if (!radio_group.radio_items.empty()) { |
| 291 if (!bubble_content_empty) | 317 if (!bubble_content_empty) |
| 292 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 318 layout->AddPaddingRow(0, related_control_vertical_spacing); |
| 293 for (ContentSettingBubbleModel::RadioItems::const_iterator i( | 319 for (ContentSettingBubbleModel::RadioItems::const_iterator i( |
| 294 radio_group.radio_items.begin()); | 320 radio_group.radio_items.begin()); |
| 295 i != radio_group.radio_items.end(); ++i) { | 321 i != radio_group.radio_items.end(); ++i) { |
| 296 views::RadioButton* radio = | 322 views::RadioButton* radio = |
| 297 new views::RadioButton(base::UTF8ToUTF16(*i), 0); | 323 new views::RadioButton(base::UTF8ToUTF16(*i), 0); |
| 298 radio->SetEnabled(bubble_content.radio_group_enabled); | 324 radio->SetEnabled(bubble_content.radio_group_enabled); |
| 299 radio->set_listener(this); | 325 radio->set_listener(this); |
| 326 if (layout_delegate->IsHarmonyMode()) { | |
| 327 std::unique_ptr<views::LabelButtonBorder> border = | |
| 328 radio->CreateDefaultBorder(); | |
| 329 gfx::Insets insets = border->GetInsets(); | |
| 330 border->set_insets( | |
| 331 gfx::Insets(insets.top(), 0, insets.bottom(), insets.right())); | |
| 332 radio->SetBorder(std::move(border)); | |
| 333 } | |
| 300 radio_group_.push_back(radio); | 334 radio_group_.push_back(radio); |
| 301 layout->StartRow(0, indented_kSingleColumnSetId); | 335 layout->StartRow(0, indented_kSingleColumnSetId); |
| 302 layout->AddView(radio); | 336 layout->AddView(radio); |
| 303 bubble_content_empty = false; | 337 bubble_content_empty = false; |
| 304 } | 338 } |
| 305 DCHECK(!radio_group_.empty()); | 339 DCHECK(!radio_group_.empty()); |
| 306 // Now that the buttons have been added to the view hierarchy, it's safe | 340 // Now that the buttons have been added to the view hierarchy, it's safe |
| 307 // to call SetChecked() on them. | 341 // to call SetChecked() on them. |
| 308 radio_group_[radio_group.default_item]->SetChecked(true); | 342 radio_group_[radio_group.default_item]->SetChecked(true); |
| 309 } | 343 } |
| 310 | 344 |
| 311 // Layout code for the media device menus. | 345 // Layout code for the media device menus. |
| 312 if (content_setting_bubble_model_->AsMediaStreamBubbleModel()) { | 346 if (content_setting_bubble_model_->AsMediaStreamBubbleModel()) { |
| 313 const int kMediaMenuColumnSetId = 4; | 347 const int kMediaMenuColumnSetId = 4; |
| 314 views::ColumnSet* menu_column_set = | 348 views::ColumnSet* menu_column_set = |
| 315 layout->AddColumnSet(kMediaMenuColumnSetId); | 349 layout->AddColumnSet(kMediaMenuColumnSetId); |
| 316 menu_column_set->AddPaddingColumn(0, views::kCheckboxIndent); | 350 menu_column_set->AddPaddingColumn( |
| 351 0, layout_delegate->GetLayoutDistance( | |
| 352 LayoutDelegate::LayoutDistanceType::CHECKBOX_INDENT)); | |
| 317 menu_column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL, 0, | 353 menu_column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL, 0, |
| 318 GridLayout::USE_PREF, 0, 0); | 354 GridLayout::USE_PREF, 0, 0); |
| 319 menu_column_set->AddPaddingColumn( | 355 menu_column_set->AddPaddingColumn(0, related_control_horizontal_spacing); |
| 320 0, views::kRelatedControlHorizontalSpacing); | |
| 321 menu_column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL, 1, | 356 menu_column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL, 1, |
| 322 GridLayout::USE_PREF, 0, 0); | 357 GridLayout::USE_PREF, 0, 0); |
| 323 | 358 |
| 324 for (ContentSettingBubbleModel::MediaMenuMap::const_iterator i( | 359 for (ContentSettingBubbleModel::MediaMenuMap::const_iterator i( |
| 325 bubble_content.media_menus.begin()); | 360 bubble_content.media_menus.begin()); |
| 326 i != bubble_content.media_menus.end(); ++i) { | 361 i != bubble_content.media_menus.end(); ++i) { |
| 327 if (!bubble_content_empty) | 362 if (!bubble_content_empty) |
| 328 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 363 layout->AddPaddingRow(0, related_control_vertical_spacing); |
| 329 layout->StartRow(0, kMediaMenuColumnSetId); | 364 layout->StartRow(0, kMediaMenuColumnSetId); |
| 330 | 365 |
| 331 views::Label* label = | 366 views::Label* label = |
| 332 new views::Label(base::UTF8ToUTF16(i->second.label)); | 367 new views::Label(base::UTF8ToUTF16(i->second.label)); |
| 333 label->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 368 label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 334 layout->AddView(label); | 369 layout->AddView(label); |
| 335 | 370 |
| 336 combobox_models_.emplace_back(i->first); | 371 combobox_models_.emplace_back(i->first); |
| 337 MediaComboboxModel* model = &combobox_models_.back(); | 372 MediaComboboxModel* model = &combobox_models_.back(); |
| 338 views::Combobox* combobox = new views::Combobox(model); | 373 views::Combobox* combobox = new views::Combobox(model); |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 369 } | 404 } |
| 370 bubble_content_empty = false; | 405 bubble_content_empty = false; |
| 371 } | 406 } |
| 372 | 407 |
| 373 if (!bubble_content.custom_link.empty()) { | 408 if (!bubble_content.custom_link.empty()) { |
| 374 custom_link_ = | 409 custom_link_ = |
| 375 new views::Link(base::UTF8ToUTF16(bubble_content.custom_link)); | 410 new views::Link(base::UTF8ToUTF16(bubble_content.custom_link)); |
| 376 custom_link_->SetEnabled(bubble_content.custom_link_enabled); | 411 custom_link_->SetEnabled(bubble_content.custom_link_enabled); |
| 377 custom_link_->set_listener(this); | 412 custom_link_->set_listener(this); |
| 378 if (!bubble_content_empty) | 413 if (!bubble_content_empty) |
| 379 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 414 layout->AddPaddingRow(0, related_control_vertical_spacing); |
| 380 layout->StartRow(0, kSingleColumnSetId); | 415 layout->StartRow(0, kSingleColumnSetId); |
| 381 layout->AddView(custom_link_); | 416 layout->AddView(custom_link_); |
| 382 bubble_content_empty = false; | 417 bubble_content_empty = false; |
| 383 } | 418 } |
| 384 | 419 |
| 385 if (!bubble_content_empty) { | 420 if (!bubble_content_empty) { |
| 386 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 421 if (!layout_delegate->IsHarmonyMode()) { |
| 387 layout->StartRow(0, kSingleColumnSetId); | 422 layout->AddPaddingRow(0, related_control_vertical_spacing); |
| 388 layout->AddView(new views::Separator(views::Separator::HORIZONTAL), 1, 1, | 423 layout->StartRow(0, kSingleColumnSetId); |
| 389 GridLayout::FILL, GridLayout::FILL); | 424 layout->AddView(new views::Separator(views::Separator::HORIZONTAL), 1, 1, |
| 390 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 425 GridLayout::FILL, GridLayout::FILL); |
| 426 } | |
| 427 layout->AddPaddingRow(0, related_control_vertical_spacing); | |
| 391 } | 428 } |
| 392 } | 429 } |
| 393 | 430 |
| 394 views::View* ContentSettingBubbleContents::CreateExtraView() { | 431 views::View* ContentSettingBubbleContents::CreateExtraView() { |
| 395 if (content_setting_bubble_model_->bubble_content() | 432 if (content_setting_bubble_model_->bubble_content() |
| 396 .show_manage_text_as_button) { | 433 .show_manage_text_as_button) { |
| 397 manage_button_ = views::MdTextButton::CreateSecondaryUiButton( | 434 manage_button_ = views::MdTextButton::CreateSecondaryUiButton( |
| 398 this, base::UTF8ToUTF16( | 435 this, base::UTF8ToUTF16( |
| 399 content_setting_bubble_model_->bubble_content().manage_text)); | 436 content_setting_bubble_model_->bubble_content().manage_text)); |
| 400 return manage_button_; | 437 return manage_button_; |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 469 DCHECK(i != list_item_links_.end()); | 506 DCHECK(i != list_item_links_.end()); |
| 470 content_setting_bubble_model_->OnListItemClicked(i->second); | 507 content_setting_bubble_model_->OnListItemClicked(i->second); |
| 471 } | 508 } |
| 472 | 509 |
| 473 void ContentSettingBubbleContents::OnPerformAction(views::Combobox* combobox) { | 510 void ContentSettingBubbleContents::OnPerformAction(views::Combobox* combobox) { |
| 474 MediaComboboxModel* model = | 511 MediaComboboxModel* model = |
| 475 static_cast<MediaComboboxModel*>(combobox->model()); | 512 static_cast<MediaComboboxModel*>(combobox->model()); |
| 476 content_setting_bubble_model_->OnMediaMenuClicked( | 513 content_setting_bubble_model_->OnMediaMenuClicked( |
| 477 model->type(), model->GetDevices()[combobox->selected_index()].id); | 514 model->type(), model->GetDevices()[combobox->selected_index()].id); |
| 478 } | 515 } |
| OLD | NEW |