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

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

Issue 6681041: fav icon -> favicon. Pass 3: kFavIconSize -> kFaviconSize (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/views/tabs/base_tab.cc ('k') | chrome/browser/ui/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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/side_tab.h" 5 #include "chrome/browser/ui/views/tabs/side_tab.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "grit/app_resources.h" 8 #include "grit/app_resources.h"
9 #include "grit/theme_resources.h" 9 #include "grit/theme_resources.h"
10 #include "ui/base/resource/resource_bundle.h" 10 #include "ui/base/resource/resource_bundle.h"
11 #include "ui/gfx/canvas_skia.h" 11 #include "ui/gfx/canvas_skia.h"
12 #include "ui/gfx/favicon_size.h" 12 #include "ui/gfx/favicon_size.h"
13 #include "ui/gfx/path.h" 13 #include "ui/gfx/path.h"
14 #include "ui/gfx/skia_util.h" 14 #include "ui/gfx/skia_util.h"
15 #include "views/controls/button/image_button.h" 15 #include "views/controls/button/image_button.h"
16 16
17 namespace { 17 namespace {
18 const int kVerticalTabHeight = 27; 18 const int kVerticalTabHeight = 27;
19 const int kTitleCloseSpacing = 4; 19 const int kTitleCloseSpacing = 4;
20 const SkScalar kRoundRectRadius = 4; 20 const SkScalar kRoundRectRadius = 4;
21 const SkColor kTabBackgroundColor = SK_ColorWHITE; 21 const SkColor kTabBackgroundColor = SK_ColorWHITE;
22 const SkColor kTextColor = SK_ColorBLACK; 22 const SkColor kTextColor = SK_ColorBLACK;
23 23
24 // Padding between the edge and the icon. 24 // Padding between the edge and the icon.
25 const int kIconLeftPadding = 5; 25 const int kIconLeftPadding = 5;
26 26
27 // Location the title starts at. 27 // Location the title starts at.
28 const int kTitleX = kIconLeftPadding + kFavIconSize + 5; 28 const int kTitleX = kIconLeftPadding + kFaviconSize + 5;
29 }; 29 };
30 30
31 //////////////////////////////////////////////////////////////////////////////// 31 ////////////////////////////////////////////////////////////////////////////////
32 // SideTab, public: 32 // SideTab, public:
33 33
34 SideTab::SideTab(TabController* controller) 34 SideTab::SideTab(TabController* controller)
35 : BaseTab(controller) { 35 : BaseTab(controller) {
36 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 36 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
37 close_button()->SetBackground(kTextColor, 37 close_button()->SetBackground(kTextColor,
38 rb.GetBitmapNamed(IDR_TAB_CLOSE), 38 rb.GetBitmapNamed(IDR_TAB_CLOSE),
39 rb.GetBitmapNamed(IDR_TAB_CLOSE_MASK)); 39 rb.GetBitmapNamed(IDR_TAB_CLOSE_MASK));
40 } 40 }
41 41
42 SideTab::~SideTab() { 42 SideTab::~SideTab() {
43 } 43 }
44 44
45 // static 45 // static
46 int SideTab::GetPreferredHeight() { 46 int SideTab::GetPreferredHeight() {
47 return 27; 47 return 27;
48 } 48 }
49 49
50 //////////////////////////////////////////////////////////////////////////////// 50 ////////////////////////////////////////////////////////////////////////////////
51 // SideTab, views::View overrides: 51 // SideTab, views::View overrides:
52 52
53 void SideTab::Layout() { 53 void SideTab::Layout() {
54 if (ShouldShowIcon()) { 54 if (ShouldShowIcon()) {
55 int icon_y = (height() - kFavIconSize) / 2; 55 int icon_y = (height() - kFaviconSize) / 2;
56 icon_bounds_.SetRect(kIconLeftPadding, icon_y, kFavIconSize, kFavIconSize); 56 icon_bounds_.SetRect(kIconLeftPadding, icon_y, kFaviconSize, kFaviconSize);
57 } else { 57 } else {
58 icon_bounds_ = gfx::Rect(); 58 icon_bounds_ = gfx::Rect();
59 } 59 }
60 60
61 gfx::Size ps = close_button()->GetPreferredSize(); 61 gfx::Size ps = close_button()->GetPreferredSize();
62 int close_y = (height() - ps.height()) / 2; 62 int close_y = (height() - ps.height()) / 2;
63 close_button()->SetBounds( 63 close_button()->SetBounds(
64 std::max(0, width() - ps.width() - 64 std::max(0, width() - ps.width() -
65 (GetPreferredHeight() - ps.height()) / 2), 65 (GetPreferredHeight() - ps.height()) / 2),
66 close_y, 66 close_y,
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 return icon_bounds_; 106 return icon_bounds_;
107 } 107 }
108 108
109 bool SideTab::ShouldPaintHighlight() const { 109 bool SideTab::ShouldPaintHighlight() const {
110 return IsSelected() || !controller(); 110 return IsSelected() || !controller();
111 } 111 }
112 112
113 bool SideTab::ShouldShowIcon() const { 113 bool SideTab::ShouldShowIcon() const {
114 return data().mini || data().show_icon; 114 return data().mini || data().show_icon;
115 } 115 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/tabs/base_tab.cc ('k') | chrome/browser/ui/views/tabs/tab.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698