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

Side by Side Diff: chrome/browser/views/toolbar_view.cc

Issue 119025: Add ability to theme our buttons.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 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
OLDNEW
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/toolbar_view.h" 5 #include "chrome/browser/views/toolbar_view.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "app/drag_drop_types.h" 9 #include "app/drag_drop_types.h"
10 #include "app/gfx/canvas.h" 10 #include "app/gfx/canvas.h"
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 bookmark_menu_ = new BookmarkMenuButton(browser_); 231 bookmark_menu_ = new BookmarkMenuButton(browser_);
232 AddChildView(bookmark_menu_); 232 AddChildView(bookmark_menu_);
233 } else { 233 } else {
234 bookmark_menu_ = NULL; 234 bookmark_menu_ = NULL;
235 } 235 }
236 } 236 }
237 237
238 void BrowserToolbarView::LoadLeftSideControlsImages() { 238 void BrowserToolbarView::LoadLeftSideControlsImages() {
239 ThemeProvider* tp = GetThemeProvider(); 239 ThemeProvider* tp = GetThemeProvider();
240 240
241 SkColor color = tp->GetColor(BrowserThemeProvider::COLOR_BUTTON_BACKGROUND);
242 SkBitmap* background = tp->GetBitmapNamed(IDR_THEME_BUTTON_BACKGROUND);
243
241 back_->SetImage(views::CustomButton::BS_NORMAL, tp->GetBitmapNamed(IDR_BACK)); 244 back_->SetImage(views::CustomButton::BS_NORMAL, tp->GetBitmapNamed(IDR_BACK));
242 back_->SetImage(views::CustomButton::BS_HOT, tp->GetBitmapNamed(IDR_BACK_H)); 245 back_->SetImage(views::CustomButton::BS_HOT, tp->GetBitmapNamed(IDR_BACK_H));
243 back_->SetImage(views::CustomButton::BS_PUSHED, 246 back_->SetImage(views::CustomButton::BS_PUSHED,
244 tp->GetBitmapNamed(IDR_BACK_P)); 247 tp->GetBitmapNamed(IDR_BACK_P));
245 back_->SetImage(views::CustomButton::BS_DISABLED, 248 back_->SetImage(views::CustomButton::BS_DISABLED,
246 tp->GetBitmapNamed(IDR_BACK_D)); 249 tp->GetBitmapNamed(IDR_BACK_D));
250 back_->SetBackground(color, background,
251 tp->GetBitmapNamed(IDR_BACK_MASK));
247 252
248 forward_->SetImage(views::CustomButton::BS_NORMAL, 253 forward_->SetImage(views::CustomButton::BS_NORMAL,
249 tp->GetBitmapNamed(IDR_FORWARD)); 254 tp->GetBitmapNamed(IDR_FORWARD));
250 forward_->SetImage(views::CustomButton::BS_HOT, 255 forward_->SetImage(views::CustomButton::BS_HOT,
251 tp->GetBitmapNamed(IDR_FORWARD_H)); 256 tp->GetBitmapNamed(IDR_FORWARD_H));
252 forward_->SetImage(views::CustomButton::BS_PUSHED, 257 forward_->SetImage(views::CustomButton::BS_PUSHED,
253 tp->GetBitmapNamed(IDR_FORWARD_P)); 258 tp->GetBitmapNamed(IDR_FORWARD_P));
254 forward_->SetImage(views::CustomButton::BS_DISABLED, 259 forward_->SetImage(views::CustomButton::BS_DISABLED,
255 tp->GetBitmapNamed(IDR_FORWARD_D)); 260 tp->GetBitmapNamed(IDR_FORWARD_D));
261 forward_->SetBackground(color, background,
262 tp->GetBitmapNamed(IDR_FORWARD_MASK));
256 263
257 reload_->SetImage(views::CustomButton::BS_NORMAL, 264 reload_->SetImage(views::CustomButton::BS_NORMAL,
258 tp->GetBitmapNamed(IDR_RELOAD)); 265 tp->GetBitmapNamed(IDR_RELOAD));
259 reload_->SetImage(views::CustomButton::BS_HOT, 266 reload_->SetImage(views::CustomButton::BS_HOT,
260 tp->GetBitmapNamed(IDR_RELOAD_H)); 267 tp->GetBitmapNamed(IDR_RELOAD_H));
261 reload_->SetImage(views::CustomButton::BS_PUSHED, 268 reload_->SetImage(views::CustomButton::BS_PUSHED,
262 tp->GetBitmapNamed(IDR_RELOAD_P)); 269 tp->GetBitmapNamed(IDR_RELOAD_P));
270 reload_->SetBackground(color, background,
271 tp->GetBitmapNamed(IDR_BUTTON_MASK));
263 272
264 home_->SetImage(views::CustomButton::BS_NORMAL, tp->GetBitmapNamed(IDR_HOME)); 273 home_->SetImage(views::CustomButton::BS_NORMAL, tp->GetBitmapNamed(IDR_HOME));
265 home_->SetImage(views::CustomButton::BS_HOT, tp->GetBitmapNamed(IDR_HOME_H)); 274 home_->SetImage(views::CustomButton::BS_HOT, tp->GetBitmapNamed(IDR_HOME_H));
266 home_->SetImage(views::CustomButton::BS_PUSHED, 275 home_->SetImage(views::CustomButton::BS_PUSHED,
267 tp->GetBitmapNamed(IDR_HOME_P)); 276 tp->GetBitmapNamed(IDR_HOME_P));
277 home_->SetBackground(color, background,
278 tp->GetBitmapNamed(IDR_BUTTON_MASK));
268 } 279 }
269 280
270 void BrowserToolbarView::LoadCenterStackImages() { 281 void BrowserToolbarView::LoadCenterStackImages() {
271 ThemeProvider* tp = GetThemeProvider(); 282 ThemeProvider* tp = GetThemeProvider();
272 283
284 SkColor color = tp->GetColor(BrowserThemeProvider::COLOR_BUTTON_BACKGROUND);
285 SkBitmap* background = tp->GetBitmapNamed(IDR_THEME_BUTTON_BACKGROUND);
286
273 star_->SetImage(views::CustomButton::BS_NORMAL, tp->GetBitmapNamed(IDR_STAR)); 287 star_->SetImage(views::CustomButton::BS_NORMAL, tp->GetBitmapNamed(IDR_STAR));
274 star_->SetImage(views::CustomButton::BS_HOT, tp->GetBitmapNamed(IDR_STAR_H)); 288 star_->SetImage(views::CustomButton::BS_HOT, tp->GetBitmapNamed(IDR_STAR_H));
275 star_->SetImage(views::CustomButton::BS_PUSHED, 289 star_->SetImage(views::CustomButton::BS_PUSHED,
276 tp->GetBitmapNamed(IDR_STAR_P)); 290 tp->GetBitmapNamed(IDR_STAR_P));
277 star_->SetImage(views::CustomButton::BS_DISABLED, 291 star_->SetImage(views::CustomButton::BS_DISABLED,
278 tp->GetBitmapNamed(IDR_STAR_D)); 292 tp->GetBitmapNamed(IDR_STAR_D));
279 star_->SetToggledImage(views::CustomButton::BS_NORMAL, 293 star_->SetToggledImage(views::CustomButton::BS_NORMAL,
280 tp->GetBitmapNamed(IDR_STARRED)); 294 tp->GetBitmapNamed(IDR_STARRED));
281 star_->SetToggledImage(views::CustomButton::BS_HOT, 295 star_->SetToggledImage(views::CustomButton::BS_HOT,
282 tp->GetBitmapNamed(IDR_STARRED_H)); 296 tp->GetBitmapNamed(IDR_STARRED_H));
283 star_->SetToggledImage(views::CustomButton::BS_PUSHED, 297 star_->SetToggledImage(views::CustomButton::BS_PUSHED,
284 tp->GetBitmapNamed(IDR_STARRED_P)); 298 tp->GetBitmapNamed(IDR_STARRED_P));
299 star_->SetBackground(color, background,
300 tp->GetBitmapNamed(IDR_STAR_MASK));
285 301
286 go_->SetImage(views::CustomButton::BS_NORMAL, tp->GetBitmapNamed(IDR_GO)); 302 go_->SetImage(views::CustomButton::BS_NORMAL, tp->GetBitmapNamed(IDR_GO));
287 go_->SetImage(views::CustomButton::BS_HOT, tp->GetBitmapNamed(IDR_GO_H)); 303 go_->SetImage(views::CustomButton::BS_HOT, tp->GetBitmapNamed(IDR_GO_H));
288 go_->SetImage(views::CustomButton::BS_PUSHED, tp->GetBitmapNamed(IDR_GO_P)); 304 go_->SetImage(views::CustomButton::BS_PUSHED, tp->GetBitmapNamed(IDR_GO_P));
289 go_->SetToggledImage(views::CustomButton::BS_NORMAL, 305 go_->SetToggledImage(views::CustomButton::BS_NORMAL,
290 tp->GetBitmapNamed(IDR_STOP)); 306 tp->GetBitmapNamed(IDR_STOP));
291 go_->SetToggledImage(views::CustomButton::BS_HOT, 307 go_->SetToggledImage(views::CustomButton::BS_HOT,
292 tp->GetBitmapNamed(IDR_STOP_H)); 308 tp->GetBitmapNamed(IDR_STOP_H));
293 go_->SetToggledImage(views::CustomButton::BS_PUSHED, 309 go_->SetToggledImage(views::CustomButton::BS_PUSHED,
294 tp->GetBitmapNamed(IDR_STOP_P)); 310 tp->GetBitmapNamed(IDR_STOP_P));
311 go_->SetBackground(color, background,
312 tp->GetBitmapNamed(IDR_GO_MASK));
295 } 313 }
296 314
297 void BrowserToolbarView::LoadRightSideControlsImages() { 315 void BrowserToolbarView::LoadRightSideControlsImages() {
298 ThemeProvider* tp = GetThemeProvider(); 316 ThemeProvider* tp = GetThemeProvider();
299 317
300 // We use different menu button images if the locale is right-to-left. 318 // We use different menu button images if the locale is right-to-left.
301 if (UILayoutIsRightToLeft()) 319 if (UILayoutIsRightToLeft())
302 page_menu_->SetIcon(*tp->GetBitmapNamed(IDR_MENU_PAGE_RTL)); 320 page_menu_->SetIcon(*tp->GetBitmapNamed(IDR_MENU_PAGE_RTL));
303 else 321 else
304 page_menu_->SetIcon(*tp->GetBitmapNamed(IDR_MENU_PAGE)); 322 page_menu_->SetIcon(*tp->GetBitmapNamed(IDR_MENU_PAGE));
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after
976 case IDC_COPY: 994 case IDC_COPY:
977 *accel = views::Accelerator(L'C', false, true, false); 995 *accel = views::Accelerator(L'C', false, true, false);
978 return true; 996 return true;
979 case IDC_PASTE: 997 case IDC_PASTE:
980 *accel = views::Accelerator(L'V', false, true, false); 998 *accel = views::Accelerator(L'V', false, true, false);
981 return true; 999 return true;
982 } 1000 }
983 // Else, we retrieve the accelerator information from the frame. 1001 // Else, we retrieve the accelerator information from the frame.
984 return GetWidget()->GetAccelerator(id, accel); 1002 return GetWidget()->GetAccelerator(id, accel);
985 } 1003 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698