OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/frame/opaque_browser_frame_view.h" | 5 #include "chrome/browser/views/frame/opaque_browser_frame_view.h" |
6 | 6 |
7 #include "app/gfx/canvas.h" | 7 #include "app/gfx/canvas.h" |
8 #include "app/gfx/font.h" | 8 #include "app/gfx/font.h" |
9 #include "app/gfx/path.h" | 9 #include "app/gfx/path.h" |
10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 minimize_button_(new views::ImageButton(this)), | 110 minimize_button_(new views::ImageButton(this)), |
111 maximize_button_(new views::ImageButton(this)), | 111 maximize_button_(new views::ImageButton(this)), |
112 restore_button_(new views::ImageButton(this)), | 112 restore_button_(new views::ImageButton(this)), |
113 close_button_(new views::ImageButton(this)), | 113 close_button_(new views::ImageButton(this)), |
114 window_icon_(NULL), | 114 window_icon_(NULL), |
115 frame_(frame), | 115 frame_(frame), |
116 browser_view_(browser_view) { | 116 browser_view_(browser_view) { |
117 InitClass(); | 117 InitClass(); |
118 | 118 |
119 ThemeProvider* tp = frame_->GetThemeProviderForFrame(); | 119 ThemeProvider* tp = frame_->GetThemeProviderForFrame(); |
120 SkColor color = tp->GetColor(BrowserThemeProvider::COLOR_BUTTON_BACKGROUND); | |
121 SkBitmap* background = | |
122 tp->GetBitmapNamed(IDR_THEME_WINDOW_CONTROL_BACKGROUND); | |
123 | 120 |
124 minimize_button_->SetImage( | 121 minimize_button_->SetImage( |
125 views::CustomButton::BS_NORMAL, | 122 views::CustomButton::BS_NORMAL, |
126 tp->GetBitmapNamed(IDR_MINIMIZE)); | 123 tp->GetBitmapNamed(IDR_MINIMIZE)); |
127 minimize_button_->SetImage( | 124 minimize_button_->SetImage( |
128 views::CustomButton::BS_HOT, | 125 views::CustomButton::BS_HOT, |
129 tp->GetBitmapNamed(IDR_MINIMIZE_H)); | 126 tp->GetBitmapNamed(IDR_MINIMIZE_H)); |
130 minimize_button_->SetImage( | 127 minimize_button_->SetImage( |
131 views::CustomButton::BS_PUSHED, | 128 views::CustomButton::BS_PUSHED, |
132 tp->GetBitmapNamed(IDR_MINIMIZE_P)); | 129 tp->GetBitmapNamed(IDR_MINIMIZE_P)); |
133 minimize_button_->SetBackground(color, background, | |
134 tp->GetBitmapNamed(IDR_MINIMIZE_BUTTON_MASK)); | |
135 minimize_button_->SetAccessibleName( | 130 minimize_button_->SetAccessibleName( |
136 l10n_util::GetString(IDS_ACCNAME_MINIMIZE)); | 131 l10n_util::GetString(IDS_ACCNAME_MINIMIZE)); |
137 AddChildView(minimize_button_); | 132 AddChildView(minimize_button_); |
138 | 133 |
139 maximize_button_->SetImage( | 134 maximize_button_->SetImage( |
140 views::CustomButton::BS_NORMAL, | 135 views::CustomButton::BS_NORMAL, |
141 tp->GetBitmapNamed(IDR_MAXIMIZE)); | 136 tp->GetBitmapNamed(IDR_MAXIMIZE)); |
142 maximize_button_->SetImage( | 137 maximize_button_->SetImage( |
143 views::CustomButton::BS_HOT, | 138 views::CustomButton::BS_HOT, |
144 tp->GetBitmapNamed(IDR_MAXIMIZE_H)); | 139 tp->GetBitmapNamed(IDR_MAXIMIZE_H)); |
145 maximize_button_->SetImage( | 140 maximize_button_->SetImage( |
146 views::CustomButton::BS_PUSHED, | 141 views::CustomButton::BS_PUSHED, |
147 tp->GetBitmapNamed(IDR_MAXIMIZE_P)); | 142 tp->GetBitmapNamed(IDR_MAXIMIZE_P)); |
148 maximize_button_->SetBackground(color, background, | |
149 tp->GetBitmapNamed(IDR_MAXIMIZE_BUTTON_MASK)); | |
150 maximize_button_->SetAccessibleName( | 143 maximize_button_->SetAccessibleName( |
151 l10n_util::GetString(IDS_ACCNAME_MAXIMIZE)); | 144 l10n_util::GetString(IDS_ACCNAME_MAXIMIZE)); |
152 AddChildView(maximize_button_); | 145 AddChildView(maximize_button_); |
153 | 146 |
154 restore_button_->SetImage( | 147 restore_button_->SetImage( |
155 views::CustomButton::BS_NORMAL, | 148 views::CustomButton::BS_NORMAL, |
156 tp->GetBitmapNamed(IDR_RESTORE)); | 149 tp->GetBitmapNamed(IDR_RESTORE)); |
157 restore_button_->SetImage( | 150 restore_button_->SetImage( |
158 views::CustomButton::BS_HOT, | 151 views::CustomButton::BS_HOT, |
159 tp->GetBitmapNamed(IDR_RESTORE_H)); | 152 tp->GetBitmapNamed(IDR_RESTORE_H)); |
160 restore_button_->SetImage( | 153 restore_button_->SetImage( |
161 views::CustomButton::BS_PUSHED, | 154 views::CustomButton::BS_PUSHED, |
162 tp->GetBitmapNamed(IDR_RESTORE_P)); | 155 tp->GetBitmapNamed(IDR_RESTORE_P)); |
163 restore_button_->SetBackground(color, background, | |
164 tp->GetBitmapNamed(IDR_RESTORE_BUTTON_MASK)); | |
165 restore_button_->SetAccessibleName( | 156 restore_button_->SetAccessibleName( |
166 l10n_util::GetString(IDS_ACCNAME_RESTORE)); | 157 l10n_util::GetString(IDS_ACCNAME_RESTORE)); |
167 AddChildView(restore_button_); | 158 AddChildView(restore_button_); |
168 | 159 |
169 close_button_->SetImage( | 160 close_button_->SetImage( |
170 views::CustomButton::BS_NORMAL, | 161 views::CustomButton::BS_NORMAL, |
171 tp->GetBitmapNamed(IDR_CLOSE)); | 162 tp->GetBitmapNamed(IDR_CLOSE)); |
172 close_button_->SetImage( | 163 close_button_->SetImage( |
173 views::CustomButton::BS_HOT, | 164 views::CustomButton::BS_HOT, |
174 tp->GetBitmapNamed(IDR_CLOSE_H)); | 165 tp->GetBitmapNamed(IDR_CLOSE_H)); |
175 close_button_->SetImage( | 166 close_button_->SetImage( |
176 views::CustomButton::BS_PUSHED, | 167 views::CustomButton::BS_PUSHED, |
177 tp->GetBitmapNamed(IDR_CLOSE_P)); | 168 tp->GetBitmapNamed(IDR_CLOSE_P)); |
178 close_button_->SetBackground(color, background, | |
179 tp->GetBitmapNamed(IDR_CLOSE_BUTTON_MASK)); | |
180 close_button_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_CLOSE)); | 169 close_button_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_CLOSE)); |
181 AddChildView(close_button_); | 170 AddChildView(close_button_); |
182 | 171 |
183 // Initializing the TabIconView is expensive, so only do it if we need to. | 172 // Initializing the TabIconView is expensive, so only do it if we need to. |
184 if (browser_view_->ShouldShowWindowIcon()) { | 173 if (browser_view_->ShouldShowWindowIcon()) { |
185 window_icon_ = new TabIconView(this); | 174 window_icon_ = new TabIconView(this); |
186 window_icon_->set_is_light(true); | 175 window_icon_->set_is_light(true); |
187 AddChildView(window_icon_); | 176 AddChildView(window_icon_); |
188 window_icon_->Update(); | 177 window_icon_->Update(); |
189 } | 178 } |
(...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1006 if (!initialized) { | 995 if (!initialized) { |
1007 #if defined(OS_WIN) | 996 #if defined(OS_WIN) |
1008 title_font_ = new gfx::Font(win_util::GetWindowTitleFont()); | 997 title_font_ = new gfx::Font(win_util::GetWindowTitleFont()); |
1009 #else | 998 #else |
1010 NOTIMPLEMENTED(); | 999 NOTIMPLEMENTED(); |
1011 title_font_ = new gfx::Font(); | 1000 title_font_ = new gfx::Font(); |
1012 #endif | 1001 #endif |
1013 initialized = true; | 1002 initialized = true; |
1014 } | 1003 } |
1015 } | 1004 } |
OLD | NEW |