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

Side by Side Diff: chrome/browser/ui/cocoa/chrome_to_mobile_bubble_controller.mm

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 #import "chrome/browser/ui/cocoa/chrome_to_mobile_bubble_controller.h" 5 #import "chrome/browser/ui/cocoa/chrome_to_mobile_bubble_controller.h"
6 6
7 #include "base/mac/mac_util.h" 7 #include "base/mac/mac_util.h"
8 #include "base/memory/weak_ptr.h" 8 #include "base/memory/weak_ptr.h"
9 #include "base/sys_string_conversions.h" 9 #include "base/sys_string_conversions.h"
10 #include "chrome/browser/chrome_to_mobile_service_factory.h" 10 #include "chrome/browser/chrome_to_mobile_service_factory.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 97
98 // Override -[BaseBubbleController showWindow:] to set up UI elements. 98 // Override -[BaseBubbleController showWindow:] to set up UI elements.
99 - (void)showWindow:(id)sender { 99 - (void)showWindow:(id)sender {
100 DCHECK(service_->HasMobiles()); 100 DCHECK(service_->HasMobiles());
101 service_->LogMetric(ChromeToMobileService::BUBBLE_SHOWN); 101 service_->LogMetric(ChromeToMobileService::BUBBLE_SHOWN);
102 102
103 // Force load the NIB. 103 // Force load the NIB.
104 NSWindow* window = [self window]; 104 NSWindow* window = [self window];
105 105
106 const ListValue* mobiles = service_->GetMobiles(); 106 const ListValue* mobiles = service_->GetMobiles();
107 DictionaryValue* mobile = NULL; 107 const DictionaryValue* mobile = NULL;
108 string16 name; 108 string16 name;
109 109
110 if (mobiles->GetSize() == 1) { 110 if (mobiles->GetSize() == 1) {
111 // Set the single device title; it's for multiple devices by default. 111 // Set the single device title; it's for multiple devices by default.
112 if (mobiles->GetDictionary(0, &mobile) && 112 if (mobiles->GetDictionary(0, &mobile) &&
113 mobile->GetString("name", &name)) { 113 mobile->GetString("name", &name)) {
114 NSString* title = l10n_util::GetNSStringF( 114 NSString* title = l10n_util::GetNSStringF(
115 IDS_CHROME_TO_MOBILE_BUBBLE_SINGLE_TITLE, name); 115 IDS_CHROME_TO_MOBILE_BUBBLE_SINGLE_TITLE, name);
116 [title_ setStringValue:title]; 116 [title_ setStringValue:title];
117 } else { 117 } else {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 178
179 - (IBAction)send:(id)sender { 179 - (IBAction)send:(id)sender {
180 // TODO(msw): Handle updates to the mobile list while the bubble is open. 180 // TODO(msw): Handle updates to the mobile list while the bubble is open.
181 const ListValue* mobiles = service_->GetMobiles(); 181 const ListValue* mobiles = service_->GetMobiles();
182 // |mobileRadioGroup_| has a single row by defualt, so these always match. 182 // |mobileRadioGroup_| has a single row by defualt, so these always match.
183 DCHECK_EQ(static_cast<NSInteger>(mobiles->GetSize()), 183 DCHECK_EQ(static_cast<NSInteger>(mobiles->GetSize()),
184 [mobileRadioGroup_ numberOfRows]); 184 [mobileRadioGroup_ numberOfRows]);
185 // NSMatrix selectedRow is -1 by default (in the single mobile device case). 185 // NSMatrix selectedRow is -1 by default (in the single mobile device case).
186 const int selected_index = std::max<int>([mobileRadioGroup_ selectedRow], 0); 186 const int selected_index = std::max<int>([mobileRadioGroup_ selectedRow], 0);
187 187
188 DictionaryValue* mobile = NULL; 188 const DictionaryValue* mobile = NULL;
189 if (mobiles->GetDictionary(selected_index, &mobile)) { 189 if (mobiles->GetDictionary(selected_index, &mobile)) {
190 service_->SendToMobile(*mobile, 190 service_->SendToMobile(*mobile,
191 ([sendCopy_ state] == NSOnState) ? snapshotPath_ : FilePath(), 191 ([sendCopy_ state] == NSOnState) ? snapshotPath_ : FilePath(),
192 browser_, bridge_->AsWeakPtr()); 192 browser_, bridge_->AsWeakPtr());
193 } else { 193 } else {
194 NOTREACHED(); 194 NOTREACHED();
195 } 195 }
196 196
197 // Update the bubble's contents to show the "Sending..." progress animation. 197 // Update the bubble's contents to show the "Sending..." progress animation.
198 [cancel_ setEnabled:NO]; 198 [cancel_ setEnabled:NO];
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 287
288 - (void)setSendCopy:(bool)sendCopy { 288 - (void)setSendCopy:(bool)sendCopy {
289 [sendCopy_ setState:(sendCopy ? NSOnState : NSOffState)]; 289 [sendCopy_ setState:(sendCopy ? NSOnState : NSOffState)];
290 } 290 }
291 291
292 - (ChromeToMobileBubbleNotificationBridge*)bridge { 292 - (ChromeToMobileBubbleNotificationBridge*)bridge {
293 return bridge_.get(); 293 return bridge_.get();
294 } 294 }
295 295
296 @end // ChromeToMobileBubbleController (JustForTesting) 296 @end // ChromeToMobileBubbleController (JustForTesting)
OLDNEW
« no previous file with comments | « chrome/browser/sync/invalidations/invalidator_storage.cc ('k') | chrome/browser/ui/gtk/chrome_to_mobile_bubble_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698