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

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

Issue 10834203: Integrate invalidation API into ChromeToMobileService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase, add RegisterForDeviceListInvalidations util function. 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 #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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 Browser* browser) 326 Browser* browser)
327 : BubbleDelegateView(anchor_view, views::BubbleBorder::TOP_RIGHT), 327 : BubbleDelegateView(anchor_view, views::BubbleBorder::TOP_RIGHT),
328 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)), 328 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)),
329 browser_(browser), 329 browser_(browser),
330 service_(ChromeToMobileServiceFactory::GetForProfile(browser->profile())), 330 service_(ChromeToMobileServiceFactory::GetForProfile(browser->profile())),
331 send_copy_(NULL), 331 send_copy_(NULL),
332 send_(NULL), 332 send_(NULL),
333 cancel_(NULL) { 333 cancel_(NULL) {
334 // Generate the MHTML snapshot now to report its size in the bubble. 334 // Generate the MHTML snapshot now to report its size in the bubble.
335 service_->GenerateSnapshot(browser_, weak_ptr_factory_.GetWeakPtr()); 335 service_->GenerateSnapshot(browser_, weak_ptr_factory_.GetWeakPtr());
336
337 // Request a mobile device list update.
338 service_->RequestMobileListUpdate();
339 } 336 }
340 337
341 void ChromeToMobileBubbleView::LinkClicked(views::Link* source, 338 void ChromeToMobileBubbleView::LinkClicked(views::Link* source,
342 int event_flags) { 339 int event_flags) {
343 service_->LearnMore(browser_); 340 service_->LearnMore(browser_);
344 GetWidget()->Close(); 341 GetWidget()->Close();
345 } 342 }
346 343
347 void ChromeToMobileBubbleView::HandleButtonPressed(views::Button* sender) { 344 void ChromeToMobileBubbleView::HandleButtonPressed(views::Button* sender) {
348 if (sender == send_) 345 if (sender == send_)
(...skipping 12 matching lines...) Expand all
361 if (radio_buttons_[selected_index]->checked()) 358 if (radio_buttons_[selected_index]->checked())
362 break; 359 break;
363 } 360 }
364 } else { 361 } else {
365 DCHECK(radio_buttons_.empty()); 362 DCHECK(radio_buttons_.empty());
366 } 363 }
367 364
368 const DictionaryValue* mobile = NULL; 365 const DictionaryValue* mobile = NULL;
369 if (mobiles->GetDictionary(selected_index, &mobile)) { 366 if (mobiles->GetDictionary(selected_index, &mobile)) {
370 FilePath snapshot = send_copy_->checked() ? snapshot_path_ : FilePath(); 367 FilePath snapshot = send_copy_->checked() ? snapshot_path_ : FilePath();
371 service_->SendToMobile(*mobile, snapshot, browser_, 368 service_->SendToMobile(mobile, snapshot, browser_,
372 weak_ptr_factory_.GetWeakPtr()); 369 weak_ptr_factory_.GetWeakPtr());
373 } else { 370 } else {
374 NOTREACHED(); 371 NOTREACHED();
375 } 372 }
376 373
377 // Update the view's contents to show the "Sending..." progress animation. 374 // Update the view's contents to show the "Sending..." progress animation.
378 cancel_->SetEnabled(false); 375 cancel_->SetEnabled(false);
379 send_->SetEnabled(false); 376 send_->SetEnabled(false);
380 send_->set_alignment(views::TextButtonBase::ALIGN_LEFT); 377 send_->set_alignment(views::TextButtonBase::ALIGN_LEFT);
381 progress_animation_.reset(new ui::ThrobAnimation(this)); 378 progress_animation_.reset(new ui::ThrobAnimation(this));
382 progress_animation_->SetDuration(kProgressThrobDurationMS); 379 progress_animation_->SetDuration(kProgressThrobDurationMS);
383 progress_animation_->StartThrobbing(-1); 380 progress_animation_->StartThrobbing(-1);
384 } 381 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698