Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(416)

Side by Side Diff: chrome/browser/ui/views/content_setting_bubble_contents.cc

Issue 2130913002: Avoid NOTREACHED in content settings bubble. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 317
318 combobox_models_.emplace_back(i->first); 318 combobox_models_.emplace_back(i->first);
319 MediaComboboxModel* model = &combobox_models_.back(); 319 MediaComboboxModel* model = &combobox_models_.back();
320 views::Combobox* combobox = new views::Combobox(model); 320 views::Combobox* combobox = new views::Combobox(model);
321 // Disable the device selection when the website is managing the devices 321 // Disable the device selection when the website is managing the devices
322 // itself or if there are no devices present. 322 // itself or if there are no devices present.
323 combobox->SetEnabled( 323 combobox->SetEnabled(
324 !(i->second.disabled || model->GetDevices().empty())); 324 !(i->second.disabled || model->GetDevices().empty()));
325 combobox->set_listener(this); 325 combobox->set_listener(this);
326 combobox->SetSelectedIndex( 326 combobox->SetSelectedIndex(
327 model->GetDeviceIndex(i->second.selected_device)); 327 model->GetDevices().empty()
328 ? 0
329 : model->GetDeviceIndex(i->second.selected_device));
328 layout->AddView(combobox); 330 layout->AddView(combobox);
329 331
330 bubble_content_empty = false; 332 bubble_content_empty = false;
331 } 333 }
332 } 334 }
333 335
334 const gfx::FontList& domain_font = 336 const gfx::FontList& domain_font =
335 ui::ResourceBundle::GetSharedInstance().GetFontList( 337 ui::ResourceBundle::GetSharedInstance().GetFontList(
336 ui::ResourceBundle::BoldFont); 338 ui::ResourceBundle::BoldFont);
337 for (std::vector<ContentSettingBubbleModel::DomainList>::const_iterator i( 339 for (std::vector<ContentSettingBubbleModel::DomainList>::const_iterator i(
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 DCHECK(i != list_item_links_.end()); 435 DCHECK(i != list_item_links_.end());
434 content_setting_bubble_model_->OnListItemClicked(i->second); 436 content_setting_bubble_model_->OnListItemClicked(i->second);
435 } 437 }
436 438
437 void ContentSettingBubbleContents::OnPerformAction(views::Combobox* combobox) { 439 void ContentSettingBubbleContents::OnPerformAction(views::Combobox* combobox) {
438 MediaComboboxModel* model = 440 MediaComboboxModel* model =
439 static_cast<MediaComboboxModel*>(combobox->model()); 441 static_cast<MediaComboboxModel*>(combobox->model());
440 content_setting_bubble_model_->OnMediaMenuClicked( 442 content_setting_bubble_model_->OnMediaMenuClicked(
441 model->type(), model->GetDevices()[combobox->selected_index()].id); 443 model->type(), model->GetDevices()[combobox->selected_index()].id);
442 } 444 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698