Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(191)

Side by Side Diff: chrome/browser/ui/views/download/download_shelf_view.cc

Issue 10382144: Change SetImage, SetBackground, and SetToggledImage to take in a gfx::ImageSkia (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 View* parent, 300 View* parent,
301 View* child) { 301 View* child) {
302 View::ViewHierarchyChanged(is_add, parent, child); 302 View::ViewHierarchyChanged(is_add, parent, child);
303 303
304 if (is_add && (child == this)) { 304 if (is_add && (child == this)) {
305 set_background(views::Background::CreateSolidBackground( 305 set_background(views::Background::CreateSolidBackground(
306 GetThemeProvider()->GetColor(ThemeService::COLOR_TOOLBAR))); 306 GetThemeProvider()->GetColor(ThemeService::COLOR_TOOLBAR)));
307 307
308 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 308 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
309 arrow_image_ = new views::ImageView(); 309 arrow_image_ = new views::ImageView();
310 arrow_image_->SetImage(rb.GetBitmapNamed(IDR_DOWNLOADS_FAVICON)); 310 arrow_image_->SetImage(rb.GetImageSkiaNamed(IDR_DOWNLOADS_FAVICON));
311 AddChildView(arrow_image_); 311 AddChildView(arrow_image_);
312 312
313 show_all_view_ = new views::Link( 313 show_all_view_ = new views::Link(
314 l10n_util::GetStringUTF16(IDS_SHOW_ALL_DOWNLOADS)); 314 l10n_util::GetStringUTF16(IDS_SHOW_ALL_DOWNLOADS));
315 show_all_view_->set_listener(this); 315 show_all_view_->set_listener(this);
316 show_all_view_->SetBackgroundColor(background()->get_color()); 316 show_all_view_->SetBackgroundColor(background()->get_color());
317 show_all_view_->SetEnabledColor( 317 show_all_view_->SetEnabledColor(
318 GetThemeProvider()->GetColor(ThemeService::COLOR_BOOKMARK_TEXT)); 318 GetThemeProvider()->GetColor(ThemeService::COLOR_BOOKMARK_TEXT));
319 AddChildView(show_all_view_); 319 AddChildView(show_all_view_);
320 320
321 close_button_ = new views::ImageButton(this); 321 close_button_ = new views::ImageButton(this);
322 close_button_->SetImage(views::CustomButton::BS_NORMAL, 322 close_button_->SetImage(views::CustomButton::BS_NORMAL,
323 rb.GetBitmapNamed(IDR_CLOSE_BAR)); 323 rb.GetImageSkiaNamed(IDR_CLOSE_BAR));
324 close_button_->SetImage(views::CustomButton::BS_HOT, 324 close_button_->SetImage(views::CustomButton::BS_HOT,
325 rb.GetBitmapNamed(IDR_CLOSE_BAR_H)); 325 rb.GetImageSkiaNamed(IDR_CLOSE_BAR_H));
326 close_button_->SetImage(views::CustomButton::BS_PUSHED, 326 close_button_->SetImage(views::CustomButton::BS_PUSHED,
327 rb.GetBitmapNamed(IDR_CLOSE_BAR_P)); 327 rb.GetImageSkiaNamed(IDR_CLOSE_BAR_P));
328 close_button_->SetAccessibleName( 328 close_button_->SetAccessibleName(
329 l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE)); 329 l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE));
330 UpdateButtonColors(); 330 UpdateButtonColors();
331 AddChildView(close_button_); 331 AddChildView(close_button_);
332 332
333 new_item_animation_.reset(new ui::SlideAnimation(this)); 333 new_item_animation_.reset(new ui::SlideAnimation(this));
334 new_item_animation_->SetSlideDuration(kNewItemAnimationDurationMs); 334 new_item_animation_->SetSlideDuration(kNewItemAnimationDurationMs);
335 335
336 shelf_animation_.reset(new ui::SlideAnimation(this)); 336 shelf_animation_.reset(new ui::SlideAnimation(this));
337 shelf_animation_->SetSlideDuration(kShelfAnimationDurationMs); 337 shelf_animation_->SetSlideDuration(kShelfAnimationDurationMs);
(...skipping 19 matching lines...) Expand all
357 357
358 gfx::Size item_size = (*download_views_.rbegin())->GetPreferredSize(); 358 gfx::Size item_size = (*download_views_.rbegin())->GetPreferredSize();
359 return item_size.width() < available_width; 359 return item_size.width() < available_width;
360 } 360 }
361 361
362 void DownloadShelfView::UpdateButtonColors() { 362 void DownloadShelfView::UpdateButtonColors() {
363 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 363 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
364 if (GetThemeProvider()) { 364 if (GetThemeProvider()) {
365 close_button_->SetBackground( 365 close_button_->SetBackground(
366 GetThemeProvider()->GetColor(ThemeService::COLOR_TAB_TEXT), 366 GetThemeProvider()->GetColor(ThemeService::COLOR_TAB_TEXT),
367 rb.GetBitmapNamed(IDR_CLOSE_BAR), 367 rb.GetImageSkiaNamed(IDR_CLOSE_BAR),
368 rb.GetBitmapNamed(IDR_CLOSE_BAR_MASK)); 368 rb.GetImageSkiaNamed(IDR_CLOSE_BAR_MASK));
369 } 369 }
370 } 370 }
371 371
372 void DownloadShelfView::OnThemeChanged() { 372 void DownloadShelfView::OnThemeChanged() {
373 UpdateButtonColors(); 373 UpdateButtonColors();
374 } 374 }
375 375
376 void DownloadShelfView::LinkClicked(views::Link* source, int event_flags) { 376 void DownloadShelfView::LinkClicked(views::Link* source, int event_flags) {
377 browser_->ShowDownloadsTab(); 377 browser_->ShowDownloadsTab();
378 } 378 }
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 const DownloadItemView* download_item_view) { 468 const DownloadItemView* download_item_view) {
469 gfx::Rect bounds = download_item_view->bounds(); 469 gfx::Rect bounds = download_item_view->bounds();
470 470
471 #if defined(TOOLKIT_VIEWS) 471 #if defined(TOOLKIT_VIEWS)
472 bounds.set_height(bounds.height() - 1); 472 bounds.set_height(bounds.height() - 1);
473 bounds.Offset(0, 3); 473 bounds.Offset(0, 3);
474 #endif 474 #endif
475 475
476 return bounds; 476 return bounds;
477 } 477 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698