OLD | NEW |
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/frame/glass_browser_frame_view.h" | 5 #include "chrome/browser/ui/views/frame/glass_browser_frame_view.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
10 #include "chrome/app/chrome_dll_resource.h" | 10 #include "chrome/app/chrome_dll_resource.h" |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 | 313 |
314 // Draw center edge. | 314 // Draw center edge. |
315 canvas->TileImageInt(*toolbar_center, left_x + toolbar_left->width(), y, | 315 canvas->TileImageInt(*toolbar_center, left_x + toolbar_left->width(), y, |
316 right_x - (left_x + toolbar_left->width()), toolbar_center->height()); | 316 right_x - (left_x + toolbar_left->width()), toolbar_center->height()); |
317 | 317 |
318 // Right edge. | 318 // Right edge. |
319 canvas->DrawBitmapInt(*tp->GetBitmapNamed(IDR_CONTENT_TOP_RIGHT_CORNER), | 319 canvas->DrawBitmapInt(*tp->GetBitmapNamed(IDR_CONTENT_TOP_RIGHT_CORNER), |
320 right_x, y); | 320 right_x, y); |
321 | 321 |
322 // Draw the content/toolbar separator. | 322 // Draw the content/toolbar separator. |
323 canvas->FillRect(ResourceBundle::toolbar_separator_color, | 323 canvas->FillRect(gfx::Rect(x + kClientEdgeThickness, |
324 gfx::Rect(x + kClientEdgeThickness, | 324 toolbar_bounds.bottom() - kClientEdgeThickness, |
325 toolbar_bounds.bottom() - kClientEdgeThickness, | 325 w - (2 * kClientEdgeThickness), |
326 w - (2 * kClientEdgeThickness), | 326 kClientEdgeThickness), |
327 kClientEdgeThickness)); | 327 ResourceBundle::toolbar_separator_color); |
328 } | 328 } |
329 | 329 |
330 void GlassBrowserFrameView::PaintRestoredClientEdge(gfx::Canvas* canvas) { | 330 void GlassBrowserFrameView::PaintRestoredClientEdge(gfx::Canvas* canvas) { |
331 ui::ThemeProvider* tp = GetThemeProvider(); | 331 ui::ThemeProvider* tp = GetThemeProvider(); |
332 gfx::Rect client_area_bounds = CalculateClientAreaBounds(width(), height()); | 332 gfx::Rect client_area_bounds = CalculateClientAreaBounds(width(), height()); |
333 | 333 |
334 // The client edges start below the toolbar upper corner images regardless | 334 // The client edges start below the toolbar upper corner images regardless |
335 // of how tall the toolbar itself is. | 335 // of how tall the toolbar itself is. |
336 int client_area_top = frame()->client_view()->y() + | 336 int client_area_top = frame()->client_view()->y() + |
337 browser_view()->GetToolbarBounds().y() + | 337 browser_view()->GetToolbarBounds().y() + |
(...skipping 19 matching lines...) Expand all Loading... |
357 client_area_bounds.x() - bottom_left->width(), client_area_bottom); | 357 client_area_bounds.x() - bottom_left->width(), client_area_bottom); |
358 SkBitmap* left = tp->GetBitmapNamed(IDR_CONTENT_LEFT_SIDE); | 358 SkBitmap* left = tp->GetBitmapNamed(IDR_CONTENT_LEFT_SIDE); |
359 canvas->TileImageInt(*left, client_area_bounds.x() - left->width(), | 359 canvas->TileImageInt(*left, client_area_bounds.x() - left->width(), |
360 client_area_top, left->width(), client_area_height); | 360 client_area_top, left->width(), client_area_height); |
361 | 361 |
362 // Draw the toolbar color so that the client edges show the right color even | 362 // Draw the toolbar color so that the client edges show the right color even |
363 // where not covered by the toolbar image. NOTE: We do this after drawing the | 363 // where not covered by the toolbar image. NOTE: We do this after drawing the |
364 // images because the images are meant to alpha-blend atop the frame whereas | 364 // images because the images are meant to alpha-blend atop the frame whereas |
365 // these rects are meant to be fully opaque, without anything overlaid. | 365 // these rects are meant to be fully opaque, without anything overlaid. |
366 SkColor toolbar_color = tp->GetColor(ThemeService::COLOR_TOOLBAR); | 366 SkColor toolbar_color = tp->GetColor(ThemeService::COLOR_TOOLBAR); |
367 canvas->FillRect(toolbar_color, | 367 canvas->FillRect(gfx::Rect(client_area_bounds.x() - kClientEdgeThickness, |
368 gfx::Rect(client_area_bounds.x() - kClientEdgeThickness, client_area_top, | 368 client_area_top, kClientEdgeThickness, |
369 kClientEdgeThickness, | 369 client_area_bottom + kClientEdgeThickness - client_area_top), |
370 client_area_bottom + kClientEdgeThickness - client_area_top)); | 370 toolbar_color); |
371 canvas->FillRect(toolbar_color, | 371 canvas->FillRect(gfx::Rect(client_area_bounds.x(), client_area_bottom, |
372 gfx::Rect(client_area_bounds.x(), client_area_bottom, | 372 client_area_bounds.width(), kClientEdgeThickness), |
373 client_area_bounds.width(), kClientEdgeThickness)); | 373 toolbar_color); |
374 canvas->FillRect(toolbar_color, gfx::Rect(client_area_bounds.right(), | 374 canvas->FillRect(gfx::Rect(client_area_bounds.right(), client_area_top, |
375 client_area_top, kClientEdgeThickness, | 375 kClientEdgeThickness, |
376 client_area_bottom + kClientEdgeThickness - client_area_top)); | 376 client_area_bottom + kClientEdgeThickness - client_area_top), |
| 377 toolbar_color); |
377 } | 378 } |
378 | 379 |
379 void GlassBrowserFrameView::LayoutAvatar() { | 380 void GlassBrowserFrameView::LayoutAvatar() { |
380 // Even though the avatar is used for both incognito and profiles we always | 381 // Even though the avatar is used for both incognito and profiles we always |
381 // use the incognito icon to layout the avatar button. The profile icon | 382 // use the incognito icon to layout the avatar button. The profile icon |
382 // can be customized so we can't depend on its size to perform layout. | 383 // can be customized so we can't depend on its size to perform layout. |
383 SkBitmap incognito_icon = browser_view()->GetOTRAvatarIcon(); | 384 SkBitmap incognito_icon = browser_view()->GetOTRAvatarIcon(); |
384 | 385 |
385 int avatar_x = NonClientBorderThickness() + kAvatarSideSpacing; | 386 int avatar_x = NonClientBorderThickness() + kAvatarSideSpacing; |
386 // Move this avatar icon by the size of window controls to prevent it from | 387 // Move this avatar icon by the size of window controls to prevent it from |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 static bool initialized = false; | 492 static bool initialized = false; |
492 if (!initialized) { | 493 if (!initialized) { |
493 ResourceBundle &rb = ResourceBundle::GetSharedInstance(); | 494 ResourceBundle &rb = ResourceBundle::GetSharedInstance(); |
494 for (int i = 0; i < kThrobberIconCount; ++i) { | 495 for (int i = 0; i < kThrobberIconCount; ++i) { |
495 throbber_icons_[i] = rb.LoadThemeIcon(IDI_THROBBER_01 + i); | 496 throbber_icons_[i] = rb.LoadThemeIcon(IDI_THROBBER_01 + i); |
496 DCHECK(throbber_icons_[i]); | 497 DCHECK(throbber_icons_[i]); |
497 } | 498 } |
498 initialized = true; | 499 initialized = true; |
499 } | 500 } |
500 } | 501 } |
OLD | NEW |