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

Unified Diff: chrome/browser/ui/views/chooser_content_view.cc

Issue 2242943002: Update device name in chooser when device changes name (desktops) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address more comments Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/chooser_content_view.cc
diff --git a/chrome/browser/ui/views/chooser_content_view.cc b/chrome/browser/ui/views/chooser_content_view.cc
index 6ae3d32f4a50e61d2ff570234140d02958829013..6d087eadfbd37c96b6bafd5fd56dd7c4ef363fee 100644
--- a/chrome/browser/ui/views/chooser_content_view.cc
+++ b/chrome/browser/ui/views/chooser_content_view.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/ui/views/chooser_content_view.h"
+#include "base/numerics/safe_conversions.h"
#include "chrome/grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/views/controls/link.h"
@@ -63,11 +64,12 @@ gfx::Size ChooserContentView::GetPreferredSize() const {
int ChooserContentView::RowCount() {
// When there are no devices, the table contains a message saying there
// are no devices, so the number of rows is always at least 1.
- return std::max(static_cast<int>(chooser_controller_->NumOptions()), 1);
+ return std::max(base::checked_cast<int>(chooser_controller_->NumOptions()),
+ 1);
}
base::string16 ChooserContentView::GetText(int row, int column_id) {
- int num_options = static_cast<int>(chooser_controller_->NumOptions());
+ int num_options = base::checked_cast<int>(chooser_controller_->NumOptions());
if (num_options == 0) {
DCHECK_EQ(0, row);
return chooser_controller_->GetNoOptionsText();
@@ -86,7 +88,7 @@ void ChooserContentView::OnOptionsInitialized() {
}
void ChooserContentView::OnOptionAdded(size_t index) {
- table_view_->OnItemsAdded(static_cast<int>(index), 1);
+ table_view_->OnItemsAdded(base::checked_cast<int>(index), 1);
UpdateTableView();
table_view_->SetVisible(true);
throbber_->SetVisible(false);
@@ -94,7 +96,12 @@ void ChooserContentView::OnOptionAdded(size_t index) {
}
void ChooserContentView::OnOptionRemoved(size_t index) {
- table_view_->OnItemsRemoved(static_cast<int>(index), 1);
+ table_view_->OnItemsRemoved(base::checked_cast<int>(index), 1);
+ UpdateTableView();
+}
+
+void ChooserContentView::OnOptionUpdated(size_t index) {
+ table_view_->OnItemsChanged(base::checked_cast<int>(index), 1);
UpdateTableView();
}
« no previous file with comments | « chrome/browser/ui/views/chooser_content_view.h ('k') | chrome/browser/ui/views/chooser_content_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698