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

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

Issue 10837044: Correct const accessors in base/values.(h|cc), Part II (ListValue) (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: David's comments Created 8 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 unified diff | Download patch
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/chrome_to_mobile_bubble_view.h" 5 #include "chrome/browser/ui/views/chrome_to_mobile_bubble_view.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/string16.h" 10 #include "base/string16.h"
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 254 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
255 views::Label* title_label = new views::Label(); 255 views::Label* title_label = new views::Label();
256 title_label->SetFont(rb.GetFont(ui::ResourceBundle::MediumFont)); 256 title_label->SetFont(rb.GetFont(ui::ResourceBundle::MediumFont));
257 title_label->SetEnabledColor(kTitleColor); 257 title_label->SetEnabledColor(kTitleColor);
258 layout->StartRow(0, single_column_set_id); 258 layout->StartRow(0, single_column_set_id);
259 layout->AddView(title_label); 259 layout->AddView(title_label);
260 260
261 const ListValue* mobiles = service_->GetMobiles(); 261 const ListValue* mobiles = service_->GetMobiles();
262 if (mobiles->GetSize() == 1) { 262 if (mobiles->GetSize() == 1) {
263 string16 name; 263 string16 name;
264 DictionaryValue* mobile = NULL; 264 const DictionaryValue* mobile = NULL;
265 if (mobiles->GetDictionary(0, &mobile) && 265 if (mobiles->GetDictionary(0, &mobile) &&
266 mobile->GetString("name", &name)) { 266 mobile->GetString("name", &name)) {
267 title_label->SetText(l10n_util::GetStringFUTF16( 267 title_label->SetText(l10n_util::GetStringFUTF16(
268 IDS_CHROME_TO_MOBILE_BUBBLE_SINGLE_TITLE, name)); 268 IDS_CHROME_TO_MOBILE_BUBBLE_SINGLE_TITLE, name));
269 } else { 269 } else {
270 NOTREACHED(); 270 NOTREACHED();
271 } 271 }
272 } else { 272 } else {
273 title_label->SetText(l10n_util::GetStringUTF16( 273 title_label->SetText(l10n_util::GetStringUTF16(
274 IDS_CHROME_TO_MOBILE_BUBBLE_MULTI_TITLE)); 274 IDS_CHROME_TO_MOBILE_BUBBLE_MULTI_TITLE));
275 275
276 string16 name; 276 string16 name;
277 DictionaryValue* mobile = NULL; 277 const DictionaryValue* mobile = NULL;
278 views::RadioButton* radio = NULL; 278 views::RadioButton* radio = NULL;
279 layout->AddPaddingRow(0, views::kRelatedControlSmallVerticalSpacing); 279 layout->AddPaddingRow(0, views::kRelatedControlSmallVerticalSpacing);
280 for (size_t index = 0; index < mobiles->GetSize(); ++index) { 280 for (size_t index = 0; index < mobiles->GetSize(); ++index) {
281 if (mobiles->GetDictionary(index, &mobile) && 281 if (mobiles->GetDictionary(index, &mobile) &&
282 mobile->GetString("name", &name)) { 282 mobile->GetString("name", &name)) {
283 radio = new views::RadioButton(name, 0); 283 radio = new views::RadioButton(name, 0);
284 radio->SetEnabledColor(SK_ColorBLACK); 284 radio->SetEnabledColor(SK_ColorBLACK);
285 radio->SetHoverColor(SK_ColorBLACK); 285 radio->SetHoverColor(SK_ColorBLACK);
286 radio_buttons_.push_back(radio); 286 radio_buttons_.push_back(radio);
287 layout->StartRow(0, single_column_set_id); 287 layout->StartRow(0, single_column_set_id);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 if (mobiles->GetSize() > 1) { 359 if (mobiles->GetSize() > 1) {
360 DCHECK_EQ(mobiles->GetSize(), radio_buttons_.size()); 360 DCHECK_EQ(mobiles->GetSize(), radio_buttons_.size());
361 for (; selected_index < radio_buttons_.size(); ++selected_index) { 361 for (; selected_index < radio_buttons_.size(); ++selected_index) {
362 if (radio_buttons_[selected_index]->checked()) 362 if (radio_buttons_[selected_index]->checked())
363 break; 363 break;
364 } 364 }
365 } else { 365 } else {
366 DCHECK(radio_buttons_.empty()); 366 DCHECK(radio_buttons_.empty());
367 } 367 }
368 368
369 DictionaryValue* mobile = NULL; 369 const DictionaryValue* mobile = NULL;
370 if (mobiles->GetDictionary(selected_index, &mobile)) { 370 if (mobiles->GetDictionary(selected_index, &mobile)) {
371 FilePath snapshot = send_copy_->checked() ? snapshot_path_ : FilePath(); 371 FilePath snapshot = send_copy_->checked() ? snapshot_path_ : FilePath();
372 service_->SendToMobile(*mobile, snapshot, browser_, 372 service_->SendToMobile(*mobile, snapshot, browser_,
373 weak_ptr_factory_.GetWeakPtr()); 373 weak_ptr_factory_.GetWeakPtr());
374 } else { 374 } else {
375 NOTREACHED(); 375 NOTREACHED();
376 } 376 }
377 377
378 // Update the view's contents to show the "Sending..." progress animation. 378 // Update the view's contents to show the "Sending..." progress animation.
379 cancel_->SetEnabled(false); 379 cancel_->SetEnabled(false);
380 send_->SetEnabled(false); 380 send_->SetEnabled(false);
381 send_->set_alignment(views::TextButtonBase::ALIGN_LEFT); 381 send_->set_alignment(views::TextButtonBase::ALIGN_LEFT);
382 progress_animation_.reset(new ui::ThrobAnimation(this)); 382 progress_animation_.reset(new ui::ThrobAnimation(this));
383 progress_animation_->SetDuration(kProgressThrobDurationMS); 383 progress_animation_->SetDuration(kProgressThrobDurationMS);
384 progress_animation_->StartThrobbing(-1); 384 progress_animation_->StartThrobbing(-1);
385 } 385 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/tabs/pinned_tab_codec.cc ('k') | chrome/browser/ui/webui/chromeos/imageburner/imageburner_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698