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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 } | 164 } |
165 Layout(); | 165 Layout(); |
166 } | 166 } |
167 | 167 |
168 void ChromeToMobileBubbleView::OnSendComplete(bool success) { | 168 void ChromeToMobileBubbleView::OnSendComplete(bool success) { |
169 progress_animation_->Stop(); | 169 progress_animation_->Stop(); |
170 send_->SetHorizontalAlignment(gfx::ALIGN_CENTER); | 170 send_->SetHorizontalAlignment(gfx::ALIGN_CENTER); |
171 | 171 |
172 if (success) { | 172 if (success) { |
173 send_->SetText(l10n_util::GetStringUTF16(IDS_CHROME_TO_MOBILE_BUBBLE_SENT)); | 173 send_->SetText(l10n_util::GetStringUTF16(IDS_CHROME_TO_MOBILE_BUBBLE_SENT)); |
174 MessageLoop::current()->PostDelayedTask(FROM_HERE, | 174 base::MessageLoop::current()->PostDelayedTask( |
| 175 FROM_HERE, |
175 base::Bind(&ChromeToMobileBubbleView::Hide), | 176 base::Bind(&ChromeToMobileBubbleView::Hide), |
176 base::TimeDelta::FromSeconds(kAutoCloseDelay)); | 177 base::TimeDelta::FromSeconds(kAutoCloseDelay)); |
177 } else { | 178 } else { |
178 send_->SetText( | 179 send_->SetText( |
179 l10n_util::GetStringUTF16(IDS_CHROME_TO_MOBILE_BUBBLE_ERROR)); | 180 l10n_util::GetStringUTF16(IDS_CHROME_TO_MOBILE_BUBBLE_ERROR)); |
180 views::Label* error_label = new views::Label( | 181 views::Label* error_label = new views::Label( |
181 l10n_util::GetStringUTF16(IDS_CHROME_TO_MOBILE_BUBBLE_ERROR_MESSAGE)); | 182 l10n_util::GetStringUTF16(IDS_CHROME_TO_MOBILE_BUBBLE_ERROR_MESSAGE)); |
182 error_label->SetEnabledColor(SK_ColorRED); | 183 error_label->SetEnabledColor(SK_ColorRED); |
183 GridLayout* layout = static_cast<GridLayout*>(GetLayoutManager()); | 184 GridLayout* layout = static_cast<GridLayout*>(GetLayoutManager()); |
184 layout->AddPaddingRow(0, views::kRelatedControlSmallVerticalSpacing); | 185 layout->AddPaddingRow(0, views::kRelatedControlSmallVerticalSpacing); |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 } | 347 } |
347 | 348 |
348 // Update the view's contents to show the "Sending..." progress animation. | 349 // Update the view's contents to show the "Sending..." progress animation. |
349 cancel_->SetEnabled(false); | 350 cancel_->SetEnabled(false); |
350 send_->SetEnabled(false); | 351 send_->SetEnabled(false); |
351 send_->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 352 send_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
352 progress_animation_.reset(new ui::ThrobAnimation(this)); | 353 progress_animation_.reset(new ui::ThrobAnimation(this)); |
353 progress_animation_->SetDuration(kProgressThrobDurationMS); | 354 progress_animation_->SetDuration(kProgressThrobDurationMS); |
354 progress_animation_->StartThrobbing(-1); | 355 progress_animation_->StartThrobbing(-1); |
355 } | 356 } |
OLD | NEW |