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/string16.h" | 10 #include "base/string16.h" |
10 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
11 #include "base/values.h" | 12 #include "base/values.h" |
12 #include "chrome/app/chrome_command_ids.h" | 13 #include "chrome/app/chrome_command_ids.h" |
13 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
14 #include "chrome/browser/chrome_to_mobile_service.h" | 15 #include "chrome/browser/chrome_to_mobile_service.h" |
15 #include "chrome/browser/chrome_to_mobile_service_factory.h" | 16 #include "chrome/browser/chrome_to_mobile_service_factory.h" |
16 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
17 #include "chrome/browser/ui/views/window.h" | 18 #include "chrome/browser/ui/views/window.h" |
18 #include "grit/generated_resources.h" | 19 #include "grit/generated_resources.h" |
19 #include "grit/theme_resources.h" | 20 #include "grit/theme_resources.h" |
20 #include "ui/base/animation/throb_animation.h" | 21 #include "ui/base/animation/throb_animation.h" |
21 #include "ui/base/keycodes/keyboard_codes.h" | 22 #include "ui/base/keycodes/keyboard_codes.h" |
22 #include "ui/base/l10n/l10n_util.h" | 23 #include "ui/base/l10n/l10n_util.h" |
23 #include "ui/base/resource/resource_bundle.h" | 24 #include "ui/base/resource/resource_bundle.h" |
24 #include "ui/base/text/bytes_formatting.h" | 25 #include "ui/base/text/bytes_formatting.h" |
25 #include "ui/views/controls/button/checkbox.h" | 26 #include "ui/views/controls/button/checkbox.h" |
26 #include "ui/views/controls/button/radio_button.h" | 27 #include "ui/views/controls/button/radio_button.h" |
27 #include "ui/views/controls/button/text_button.h" | 28 #include "ui/views/controls/button/text_button.h" |
28 #include "ui/views/controls/label.h" | 29 #include "ui/views/controls/label.h" |
29 #include "ui/views/events/event.h" | 30 #include "ui/views/events/event.h" |
30 #include "ui/views/layout/grid_layout.h" | 31 #include "ui/views/layout/grid_layout.h" |
31 #include "ui/views/layout/layout_constants.h" | 32 #include "ui/views/layout/layout_constants.h" |
32 | 33 |
33 using views::GridLayout; | 34 using views::GridLayout; |
34 | 35 |
35 namespace { | 36 namespace { |
36 | 37 |
| 38 // The title label's color; matches the bookmark bubble's title. |
| 39 const SkColor kTitleColor = 0xFF062D75; |
| 40 |
37 // The millisecond duration of the "Sending..." progress throb animation. | 41 // The millisecond duration of the "Sending..." progress throb animation. |
38 const size_t kProgressThrobDurationMS = 2400; | 42 const size_t kProgressThrobDurationMS = 2400; |
39 | 43 |
40 // The bubble's margin for the "Sending..." and "Sent" states. | 44 // The seconds to delay before automatically closing the bubble after sending. |
41 const size_t kProgressMargin = 20; | 45 const int kAutoCloseDelay = 3; |
42 | 46 |
43 // The title label's color; matches the bookmark bubble's title. | 47 // A custom TextButtonNativeThemeBorder with no left or right insets. |
44 const SkColor kTitleColor = 0xFF062D75; | 48 class CheckboxNativeThemeBorder : public views::TextButtonNativeThemeBorder { |
| 49 public: |
| 50 explicit CheckboxNativeThemeBorder(views::NativeThemeDelegate* delegate); |
| 51 virtual ~CheckboxNativeThemeBorder(); |
| 52 |
| 53 // views::TextButtonNativeThemeBorder methods. |
| 54 virtual void GetInsets(gfx::Insets* insets) const OVERRIDE; |
| 55 |
| 56 private: |
| 57 DISALLOW_COPY_AND_ASSIGN(CheckboxNativeThemeBorder); |
| 58 }; |
| 59 |
| 60 CheckboxNativeThemeBorder::CheckboxNativeThemeBorder( |
| 61 views::NativeThemeDelegate* delegate) |
| 62 : views::TextButtonNativeThemeBorder(delegate) {} |
| 63 |
| 64 CheckboxNativeThemeBorder::~CheckboxNativeThemeBorder() {} |
| 65 |
| 66 void CheckboxNativeThemeBorder::GetInsets(gfx::Insets* insets) const { |
| 67 views::TextButtonNativeThemeBorder::GetInsets(insets); |
| 68 insets->Set(insets->top(), 0, insets->bottom(), 0); |
| 69 } |
45 | 70 |
46 } // namespace | 71 } // namespace |
47 | 72 |
48 // Declared in browser_dialogs.h so callers don't have to depend on our header. | 73 // Declared in browser_dialogs.h so callers don't have to depend on our header. |
49 | 74 |
50 namespace browser { | 75 namespace browser { |
51 | 76 |
52 void ShowChromeToMobileBubbleView(views::View* anchor_view, Profile* profile) { | 77 void ShowChromeToMobileBubbleView(views::View* anchor_view, Profile* profile) { |
53 ChromeToMobileBubbleView::ShowBubble(anchor_view, profile); | 78 ChromeToMobileBubbleView::ShowBubble(anchor_view, profile); |
54 } | 79 } |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 if (animation == progress_animation_.get()) { | 148 if (animation == progress_animation_.get()) { |
124 double animation_value = animation->GetCurrentValue(); | 149 double animation_value = animation->GetCurrentValue(); |
125 int message = IDS_CHROME_TO_MOBILE_BUBBLE_SENDING_3; | 150 int message = IDS_CHROME_TO_MOBILE_BUBBLE_SENDING_3; |
126 // Show each of four messages for 1/4 of the animation. | 151 // Show each of four messages for 1/4 of the animation. |
127 if (animation_value < 0.25) | 152 if (animation_value < 0.25) |
128 message = IDS_CHROME_TO_MOBILE_BUBBLE_SENDING_0; | 153 message = IDS_CHROME_TO_MOBILE_BUBBLE_SENDING_0; |
129 else if (animation_value < 0.5) | 154 else if (animation_value < 0.5) |
130 message = IDS_CHROME_TO_MOBILE_BUBBLE_SENDING_1; | 155 message = IDS_CHROME_TO_MOBILE_BUBBLE_SENDING_1; |
131 else if (animation_value < 0.75) | 156 else if (animation_value < 0.75) |
132 message = IDS_CHROME_TO_MOBILE_BUBBLE_SENDING_2; | 157 message = IDS_CHROME_TO_MOBILE_BUBBLE_SENDING_2; |
133 progress_label_->SetText(l10n_util::GetStringUTF16(message)); | 158 send_->SetText(l10n_util::GetStringUTF16(message)); |
134 // Run Layout but do not resize the bubble for each progress message. | 159 // Run Layout but do not resize the bubble for each progress message. |
135 Layout(); | 160 Layout(); |
136 return; | 161 return; |
137 } | 162 } |
138 views::BubbleDelegateView::AnimationProgressed(animation); | 163 views::BubbleDelegateView::AnimationProgressed(animation); |
139 } | 164 } |
140 | 165 |
141 void ChromeToMobileBubbleView::ButtonPressed(views::Button* sender, | 166 void ChromeToMobileBubbleView::ButtonPressed(views::Button* sender, |
142 const views::Event& event) { | 167 const views::Event& event) { |
143 HandleButtonPressed(sender); | 168 HandleButtonPressed(sender); |
144 } | 169 } |
145 | 170 |
146 void ChromeToMobileBubbleView::SnapshotGenerated(const FilePath& path, | 171 void ChromeToMobileBubbleView::SnapshotGenerated(const FilePath& path, |
147 int64 bytes) { | 172 int64 bytes) { |
148 if (bytes > 0) { | 173 if (bytes > 0) { |
149 snapshot_path_ = path; | 174 snapshot_path_ = path; |
150 send_copy_->SetText(l10n_util::GetStringFUTF16( | 175 send_copy_->SetText(l10n_util::GetStringFUTF16( |
151 IDS_CHROME_TO_MOBILE_BUBBLE_SEND_COPY, ui::FormatBytes(bytes))); | 176 IDS_CHROME_TO_MOBILE_BUBBLE_SEND_COPY, ui::FormatBytes(bytes))); |
152 send_copy_->SetEnabled(true); | 177 send_copy_->SetEnabled(true); |
153 } else { | 178 } else { |
154 send_copy_->SetText(l10n_util::GetStringUTF16( | 179 send_copy_->SetText(l10n_util::GetStringUTF16( |
155 IDS_CHROME_TO_MOBILE_BUBBLE_SEND_COPY_FAILED)); | 180 IDS_CHROME_TO_MOBILE_BUBBLE_SEND_COPY_FAILED)); |
156 } | 181 } |
157 Layout(); | 182 Layout(); |
158 } | 183 } |
159 | 184 |
160 void ChromeToMobileBubbleView::OnSendComplete(bool success) { | 185 void ChromeToMobileBubbleView::OnSendComplete(bool success) { |
161 progress_animation_->Stop(); | 186 progress_animation_->Stop(); |
162 progress_label_->SetText(l10n_util::GetStringUTF16(success ? | 187 send_->set_alignment(views::TextButtonBase::ALIGN_CENTER); |
163 IDS_CHROME_TO_MOBILE_BUBBLE_SENT : IDS_CHROME_TO_MOBILE_BUBBLE_ERROR)); | 188 |
164 SizeToContents(); | 189 if (success) { |
| 190 send_->SetText(l10n_util::GetStringUTF16(IDS_CHROME_TO_MOBILE_BUBBLE_SENT)); |
| 191 MessageLoop::current()->PostDelayedTask(FROM_HERE, |
| 192 base::Bind(&ChromeToMobileBubbleView::Hide), |
| 193 base::TimeDelta::FromSeconds(kAutoCloseDelay)); |
| 194 } else { |
| 195 send_->SetText( |
| 196 l10n_util::GetStringUTF16(IDS_CHROME_TO_MOBILE_BUBBLE_ERROR)); |
| 197 views::Label* error_label = new views::Label( |
| 198 l10n_util::GetStringUTF16(IDS_CHROME_TO_MOBILE_BUBBLE_ERROR_MESSAGE)); |
| 199 error_label->SetEnabledColor(SK_ColorRED); |
| 200 GridLayout* layout = static_cast<GridLayout*>(GetLayoutManager()); |
| 201 layout->AddPaddingRow(0, views::kRelatedControlSmallVerticalSpacing); |
| 202 layout->StartRow(0, 0 /*single_column_set_id*/); |
| 203 layout->AddView(error_label); |
| 204 SizeToContents(); |
| 205 } |
| 206 |
| 207 Layout(); |
165 } | 208 } |
166 | 209 |
167 void ChromeToMobileBubbleView::Init() { | 210 void ChromeToMobileBubbleView::Init() { |
168 GridLayout* layout = new GridLayout(this); | 211 GridLayout* layout = new GridLayout(this); |
169 SetLayoutManager(layout); | 212 SetLayoutManager(layout); |
170 | 213 |
171 const size_t single_column_set_id = 0; | 214 const size_t single_column_set_id = 0; |
172 views::ColumnSet* cs = layout->AddColumnSet(single_column_set_id); | 215 views::ColumnSet* cs = layout->AddColumnSet(single_column_set_id); |
173 cs->AddColumn(GridLayout::LEADING, GridLayout::LEADING, 0, | 216 cs->AddColumn(GridLayout::LEADING, GridLayout::LEADING, 0, |
174 GridLayout::USE_PREF, 0, 0); | 217 GridLayout::USE_PREF, 0, 0); |
175 cs->AddPaddingColumn(1, 0); | 218 cs->AddPaddingColumn(1, 0); |
176 | 219 |
177 const size_t button_column_set_id = 1; | 220 const size_t button_column_set_id = 1; |
178 cs = layout->AddColumnSet(button_column_set_id); | 221 cs = layout->AddColumnSet(button_column_set_id); |
179 cs->AddPaddingColumn(1, 0); | 222 cs->AddPaddingColumn(1, 0); |
180 cs->AddColumn(GridLayout::LEADING, GridLayout::TRAILING, 0, | 223 cs->AddColumn(GridLayout::LEADING, GridLayout::TRAILING, 0, |
181 GridLayout::USE_PREF, 0, 0); | 224 GridLayout::USE_PREF, 0, 0); |
182 // Subtract 2px for the natural button padding and to correspond with row | 225 // Subtract 2px for the natural button padding and to correspond with row |
183 // separation height; like BookmarkBubbleView. | 226 // separation height; like BookmarkBubbleView. |
184 cs->AddPaddingColumn(0, views::kRelatedButtonHSpacing - 2); | 227 cs->AddPaddingColumn(0, views::kRelatedButtonHSpacing - 2); |
185 cs->AddColumn(GridLayout::LEADING, GridLayout::TRAILING, 0, | 228 cs->AddColumn(GridLayout::LEADING, GridLayout::TRAILING, 0, |
186 GridLayout::USE_PREF, 0, 0); | 229 GridLayout::USE_PREF, 0, 0); |
187 | 230 |
188 std::vector<DictionaryValue*> mobiles = | 231 std::vector<DictionaryValue*> mobiles = |
189 ChromeToMobileServiceFactory::GetForProfile(profile_)->mobiles(); | 232 ChromeToMobileServiceFactory::GetForProfile(profile_)->mobiles(); |
190 DCHECK_GT(mobiles.size(), 0U); | 233 DCHECK_GT(mobiles.size(), 0U); |
191 | 234 |
192 layout->StartRow(0, single_column_set_id); | |
193 views::Label* title_label = new views::Label(); | 235 views::Label* title_label = new views::Label(); |
194 title_label->SetFont( | 236 title_label->SetFont( |
195 ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::MediumFont)); | 237 ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::MediumFont)); |
196 title_label->SetEnabledColor(kTitleColor); | 238 title_label->SetEnabledColor(kTitleColor); |
| 239 layout->StartRow(0, single_column_set_id); |
197 layout->AddView(title_label); | 240 layout->AddView(title_label); |
198 | 241 |
199 if (mobiles.size() == 1) { | 242 if (mobiles.size() == 1) { |
200 selected_mobile_ = mobiles[0]; | 243 selected_mobile_ = mobiles[0]; |
201 string16 mobile_name; | 244 string16 mobile_name; |
202 mobiles[0]->GetString("name", &mobile_name); | 245 mobiles[0]->GetString("name", &mobile_name); |
203 title_label->SetText(l10n_util::GetStringFUTF16( | 246 title_label->SetText(l10n_util::GetStringFUTF16( |
204 IDS_CHROME_TO_MOBILE_BUBBLE_SINGLE_TITLE, mobile_name)); | 247 IDS_CHROME_TO_MOBILE_BUBBLE_SINGLE_TITLE, mobile_name)); |
205 } else { | 248 } else { |
206 title_label->SetText(l10n_util::GetStringUTF16( | 249 title_label->SetText(l10n_util::GetStringUTF16( |
207 IDS_CHROME_TO_MOBILE_BUBBLE_MULTI_TITLE)); | 250 IDS_CHROME_TO_MOBILE_BUBBLE_MULTI_TITLE)); |
208 | 251 |
209 const size_t radio_column_set_id = 2; | 252 views::RadioButton* radio = NULL; |
210 cs = layout->AddColumnSet(radio_column_set_id); | |
211 cs->AddPaddingColumn(0, views::kRelatedControlHorizontalSpacing); | |
212 cs->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0, | |
213 GridLayout::USE_PREF, 0, 0); | |
214 | |
215 views::RadioButton* radio; | |
216 layout->AddPaddingRow(0, views::kRelatedControlSmallVerticalSpacing); | 253 layout->AddPaddingRow(0, views::kRelatedControlSmallVerticalSpacing); |
217 for (std::vector<DictionaryValue*>::const_iterator it = mobiles.begin(); | 254 for (std::vector<DictionaryValue*>::const_iterator it = mobiles.begin(); |
218 it != mobiles.end(); ++it) { | 255 it != mobiles.end(); ++it) { |
219 string16 name; | 256 string16 name; |
220 (*it)->GetString("name", &name); | 257 (*it)->GetString("name", &name); |
221 radio = new views::RadioButton(name, 0); | 258 radio = new views::RadioButton(name, 0); |
222 radio->set_listener(this); | 259 radio->set_listener(this); |
| 260 radio->SetEnabledColor(SK_ColorBLACK); |
223 mobile_map_[radio] = *it; | 261 mobile_map_[radio] = *it; |
224 layout->StartRow(0, radio_column_set_id); | 262 layout->StartRow(0, single_column_set_id); |
225 layout->AddView(radio); | 263 layout->AddView(radio); |
226 } | 264 } |
227 mobile_map_.begin()->first->SetChecked(true); | 265 mobile_map_.begin()->first->SetChecked(true); |
228 selected_mobile_ = mobile_map_.begin()->second; | 266 selected_mobile_ = mobile_map_.begin()->second; |
229 } | 267 } |
230 | 268 |
231 send_copy_ = new views::Checkbox( | 269 send_copy_ = new views::Checkbox( |
232 l10n_util::GetStringFUTF16(IDS_CHROME_TO_MOBILE_BUBBLE_SEND_COPY, | 270 l10n_util::GetStringFUTF16(IDS_CHROME_TO_MOBILE_BUBBLE_SEND_COPY, |
233 l10n_util::GetStringUTF16( | 271 l10n_util::GetStringUTF16( |
234 IDS_CHROME_TO_MOBILE_BUBBLE_SEND_COPY_GENERATING))); | 272 IDS_CHROME_TO_MOBILE_BUBBLE_SEND_COPY_GENERATING))); |
| 273 // Use CheckboxNativeThemeBorder to align the checkbox with the title label. |
| 274 send_copy_->set_border(new CheckboxNativeThemeBorder(send_copy_)); |
| 275 send_copy_->SetEnabledColor(SK_ColorBLACK); |
235 send_copy_->SetEnabled(false); | 276 send_copy_->SetEnabled(false); |
236 layout->StartRow(0, single_column_set_id); | 277 layout->StartRow(0, single_column_set_id); |
237 layout->AddView(send_copy_); | 278 layout->AddView(send_copy_); |
238 | 279 |
239 layout->AddPaddingRow(0, views::kRelatedControlSmallVerticalSpacing); | |
240 send_ = new views::NativeTextButton( | 280 send_ = new views::NativeTextButton( |
241 this, l10n_util::GetStringUTF16(IDS_CHROME_TO_MOBILE_BUBBLE_SEND)); | 281 this, l10n_util::GetStringUTF16(IDS_CHROME_TO_MOBILE_BUBBLE_SEND)); |
242 send_->SetIsDefault(true); | 282 send_->SetIsDefault(true); |
243 cancel_ = new views::NativeTextButton( | 283 cancel_ = new views::NativeTextButton( |
244 this, l10n_util::GetStringUTF16(IDS_CANCEL)); | 284 this, l10n_util::GetStringUTF16(IDS_CANCEL)); |
| 285 layout->AddPaddingRow(0, views::kRelatedControlSmallVerticalSpacing); |
245 layout->StartRow(0, button_column_set_id); | 286 layout->StartRow(0, button_column_set_id); |
246 layout->AddView(send_); | 287 layout->AddView(send_); |
247 layout->AddView(cancel_); | 288 layout->AddView(cancel_); |
248 | 289 |
249 AddAccelerator(ui::Accelerator(ui::VKEY_RETURN, 0)); | 290 AddAccelerator(ui::Accelerator(ui::VKEY_RETURN, 0)); |
250 } | 291 } |
251 | 292 |
252 ChromeToMobileBubbleView::ChromeToMobileBubbleView(views::View* anchor_view, | 293 ChromeToMobileBubbleView::ChromeToMobileBubbleView(views::View* anchor_view, |
253 Profile* profile) | 294 Profile* profile) |
254 : BubbleDelegateView(anchor_view, views::BubbleBorder::TOP_RIGHT), | 295 : BubbleDelegateView(anchor_view, views::BubbleBorder::TOP_RIGHT), |
255 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)), | 296 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)), |
256 profile_(profile), | 297 profile_(profile), |
257 selected_mobile_(NULL), | 298 selected_mobile_(NULL), |
258 send_copy_(NULL), | 299 send_copy_(NULL), |
259 send_(NULL), | 300 send_(NULL), |
260 cancel_(NULL), | 301 cancel_(NULL) { |
261 progress_label_(NULL) { | |
262 // Generate the MHTML snapshot now to report its size in the bubble. | 302 // Generate the MHTML snapshot now to report its size in the bubble. |
263 ChromeToMobileServiceFactory::GetForProfile(profile)-> | 303 ChromeToMobileServiceFactory::GetForProfile(profile)-> |
264 GenerateSnapshot(weak_ptr_factory_.GetWeakPtr()); | 304 GenerateSnapshot(weak_ptr_factory_.GetWeakPtr()); |
265 } | 305 } |
266 | 306 |
267 void ChromeToMobileBubbleView::HandleButtonPressed(views::Button* sender) { | 307 void ChromeToMobileBubbleView::HandleButtonPressed(views::Button* sender) { |
268 if (sender == send_) { | 308 if (sender == send_) { |
269 Send(); | 309 Send(); |
270 } else if (sender == cancel_) { | 310 } else if (sender == cancel_) { |
271 GetWidget()->Close(); | 311 GetWidget()->Close(); |
272 } else { | 312 } else { |
273 // The sender is a mobile radio button | 313 // The sender is a mobile radio button |
274 views::RadioButton* radio = static_cast<views::RadioButton*>(sender); | 314 views::RadioButton* radio = static_cast<views::RadioButton*>(sender); |
275 DCHECK(mobile_map_.find(radio) != mobile_map_.end()); | 315 DCHECK(mobile_map_.find(radio) != mobile_map_.end()); |
276 selected_mobile_ = mobile_map_.find(radio)->second; | 316 selected_mobile_ = mobile_map_.find(radio)->second; |
277 } | 317 } |
278 } | 318 } |
279 | 319 |
280 void ChromeToMobileBubbleView::Send() { | 320 void ChromeToMobileBubbleView::Send() { |
281 string16 mobile_id; | 321 string16 mobile_id; |
282 selected_mobile_->GetString("id", &mobile_id); | 322 selected_mobile_->GetString("id", &mobile_id); |
283 ChromeToMobileServiceFactory::GetForProfile(profile_)->SendToMobile( | 323 ChromeToMobileServiceFactory::GetForProfile(profile_)->SendToMobile( |
284 mobile_id, send_copy_->checked() ? snapshot_path_ : FilePath(), | 324 mobile_id, send_copy_->checked() ? snapshot_path_ : FilePath(), |
285 weak_ptr_factory_.GetWeakPtr()); | 325 weak_ptr_factory_.GetWeakPtr()); |
286 | 326 |
287 // Re-initialize the view's contents to show progress sending the page. | 327 // Update the view's contents to show the "Sending..." progress animation. |
288 RemoveAllChildViews(true); | 328 cancel_->SetEnabled(false); |
289 send_copy_ = NULL; | 329 send_->SetEnabled(false); |
290 send_ = NULL; | 330 send_->set_alignment(views::TextButtonBase::ALIGN_LEFT); |
291 cancel_ = NULL; | |
292 | |
293 GridLayout* layout = new GridLayout(this); | |
294 SetLayoutManager(layout); | |
295 | |
296 const size_t single_column_set_id = 0; | |
297 views::ColumnSet* cs = layout->AddColumnSet(single_column_set_id); | |
298 cs->AddColumn(GridLayout::LEADING, GridLayout::LEADING, 0, | |
299 GridLayout::USE_PREF, 0, 0); | |
300 set_margin(kProgressMargin); | |
301 | |
302 // Use the final (longest) progress label string to resize the bubble. | |
303 layout->StartRow(0, single_column_set_id); | |
304 progress_label_ = new views::Label( | |
305 l10n_util::GetStringUTF16(IDS_CHROME_TO_MOBILE_BUBBLE_SENDING_3)); | |
306 progress_label_->SetFont( | |
307 ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::MediumFont)); | |
308 progress_label_->SetEnabledColor(kTitleColor); | |
309 layout->AddView(progress_label_); | |
310 SizeToContents(); | |
311 | |
312 progress_animation_.reset(new ui::ThrobAnimation(this)); | 331 progress_animation_.reset(new ui::ThrobAnimation(this)); |
313 progress_animation_->SetDuration(kProgressThrobDurationMS); | 332 progress_animation_->SetDuration(kProgressThrobDurationMS); |
314 progress_animation_->StartThrobbing(-1); | 333 progress_animation_->StartThrobbing(-1); |
315 } | 334 } |
OLD | NEW |