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/download/download_shelf_view.h" | 5 #include "chrome/browser/ui/views/download/download_shelf_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 View* parent, | 301 View* parent, |
302 View* child) { | 302 View* child) { |
303 View::ViewHierarchyChanged(is_add, parent, child); | 303 View::ViewHierarchyChanged(is_add, parent, child); |
304 | 304 |
305 if (is_add && (child == this)) { | 305 if (is_add && (child == this)) { |
306 set_background(views::Background::CreateSolidBackground( | 306 set_background(views::Background::CreateSolidBackground( |
307 GetThemeProvider()->GetColor(ThemeService::COLOR_TOOLBAR))); | 307 GetThemeProvider()->GetColor(ThemeService::COLOR_TOOLBAR))); |
308 | 308 |
309 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 309 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
310 arrow_image_ = new views::ImageView(); | 310 arrow_image_ = new views::ImageView(); |
311 arrow_image_->SetImage(rb.GetBitmapNamed(IDR_DOWNLOADS_FAVICON)); | 311 arrow_image_->SetImage(rb.GetImageSkiaNamed(IDR_DOWNLOADS_FAVICON)); |
312 AddChildView(arrow_image_); | 312 AddChildView(arrow_image_); |
313 | 313 |
314 show_all_view_ = new views::Link( | 314 show_all_view_ = new views::Link( |
315 l10n_util::GetStringUTF16(IDS_SHOW_ALL_DOWNLOADS)); | 315 l10n_util::GetStringUTF16(IDS_SHOW_ALL_DOWNLOADS)); |
316 show_all_view_->set_listener(this); | 316 show_all_view_->set_listener(this); |
317 show_all_view_->SetBackgroundColor(background()->get_color()); | 317 show_all_view_->SetBackgroundColor(background()->get_color()); |
318 show_all_view_->SetEnabledColor( | 318 show_all_view_->SetEnabledColor( |
319 GetThemeProvider()->GetColor(ThemeService::COLOR_BOOKMARK_TEXT)); | 319 GetThemeProvider()->GetColor(ThemeService::COLOR_BOOKMARK_TEXT)); |
320 AddChildView(show_all_view_); | 320 AddChildView(show_all_view_); |
321 | 321 |
322 close_button_ = new views::ImageButton(this); | 322 close_button_ = new views::ImageButton(this); |
323 close_button_->SetImage(views::CustomButton::BS_NORMAL, | 323 close_button_->SetImage(views::CustomButton::BS_NORMAL, |
324 rb.GetBitmapNamed(IDR_CLOSE_BAR)); | 324 rb.GetImageSkiaNamed(IDR_CLOSE_BAR)); |
325 close_button_->SetImage(views::CustomButton::BS_HOT, | 325 close_button_->SetImage(views::CustomButton::BS_HOT, |
326 rb.GetBitmapNamed(IDR_CLOSE_BAR_H)); | 326 rb.GetImageSkiaNamed(IDR_CLOSE_BAR_H)); |
327 close_button_->SetImage(views::CustomButton::BS_PUSHED, | 327 close_button_->SetImage(views::CustomButton::BS_PUSHED, |
328 rb.GetBitmapNamed(IDR_CLOSE_BAR_P)); | 328 rb.GetImageSkiaNamed(IDR_CLOSE_BAR_P)); |
329 close_button_->SetAccessibleName( | 329 close_button_->SetAccessibleName( |
330 l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE)); | 330 l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE)); |
331 UpdateButtonColors(); | 331 UpdateButtonColors(); |
332 AddChildView(close_button_); | 332 AddChildView(close_button_); |
333 | 333 |
334 new_item_animation_.reset(new ui::SlideAnimation(this)); | 334 new_item_animation_.reset(new ui::SlideAnimation(this)); |
335 new_item_animation_->SetSlideDuration(kNewItemAnimationDurationMs); | 335 new_item_animation_->SetSlideDuration(kNewItemAnimationDurationMs); |
336 | 336 |
337 shelf_animation_.reset(new ui::SlideAnimation(this)); | 337 shelf_animation_.reset(new ui::SlideAnimation(this)); |
338 shelf_animation_->SetSlideDuration(kShelfAnimationDurationMs); | 338 shelf_animation_->SetSlideDuration(kShelfAnimationDurationMs); |
(...skipping 19 matching lines...) Expand all Loading... |
358 | 358 |
359 gfx::Size item_size = (*download_views_.rbegin())->GetPreferredSize(); | 359 gfx::Size item_size = (*download_views_.rbegin())->GetPreferredSize(); |
360 return item_size.width() < available_width; | 360 return item_size.width() < available_width; |
361 } | 361 } |
362 | 362 |
363 void DownloadShelfView::UpdateButtonColors() { | 363 void DownloadShelfView::UpdateButtonColors() { |
364 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 364 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
365 if (GetThemeProvider()) { | 365 if (GetThemeProvider()) { |
366 close_button_->SetBackground( | 366 close_button_->SetBackground( |
367 GetThemeProvider()->GetColor(ThemeService::COLOR_TAB_TEXT), | 367 GetThemeProvider()->GetColor(ThemeService::COLOR_TAB_TEXT), |
368 rb.GetBitmapNamed(IDR_CLOSE_BAR), | 368 rb.GetImageSkiaNamed(IDR_CLOSE_BAR), |
369 rb.GetBitmapNamed(IDR_CLOSE_BAR_MASK)); | 369 rb.GetImageSkiaNamed(IDR_CLOSE_BAR_MASK)); |
370 } | 370 } |
371 } | 371 } |
372 | 372 |
373 void DownloadShelfView::OnThemeChanged() { | 373 void DownloadShelfView::OnThemeChanged() { |
374 UpdateButtonColors(); | 374 UpdateButtonColors(); |
375 } | 375 } |
376 | 376 |
377 void DownloadShelfView::LinkClicked(views::Link* source, int event_flags) { | 377 void DownloadShelfView::LinkClicked(views::Link* source, int event_flags) { |
378 browser_->ShowDownloadsTab(); | 378 browser_->ShowDownloadsTab(); |
379 } | 379 } |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 const DownloadItemView* download_item_view) { | 469 const DownloadItemView* download_item_view) { |
470 gfx::Rect bounds = download_item_view->bounds(); | 470 gfx::Rect bounds = download_item_view->bounds(); |
471 | 471 |
472 #if defined(TOOLKIT_VIEWS) | 472 #if defined(TOOLKIT_VIEWS) |
473 bounds.set_height(bounds.height() - 1); | 473 bounds.set_height(bounds.height() - 1); |
474 bounds.Offset(0, 3); | 474 bounds.Offset(0, 3); |
475 #endif | 475 #endif |
476 | 476 |
477 return bounds; | 477 return bounds; |
478 } | 478 } |
OLD | NEW |