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

Side by Side Diff: chrome/browser/ui/views/tabs/tab.cc

Issue 12703039: Inconsistent use of [x] close panel icon. Code changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added recently added local NTP file. Created 7 years, 9 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
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/tabs/tab.h" 5 #include "chrome/browser/ui/views/tabs/tab.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/alias.h" 10 #include "base/debug/alias.h"
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 // So we get don't get enter/exit on children and don't prematurely stop the 454 // So we get don't get enter/exit on children and don't prematurely stop the
455 // hover. 455 // hover.
456 set_notify_enter_exit_on_child(true); 456 set_notify_enter_exit_on_child(true);
457 457
458 set_id(VIEW_ID_TAB); 458 set_id(VIEW_ID_TAB);
459 459
460 // Add the Close Button. 460 // Add the Close Button.
461 close_button_ = new TabCloseButton(this); 461 close_button_ = new TabCloseButton(this);
462 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 462 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
463 close_button_->SetImage(views::CustomButton::STATE_NORMAL, 463 close_button_->SetImage(views::CustomButton::STATE_NORMAL,
464 rb.GetImageSkiaNamed(IDR_TAB_CLOSE)); 464 rb.GetImageSkiaNamed(IDR_CLOSE_1));
465 close_button_->SetImage(views::CustomButton::STATE_HOVERED, 465 close_button_->SetImage(views::CustomButton::STATE_HOVERED,
466 rb.GetImageSkiaNamed(IDR_TAB_CLOSE_H)); 466 rb.GetImageSkiaNamed(IDR_CLOSE_1_H));
467 close_button_->SetImage(views::CustomButton::STATE_PRESSED, 467 close_button_->SetImage(views::CustomButton::STATE_PRESSED,
468 rb.GetImageSkiaNamed(IDR_TAB_CLOSE_P)); 468 rb.GetImageSkiaNamed(IDR_CLOSE_1_P));
469 close_button_->SetAccessibleName( 469 close_button_->SetAccessibleName(
470 l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE)); 470 l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE));
471 // Disable animation so that the red danger sign shows up immediately 471 // Disable animation so that the red danger sign shows up immediately
472 // to help avoid mis-clicks. 472 // to help avoid mis-clicks.
473 close_button_->SetAnimationDuration(0); 473 close_button_->SetAnimationDuration(0);
474 AddChildView(close_button_); 474 AddChildView(close_button_);
475 475
476 set_context_menu_controller(this); 476 set_context_menu_controller(this);
477 477
478 tab_audio_indicator_.reset(new TabAudioIndicator(this)); 478 tab_audio_indicator_.reset(new TabAudioIndicator(this));
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
1083 PaintTitle(canvas, title_color); 1083 PaintTitle(canvas, title_color);
1084 1084
1085 if (show_icon) 1085 if (show_icon)
1086 PaintIcon(canvas); 1086 PaintIcon(canvas);
1087 1087
1088 // If the close button color has changed, generate a new one. 1088 // If the close button color has changed, generate a new one.
1089 if (!close_button_color_ || title_color != close_button_color_) { 1089 if (!close_button_color_ || title_color != close_button_color_) {
1090 close_button_color_ = title_color; 1090 close_button_color_ = title_color;
1091 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 1091 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
1092 close_button_->SetBackground(close_button_color_, 1092 close_button_->SetBackground(close_button_color_,
1093 rb.GetImageSkiaNamed(IDR_TAB_CLOSE), 1093 rb.GetImageSkiaNamed(IDR_CLOSE_1),
1094 rb.GetImageSkiaNamed(IDR_TAB_CLOSE_MASK)); 1094 rb.GetImageSkiaNamed(IDR_CLOSE_1_MASK));
1095 } 1095 }
1096 } 1096 }
1097 1097
1098 void Tab::PaintImmersiveTab(gfx::Canvas* canvas) { 1098 void Tab::PaintImmersiveTab(gfx::Canvas* canvas) {
1099 // Draw a gray rectangle to represent the tab. This works for mini-tabs as 1099 // Draw a gray rectangle to represent the tab. This works for mini-tabs as
1100 // well as regular ones. The active tab has a brigher bar. 1100 // well as regular ones. The active tab has a brigher bar.
1101 SkColor color = 1101 SkColor color =
1102 IsActive() ? kImmersiveActiveTabColor : kImmersiveInactiveTabColor; 1102 IsActive() ? kImmersiveActiveTabColor : kImmersiveInactiveTabColor;
1103 gfx::Rect bar_rect = GetImmersiveBarRect(); 1103 gfx::Rect bar_rect = GetImmersiveBarRect();
1104 canvas->FillRect(bar_rect, color); 1104 canvas->FillRect(bar_rect, color);
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after
1801 const gfx::ImageSkia& image) { 1801 const gfx::ImageSkia& image) {
1802 DCHECK_NE(scale_factor, ui::SCALE_FACTOR_NONE); 1802 DCHECK_NE(scale_factor, ui::SCALE_FACTOR_NONE);
1803 ImageCacheEntry entry; 1803 ImageCacheEntry entry;
1804 entry.resource_id = resource_id; 1804 entry.resource_id = resource_id;
1805 entry.scale_factor = scale_factor; 1805 entry.scale_factor = scale_factor;
1806 entry.image = image; 1806 entry.image = image;
1807 image_cache_->push_front(entry); 1807 image_cache_->push_front(entry);
1808 if (image_cache_->size() > kMaxImageCacheSize) 1808 if (image_cache_->size() > kMaxImageCacheSize)
1809 image_cache_->pop_back(); 1809 image_cache_->pop_back();
1810 } 1810 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698