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

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 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..b0b76ecb43dda81fc88387d8baabbe574f677975 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,13 @@ 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, size_t>(chooser_controller_->NumOptions()), 1);
Jeffrey Yasskin 2016/08/15 21:33:53 Don't specify the second template parameter to che
juncai 2016/08/15 23:53:34 Done.
}
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, size_t>(chooser_controller_->NumOptions());
if (num_options == 0) {
DCHECK_EQ(0, row);
return chooser_controller_->GetNoOptionsText();
@@ -86,7 +89,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, size_t>(index), 1);
UpdateTableView();
table_view_->SetVisible(true);
throbber_->SetVisible(false);
@@ -94,7 +97,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, size_t>(index), 1);
+ UpdateTableView();
+}
+
+void ChooserContentView::OnOptionUpdated(size_t index) {
+ table_view_->OnItemsChanged(base::checked_cast<int, size_t>(index), 1);
UpdateTableView();
}

Powered by Google App Engine
This is Rietveld 408576698