Chromium Code Reviews

Side by Side Diff: chrome/browser/views/tabs/side_tab.cc

Issue 2863003: Attempt 2 at: (Closed)
Patch Set: Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
« no previous file with comments | « chrome/browser/views/tabs/base_tab.cc ('k') | chrome/browser/views/tabs/tab.cc » ('j') | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/views/tabs/side_tab.h" 5 #include "chrome/browser/views/tabs/side_tab.h"
6 6
7 #include "app/resource_bundle.h" 7 #include "app/resource_bundle.h"
8 #include "app/theme_provider.h" 8 #include "app/theme_provider.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
11 #include "gfx/canvas.h" 11 #include "gfx/canvas.h"
12 #include "gfx/favicon_size.h" 12 #include "gfx/favicon_size.h"
13 #include "gfx/path.h" 13 #include "gfx/path.h"
14 #include "gfx/skia_util.h" 14 #include "gfx/skia_util.h"
15 #include "grit/app_resources.h" 15 #include "grit/app_resources.h"
16 #include "grit/theme_resources.h"
17 #include "views/controls/button/image_button.h" 16 #include "views/controls/button/image_button.h"
18 17
19 namespace { 18 namespace {
20 const int kVerticalTabHeight = 27; 19 const int kVerticalTabHeight = 27;
21 const int kTitleCloseSpacing = 4; 20 const int kTitleCloseSpacing = 4;
22 const SkScalar kRoundRectRadius = 4; 21 const SkScalar kRoundRectRadius = 4;
23 const SkColor kTabBackgroundColor = SK_ColorWHITE; 22 const SkColor kTabBackgroundColor = SK_ColorWHITE;
24 const SkColor kTextColor = SK_ColorBLACK; 23 const SkColor kTextColor = SK_ColorBLACK;
25 const SkColor kPhantomTextColor = SK_ColorGRAY; 24 const SkColor kPhantomTextColor = SK_ColorGRAY;
26 25
27 // Padding between the edge and the icon. 26 // Padding between the edge and the icon.
28 const int kIconLeftPadding = 5; 27 const int kIconLeftPadding = 5;
29 28
30 // Location the title starts at. 29 // Location the title starts at.
31 const int kTitleX = kIconLeftPadding + kFavIconSize + 5; 30 const int kTitleX = kIconLeftPadding + kFavIconSize + 5;
32 31
33 // Alpha value phantom tab icons are rendered at. 32 // Alpha value phantom tab icons are rendered at.
34 const int kPhantomTabIconAlpha = 100; 33 const int kPhantomTabIconAlpha = 100;
35 }; 34 };
36 35
37 //////////////////////////////////////////////////////////////////////////////// 36 ////////////////////////////////////////////////////////////////////////////////
38 // SideTab, public: 37 // SideTab, public:
39 38
40 SideTab::SideTab(TabController* controller) 39 SideTab::SideTab(TabController* controller)
41 : BaseTab(controller) { 40 : BaseTab(controller, false) {
42 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 41 SetCloseButtonColor(kTextColor);
43 close_button()->SetBackground(kTextColor,
44 rb.GetBitmapNamed(IDR_TAB_CLOSE),
45 rb.GetBitmapNamed(IDR_TAB_CLOSE_MASK));
46 } 42 }
47 43
48 SideTab::~SideTab() { 44 SideTab::~SideTab() {
49 } 45 }
50 46
51 // static 47 // static
52 int SideTab::GetPreferredHeight() { 48 int SideTab::GetPreferredHeight() {
53 return 27; 49 return 27;
54 } 50 }
55 51
(...skipping 63 matching lines...)
119 return gfx::Size(0, GetPreferredHeight()); 115 return gfx::Size(0, GetPreferredHeight());
120 } 116 }
121 117
122 bool SideTab::ShouldPaintHighlight() const { 118 bool SideTab::ShouldPaintHighlight() const {
123 return IsSelected() || !controller(); 119 return IsSelected() || !controller();
124 } 120 }
125 121
126 bool SideTab::ShouldShowIcon() const { 122 bool SideTab::ShouldShowIcon() const {
127 return data().mini || data().show_icon; 123 return data().mini || data().show_icon;
128 } 124 }
OLDNEW
« no previous file with comments | « chrome/browser/views/tabs/base_tab.cc ('k') | chrome/browser/views/tabs/tab.cc » ('j') | no next file with comments »

Powered by Google App Engine