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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 | 78 |
79 // static | 79 // static |
80 void ChromeToMobileBubbleView::ShowBubble(views::View* anchor_view, | 80 void ChromeToMobileBubbleView::ShowBubble(views::View* anchor_view, |
81 Browser* browser) { | 81 Browser* browser) { |
82 if (IsShowing()) | 82 if (IsShowing()) |
83 return; | 83 return; |
84 | 84 |
85 // Show the lit mobile device icon during the bubble's lifetime. | 85 // Show the lit mobile device icon during the bubble's lifetime. |
86 SetTextButtonIconToId(anchor_view, IDR_MOBILE_LIT); | 86 SetTextButtonIconToId(anchor_view, IDR_MOBILE_LIT); |
87 bubble_ = new ChromeToMobileBubbleView(anchor_view, browser); | 87 bubble_ = new ChromeToMobileBubbleView(anchor_view, browser); |
88 views::BubbleDelegateView::CreateBubble(bubble_); | 88 views::BubbleDelegateView::CreateBubble(bubble_)->Show(); |
89 bubble_->Show(); | |
90 } | 89 } |
91 | 90 |
92 // static | 91 // static |
93 bool ChromeToMobileBubbleView::IsShowing() { | 92 bool ChromeToMobileBubbleView::IsShowing() { |
94 return bubble_ != NULL; | 93 return bubble_ != NULL; |
95 } | 94 } |
96 | 95 |
97 void ChromeToMobileBubbleView::Hide() { | 96 void ChromeToMobileBubbleView::Hide() { |
98 if (IsShowing()) | 97 if (IsShowing()) |
99 bubble_->GetWidget()->Close(); | 98 bubble_->GetWidget()->Close(); |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 } | 344 } |
346 | 345 |
347 // Update the view's contents to show the "Sending..." progress animation. | 346 // Update the view's contents to show the "Sending..." progress animation. |
348 cancel_->SetEnabled(false); | 347 cancel_->SetEnabled(false); |
349 send_->SetEnabled(false); | 348 send_->SetEnabled(false); |
350 send_->set_alignment(views::TextButtonBase::ALIGN_LEFT); | 349 send_->set_alignment(views::TextButtonBase::ALIGN_LEFT); |
351 progress_animation_.reset(new ui::ThrobAnimation(this)); | 350 progress_animation_.reset(new ui::ThrobAnimation(this)); |
352 progress_animation_->SetDuration(kProgressThrobDurationMS); | 351 progress_animation_->SetDuration(kProgressThrobDurationMS); |
353 progress_animation_->StartThrobbing(-1); | 352 progress_animation_->StartThrobbing(-1); |
354 } | 353 } |
OLD | NEW |