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

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

Issue 10861038: Revert 152609 - Integrate invalidation API into ChromeToMobileService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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
168 [super showWindow:sender]; 171 [super showWindow:sender];
169 } 172 }
170 173
171 - (IBAction)learn:(id)sender { 174 - (IBAction)learn:(id)sender {
172 service_->LearnMore(browser_); 175 service_->LearnMore(browser_);
173 [self close]; 176 [self close];
174 } 177 }
175 178
176 - (IBAction)send:(id)sender { 179 - (IBAction)send:(id)sender {
177 // 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.
178 const ListValue* mobiles = service_->GetMobiles(); 181 const ListValue* mobiles = service_->GetMobiles();
179 // |mobileRadioGroup_| has a single row by defualt, so these always match. 182 // |mobileRadioGroup_| has a single row by defualt, so these always match.
180 DCHECK_EQ(static_cast<NSInteger>(mobiles->GetSize()), 183 DCHECK_EQ(static_cast<NSInteger>(mobiles->GetSize()),
181 [mobileRadioGroup_ numberOfRows]); 184 [mobileRadioGroup_ numberOfRows]);
182 // 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).
183 const int selected_index = std::max<int>([mobileRadioGroup_ selectedRow], 0); 186 const int selected_index = std::max<int>([mobileRadioGroup_ selectedRow], 0);
184 187
185 const DictionaryValue* mobile = NULL; 188 const DictionaryValue* mobile = NULL;
186 if (mobiles->GetDictionary(selected_index, &mobile)) { 189 if (mobiles->GetDictionary(selected_index, &mobile)) {
187 service_->SendToMobile(mobile, 190 service_->SendToMobile(*mobile,
188 ([sendCopy_ state] == NSOnState) ? snapshotPath_ : FilePath(), 191 ([sendCopy_ state] == NSOnState) ? snapshotPath_ : FilePath(),
189 browser_, bridge_->AsWeakPtr()); 192 browser_, bridge_->AsWeakPtr());
190 } else { 193 } else {
191 NOTREACHED(); 194 NOTREACHED();
192 } 195 }
193 196
194 // Update the bubble's contents to show the "Sending..." progress animation. 197 // Update the bubble's contents to show the "Sending..." progress animation.
195 [cancel_ setEnabled:NO]; 198 [cancel_ setEnabled:NO];
196 [send_ setEnabled:NO]; 199 [send_ setEnabled:NO];
197 [send_ setAlignment:NSNaturalTextAlignment]; 200 [send_ setAlignment:NSNaturalTextAlignment];
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 287
285 - (void)setSendCopy:(bool)sendCopy { 288 - (void)setSendCopy:(bool)sendCopy {
286 [sendCopy_ setState:(sendCopy ? NSOnState : NSOffState)]; 289 [sendCopy_ setState:(sendCopy ? NSOnState : NSOffState)];
287 } 290 }
288 291
289 - (ChromeToMobileBubbleNotificationBridge*)bridge { 292 - (ChromeToMobileBubbleNotificationBridge*)bridge {
290 return bridge_.get(); 293 return bridge_.get();
291 } 294 }
292 295
293 @end // ChromeToMobileBubbleController (JustForTesting) 296 @end // ChromeToMobileBubbleController (JustForTesting)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698