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

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

Issue 10834203: Integrate invalidation API into ChromeToMobileService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update comment; sync and rebase. 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 | Annotate | Revision Log
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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 [sendCopy_ setTitle:sendCopyString]; 158 [sendCopy_ setTitle:sendCopyString];
159 [sendCopy_ setState:NSOffState]; 159 [sendCopy_ setState:NSOffState];
160 160
161 // Observe Chrome and ChromeToMobileService changes. 161 // Observe Chrome and ChromeToMobileService changes.
162 bridge_.reset(new ChromeToMobileBubbleNotificationBridge( 162 bridge_.reset(new ChromeToMobileBubbleNotificationBridge(
163 self, @selector(cancel:))); 163 self, @selector(cancel:)));
164 164
165 // Generate the MHTML snapshot now to report its size in the bubble. 165 // Generate the MHTML snapshot now to report its size in the bubble.
166 service_->GenerateSnapshot(browser_, bridge_->AsWeakPtr()); 166 service_->GenerateSnapshot(browser_, bridge_->AsWeakPtr());
167 167
168 // Request a mobile device list update.
169 service_->RequestMobileListUpdate();
170
171 [super showWindow:sender]; 168 [super showWindow:sender];
172 } 169 }
173 170
174 - (IBAction)learn:(id)sender { 171 - (IBAction)learn:(id)sender {
175 service_->LearnMore(browser_); 172 service_->LearnMore(browser_);
176 [self close]; 173 [self close];
177 } 174 }
178 175
179 - (IBAction)send:(id)sender { 176 - (IBAction)send:(id)sender {
180 // TODO(msw): Handle updates to the mobile list while the bubble is open. 177 // TODO(msw): Handle updates to the mobile list while the bubble is open.
181 const ListValue* mobiles = service_->GetMobiles(); 178 const ListValue* mobiles = service_->GetMobiles();
182 // |mobileRadioGroup_| has a single row by defualt, so these always match. 179 // |mobileRadioGroup_| has a single row by defualt, so these always match.
183 DCHECK_EQ(static_cast<NSInteger>(mobiles->GetSize()), 180 DCHECK_EQ(static_cast<NSInteger>(mobiles->GetSize()),
184 [mobileRadioGroup_ numberOfRows]); 181 [mobileRadioGroup_ numberOfRows]);
185 // NSMatrix selectedRow is -1 by default (in the single mobile device case). 182 // NSMatrix selectedRow is -1 by default (in the single mobile device case).
186 const int selected_index = std::max<int>([mobileRadioGroup_ selectedRow], 0); 183 const int selected_index = std::max<int>([mobileRadioGroup_ selectedRow], 0);
187 184
188 const DictionaryValue* mobile = NULL; 185 const DictionaryValue* mobile = NULL;
189 if (mobiles->GetDictionary(selected_index, &mobile)) { 186 if (mobiles->GetDictionary(selected_index, &mobile)) {
190 service_->SendToMobile(*mobile, 187 service_->SendToMobile(mobile,
191 ([sendCopy_ state] == NSOnState) ? snapshotPath_ : FilePath(), 188 ([sendCopy_ state] == NSOnState) ? snapshotPath_ : FilePath(),
192 browser_, bridge_->AsWeakPtr()); 189 browser_, bridge_->AsWeakPtr());
193 } else { 190 } else {
194 NOTREACHED(); 191 NOTREACHED();
195 } 192 }
196 193
197 // Update the bubble's contents to show the "Sending..." progress animation. 194 // Update the bubble's contents to show the "Sending..." progress animation.
198 [cancel_ setEnabled:NO]; 195 [cancel_ setEnabled:NO];
199 [send_ setEnabled:NO]; 196 [send_ setEnabled:NO];
200 [send_ setAlignment:NSNaturalTextAlignment]; 197 [send_ setAlignment:NSNaturalTextAlignment];
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 284
288 - (void)setSendCopy:(bool)sendCopy { 285 - (void)setSendCopy:(bool)sendCopy {
289 [sendCopy_ setState:(sendCopy ? NSOnState : NSOffState)]; 286 [sendCopy_ setState:(sendCopy ? NSOnState : NSOffState)];
290 } 287 }
291 288
292 - (ChromeToMobileBubbleNotificationBridge*)bridge { 289 - (ChromeToMobileBubbleNotificationBridge*)bridge {
293 return bridge_.get(); 290 return bridge_.get();
294 } 291 }
295 292
296 @end // ChromeToMobileBubbleController (JustForTesting) 293 @end // ChromeToMobileBubbleController (JustForTesting)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698