OLD | NEW |
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 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 browser_(browser), | 322 browser_(browser), |
323 service_(ChromeToMobileServiceFactory::GetForProfile(browser->profile())), | 323 service_(ChromeToMobileServiceFactory::GetForProfile(browser->profile())), |
324 send_copy_(NULL), | 324 send_copy_(NULL), |
325 send_(NULL), | 325 send_(NULL), |
326 cancel_(NULL) { | 326 cancel_(NULL) { |
327 // Compensate for built-in vertical padding in the anchor view's image. | 327 // Compensate for built-in vertical padding in the anchor view's image. |
328 set_anchor_insets(gfx::Insets(5, 0, 5, 0)); | 328 set_anchor_insets(gfx::Insets(5, 0, 5, 0)); |
329 | 329 |
330 // Generate the MHTML snapshot now to report its size in the bubble. | 330 // Generate the MHTML snapshot now to report its size in the bubble. |
331 service_->GenerateSnapshot(browser_, weak_ptr_factory_.GetWeakPtr()); | 331 service_->GenerateSnapshot(browser_, weak_ptr_factory_.GetWeakPtr()); |
| 332 |
| 333 // Request a mobile device list update. |
| 334 service_->RequestMobileListUpdate(); |
332 } | 335 } |
333 | 336 |
334 void ChromeToMobileBubbleView::LinkClicked(views::Link* source, | 337 void ChromeToMobileBubbleView::LinkClicked(views::Link* source, |
335 int event_flags) { | 338 int event_flags) { |
336 service_->LearnMore(browser_); | 339 service_->LearnMore(browser_); |
337 GetWidget()->Close(); | 340 GetWidget()->Close(); |
338 } | 341 } |
339 | 342 |
340 void ChromeToMobileBubbleView::HandleButtonPressed(views::Button* sender) { | 343 void ChromeToMobileBubbleView::HandleButtonPressed(views::Button* sender) { |
341 if (sender == send_) | 344 if (sender == send_) |
(...skipping 12 matching lines...) Expand all Loading... |
354 if (radio_buttons_[selected_index]->checked()) | 357 if (radio_buttons_[selected_index]->checked()) |
355 break; | 358 break; |
356 } | 359 } |
357 } else { | 360 } else { |
358 DCHECK(radio_buttons_.empty()); | 361 DCHECK(radio_buttons_.empty()); |
359 } | 362 } |
360 | 363 |
361 const DictionaryValue* mobile = NULL; | 364 const DictionaryValue* mobile = NULL; |
362 if (mobiles->GetDictionary(selected_index, &mobile)) { | 365 if (mobiles->GetDictionary(selected_index, &mobile)) { |
363 FilePath snapshot = send_copy_->checked() ? snapshot_path_ : FilePath(); | 366 FilePath snapshot = send_copy_->checked() ? snapshot_path_ : FilePath(); |
364 service_->SendToMobile(mobile, snapshot, browser_, | 367 service_->SendToMobile(*mobile, snapshot, browser_, |
365 weak_ptr_factory_.GetWeakPtr()); | 368 weak_ptr_factory_.GetWeakPtr()); |
366 } else { | 369 } else { |
367 NOTREACHED(); | 370 NOTREACHED(); |
368 } | 371 } |
369 | 372 |
370 // Update the view's contents to show the "Sending..." progress animation. | 373 // Update the view's contents to show the "Sending..." progress animation. |
371 cancel_->SetEnabled(false); | 374 cancel_->SetEnabled(false); |
372 send_->SetEnabled(false); | 375 send_->SetEnabled(false); |
373 send_->set_alignment(views::TextButtonBase::ALIGN_LEFT); | 376 send_->set_alignment(views::TextButtonBase::ALIGN_LEFT); |
374 progress_animation_.reset(new ui::ThrobAnimation(this)); | 377 progress_animation_.reset(new ui::ThrobAnimation(this)); |
375 progress_animation_->SetDuration(kProgressThrobDurationMS); | 378 progress_animation_->SetDuration(kProgressThrobDurationMS); |
376 progress_animation_->StartThrobbing(-1); | 379 progress_animation_->StartThrobbing(-1); |
377 } | 380 } |
OLD | NEW |