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

Side by Side Diff: ui/views/window/custom_frame_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: Rebased 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
« no previous file with comments | « ui/views/examples/button_example.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ui/views/window/custom_frame_view.h" 5 #include "ui/views/window/custom_frame_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "grit/ui_resources.h" 10 #include "grit/ui_resources.h"
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 minimize_button_->SetVisible(false); 483 minimize_button_->SetVisible(false);
484 484
485 normal_part = IDR_CLOSE_SA; 485 normal_part = IDR_CLOSE_SA;
486 hot_part = IDR_CLOSE_SA_H; 486 hot_part = IDR_CLOSE_SA_H;
487 pushed_part = IDR_CLOSE_SA_P; 487 pushed_part = IDR_CLOSE_SA_P;
488 } 488 }
489 489
490 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 490 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
491 491
492 close_button_->SetImage(CustomButton::BS_NORMAL, 492 close_button_->SetImage(CustomButton::BS_NORMAL,
493 rb.GetImageNamed(normal_part).ToSkBitmap()); 493 rb.GetImageNamed(normal_part).ToImageSkia());
494 close_button_->SetImage(CustomButton::BS_HOT, 494 close_button_->SetImage(CustomButton::BS_HOT,
495 rb.GetImageNamed(hot_part).ToSkBitmap()); 495 rb.GetImageNamed(hot_part).ToImageSkia());
496 close_button_->SetImage(CustomButton::BS_PUSHED, 496 close_button_->SetImage(CustomButton::BS_PUSHED,
497 rb.GetImageNamed(pushed_part).ToSkBitmap()); 497 rb.GetImageNamed(pushed_part).ToImageSkia());
498 } 498 }
499 499
500 void CustomFrameView::LayoutTitleBar() { 500 void CustomFrameView::LayoutTitleBar() {
501 // The window title position is calculated based on the icon position, even 501 // The window title position is calculated based on the icon position, even
502 // when there is no icon. 502 // when there is no icon.
503 gfx::Rect icon_bounds(IconBounds()); 503 gfx::Rect icon_bounds(IconBounds());
504 bool show_window_icon = window_icon_ != NULL; 504 bool show_window_icon = window_icon_ != NULL;
505 if (show_window_icon) 505 if (show_window_icon)
506 window_icon_->SetBoundsRect(icon_bounds); 506 window_icon_->SetBoundsRect(icon_bounds);
507 507
(...skipping 23 matching lines...) Expand all
531 531
532 ImageButton* CustomFrameView::InitWindowCaptionButton( 532 ImageButton* CustomFrameView::InitWindowCaptionButton(
533 int accessibility_string_id, 533 int accessibility_string_id,
534 int normal_image_id, 534 int normal_image_id,
535 int hot_image_id, 535 int hot_image_id,
536 int pushed_image_id) { 536 int pushed_image_id) {
537 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 537 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
538 ImageButton* button = new ImageButton(this); 538 ImageButton* button = new ImageButton(this);
539 button->SetAccessibleName(l10n_util::GetStringUTF16(accessibility_string_id)); 539 button->SetAccessibleName(l10n_util::GetStringUTF16(accessibility_string_id));
540 button->SetImage(CustomButton::BS_NORMAL, 540 button->SetImage(CustomButton::BS_NORMAL,
541 rb.GetImageNamed(normal_image_id).ToSkBitmap()); 541 rb.GetImageNamed(normal_image_id).ToImageSkia());
542 button->SetImage(CustomButton::BS_HOT, 542 button->SetImage(CustomButton::BS_HOT,
543 rb.GetImageNamed(hot_image_id).ToSkBitmap()); 543 rb.GetImageNamed(hot_image_id).ToImageSkia());
544 button->SetImage(CustomButton::BS_PUSHED, 544 button->SetImage(CustomButton::BS_PUSHED,
545 rb.GetImageNamed(pushed_image_id).ToSkBitmap()); 545 rb.GetImageNamed(pushed_image_id).ToImageSkia());
546 AddChildView(button); 546 AddChildView(button);
547 return button; 547 return button;
548 } 548 }
549 549
550 } // namespace views 550 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/examples/button_example.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698