| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 | 305 |
| 306 // Mask out the top right corner. | 306 // Mask out the top right corner. |
| 307 int right_x = | 307 int right_x = |
| 308 x + w + kContentEdgeShadowThickness - toolbar_right_mask->width(); | 308 x + w + kContentEdgeShadowThickness - toolbar_right_mask->width(); |
| 309 canvas->DrawBitmapInt(*toolbar_right_mask, right_x, y, paint); | 309 canvas->DrawBitmapInt(*toolbar_right_mask, right_x, y, paint); |
| 310 | 310 |
| 311 // Draw left edge. | 311 // Draw left edge. |
| 312 canvas->DrawBitmapInt(*toolbar_left, left_x, y); | 312 canvas->DrawBitmapInt(*toolbar_left, left_x, y); |
| 313 | 313 |
| 314 // Draw center edge. | 314 // Draw center edge. |
| 315 canvas->TileImageInt(*toolbar_center, left_x + toolbar_left->width(), y, | 315 canvas->TileImage(*toolbar_center, gfx::Rect(left_x + toolbar_left->width(), |
| 316 right_x - (left_x + toolbar_left->width()), toolbar_center->height()); | 316 y, 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(gfx::Rect(x + kClientEdgeThickness, | 323 canvas->FillRect(gfx::Rect(x + kClientEdgeThickness, |
| 324 toolbar_bounds.bottom() - kClientEdgeThickness, | 324 toolbar_bounds.bottom() - kClientEdgeThickness, |
| 325 w - (2 * kClientEdgeThickness), | 325 w - (2 * kClientEdgeThickness), |
| 326 kClientEdgeThickness), | 326 kClientEdgeThickness), |
| 327 ThemeService::GetDefaultColor(ThemeService::COLOR_TOOLBAR_SEPARATOR)); | 327 ThemeService::GetDefaultColor(ThemeService::COLOR_TOOLBAR_SEPARATOR)); |
| 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() + |
| 338 tp->GetBitmapNamed(IDR_CONTENT_TOP_LEFT_CORNER)->height(); | 338 tp->GetBitmapNamed(IDR_CONTENT_TOP_LEFT_CORNER)->height(); |
| 339 int client_area_bottom = | 339 int client_area_bottom = |
| 340 std::max(client_area_top, height() - NonClientBorderThickness()); | 340 std::max(client_area_top, height() - NonClientBorderThickness()); |
| 341 int client_area_height = client_area_bottom - client_area_top; | 341 int client_area_height = client_area_bottom - client_area_top; |
| 342 | 342 |
| 343 // Draw the client edge images. | 343 // Draw the client edge images. |
| 344 SkBitmap* right = tp->GetBitmapNamed(IDR_CONTENT_RIGHT_SIDE); | 344 SkBitmap* right = tp->GetBitmapNamed(IDR_CONTENT_RIGHT_SIDE); |
| 345 canvas->TileImageInt(*right, client_area_bounds.right(), client_area_top, | 345 canvas->TileImage(*right, gfx::Rect(client_area_bounds.right(), |
| 346 right->width(), client_area_height); | 346 client_area_top, right->width(), client_area_height)); |
| 347 canvas->DrawBitmapInt( | 347 canvas->DrawBitmapInt( |
| 348 *tp->GetBitmapNamed(IDR_CONTENT_BOTTOM_RIGHT_CORNER), | 348 *tp->GetBitmapNamed(IDR_CONTENT_BOTTOM_RIGHT_CORNER), |
| 349 client_area_bounds.right(), client_area_bottom); | 349 client_area_bounds.right(), client_area_bottom); |
| 350 SkBitmap* bottom = tp->GetBitmapNamed(IDR_CONTENT_BOTTOM_CENTER); | 350 SkBitmap* bottom = tp->GetBitmapNamed(IDR_CONTENT_BOTTOM_CENTER); |
| 351 canvas->TileImageInt(*bottom, client_area_bounds.x(), | 351 canvas->TileImage(*bottom, gfx::Rect(client_area_bounds.x(), |
| 352 client_area_bottom, client_area_bounds.width(), | 352 client_area_bottom, client_area_bounds.width(), bottom->height()); |
| 353 bottom->height()); | 353 SkBitmap* bottom_left = tp->GetBitmapNamed(IDR_CONTENT_BOTTOM_LEFT_CORNER); |
| 354 SkBitmap* bottom_left = | |
| 355 tp->GetBitmapNamed(IDR_CONTENT_BOTTOM_LEFT_CORNER); | |
| 356 canvas->DrawBitmapInt(*bottom_left, | 354 canvas->DrawBitmapInt(*bottom_left, |
| 357 client_area_bounds.x() - bottom_left->width(), client_area_bottom); | 355 client_area_bounds.x() - bottom_left->width(), client_area_bottom); |
| 358 SkBitmap* left = tp->GetBitmapNamed(IDR_CONTENT_LEFT_SIDE); | 356 SkBitmap* left = tp->GetBitmapNamed(IDR_CONTENT_LEFT_SIDE); |
| 359 canvas->TileImageInt(*left, client_area_bounds.x() - left->width(), | 357 canvas->TileImage(*left, gfx::Rect(client_area_bounds.x() - left->width(), |
| 360 client_area_top, left->width(), client_area_height); | 358 client_area_top, left->width(), client_area_height)); |
| 361 | 359 |
| 362 // Draw the toolbar color so that the client edges show the right color even | 360 // 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 | 361 // 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 | 362 // 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. | 363 // these rects are meant to be fully opaque, without anything overlaid. |
| 366 SkColor toolbar_color = tp->GetColor(ThemeService::COLOR_TOOLBAR); | 364 SkColor toolbar_color = tp->GetColor(ThemeService::COLOR_TOOLBAR); |
| 367 canvas->FillRect(gfx::Rect(client_area_bounds.x() - kClientEdgeThickness, | 365 canvas->FillRect(gfx::Rect(client_area_bounds.x() - kClientEdgeThickness, |
| 368 client_area_top, kClientEdgeThickness, | 366 client_area_top, kClientEdgeThickness, |
| 369 client_area_bottom + kClientEdgeThickness - client_area_top), | 367 client_area_bottom + kClientEdgeThickness - client_area_top), |
| 370 toolbar_color); | 368 toolbar_color); |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 static bool initialized = false; | 490 static bool initialized = false; |
| 493 if (!initialized) { | 491 if (!initialized) { |
| 494 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 492 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 495 for (int i = 0; i < kThrobberIconCount; ++i) { | 493 for (int i = 0; i < kThrobberIconCount; ++i) { |
| 496 throbber_icons_[i] = rb.LoadThemeIcon(IDI_THROBBER_01 + i); | 494 throbber_icons_[i] = rb.LoadThemeIcon(IDI_THROBBER_01 + i); |
| 497 DCHECK(throbber_icons_[i]); | 495 DCHECK(throbber_icons_[i]); |
| 498 } | 496 } |
| 499 initialized = true; | 497 initialized = true; |
| 500 } | 498 } |
| 501 } | 499 } |
| OLD | NEW |