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(); | |
335 } | 332 } |
336 | 333 |
337 void ChromeToMobileBubbleView::LinkClicked(views::Link* source, | 334 void ChromeToMobileBubbleView::LinkClicked(views::Link* source, |
338 int event_flags) { | 335 int event_flags) { |
339 service_->LearnMore(browser_); | 336 service_->LearnMore(browser_); |
340 GetWidget()->Close(); | 337 GetWidget()->Close(); |
341 } | 338 } |
342 | 339 |
343 void ChromeToMobileBubbleView::HandleButtonPressed(views::Button* sender) { | 340 void ChromeToMobileBubbleView::HandleButtonPressed(views::Button* sender) { |
344 if (sender == send_) | 341 if (sender == send_) |
(...skipping 12 matching lines...) Expand all Loading... |
357 if (radio_buttons_[selected_index]->checked()) | 354 if (radio_buttons_[selected_index]->checked()) |
358 break; | 355 break; |
359 } | 356 } |
360 } else { | 357 } else { |
361 DCHECK(radio_buttons_.empty()); | 358 DCHECK(radio_buttons_.empty()); |
362 } | 359 } |
363 | 360 |
364 const DictionaryValue* mobile = NULL; | 361 const DictionaryValue* mobile = NULL; |
365 if (mobiles->GetDictionary(selected_index, &mobile)) { | 362 if (mobiles->GetDictionary(selected_index, &mobile)) { |
366 FilePath snapshot = send_copy_->checked() ? snapshot_path_ : FilePath(); | 363 FilePath snapshot = send_copy_->checked() ? snapshot_path_ : FilePath(); |
367 service_->SendToMobile(*mobile, snapshot, browser_, | 364 service_->SendToMobile(mobile, snapshot, browser_, |
368 weak_ptr_factory_.GetWeakPtr()); | 365 weak_ptr_factory_.GetWeakPtr()); |
369 } else { | 366 } else { |
370 NOTREACHED(); | 367 NOTREACHED(); |
371 } | 368 } |
372 | 369 |
373 // Update the view's contents to show the "Sending..." progress animation. | 370 // Update the view's contents to show the "Sending..." progress animation. |
374 cancel_->SetEnabled(false); | 371 cancel_->SetEnabled(false); |
375 send_->SetEnabled(false); | 372 send_->SetEnabled(false); |
376 send_->set_alignment(views::TextButtonBase::ALIGN_LEFT); | 373 send_->set_alignment(views::TextButtonBase::ALIGN_LEFT); |
377 progress_animation_.reset(new ui::ThrobAnimation(this)); | 374 progress_animation_.reset(new ui::ThrobAnimation(this)); |
378 progress_animation_->SetDuration(kProgressThrobDurationMS); | 375 progress_animation_->SetDuration(kProgressThrobDurationMS); |
379 progress_animation_->StartThrobbing(-1); | 376 progress_animation_->StartThrobbing(-1); |
380 } | 377 } |
OLD | NEW |