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/app_panel_browser_frame_view.h" | 5 #include "chrome/browser/ui/views/frame/app_panel_browser_frame_view.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/browser/ui/views/frame/browser_frame.h" | 9 #include "chrome/browser/ui/views/frame/browser_frame.h" |
10 #include "chrome/browser/ui/views/frame/browser_view.h" | 10 #include "chrome/browser/ui/views/frame/browser_view.h" |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 if (ShouldPaintAsActive()) { | 328 if (ShouldPaintAsActive()) { |
329 theme_frame = rb.GetBitmapNamed(IDR_FRAME_APP_PANEL); | 329 theme_frame = rb.GetBitmapNamed(IDR_FRAME_APP_PANEL); |
330 frame_color = kFrameColorAppPanel; | 330 frame_color = kFrameColorAppPanel; |
331 } else { | 331 } else { |
332 theme_frame = rb.GetBitmapNamed(IDR_FRAME_APP_PANEL); | 332 theme_frame = rb.GetBitmapNamed(IDR_FRAME_APP_PANEL); |
333 frame_color = kFrameColorAppPanelInactive; | 333 frame_color = kFrameColorAppPanelInactive; |
334 } | 334 } |
335 | 335 |
336 // Fill with the frame color first so we have a constant background for | 336 // Fill with the frame color first so we have a constant background for |
337 // areas not covered by the theme image. | 337 // areas not covered by the theme image. |
338 canvas->FillRect(frame_color, | 338 canvas->FillRect(gfx::Rect(0, 0, width(), theme_frame->height()), |
339 gfx::Rect(0, 0, width(), theme_frame->height())); | 339 frame_color); |
340 | 340 |
341 int remaining_height = height() - theme_frame->height(); | 341 int remaining_height = height() - theme_frame->height(); |
342 if (remaining_height > 0) { | 342 if (remaining_height > 0) { |
343 // Now fill down the sides. | 343 // Now fill down the sides. |
344 canvas->FillRect(frame_color, | 344 canvas->FillRect(gfx::Rect(0, theme_frame->height(), left_edge->width(), |
345 gfx::Rect(0, theme_frame->height(), left_edge->width(), | 345 remaining_height), frame_color); |
346 remaining_height)); | 346 canvas->FillRect(gfx::Rect(width() - right_edge->width(), |
347 canvas->FillRect(frame_color, | |
348 gfx::Rect(width() - right_edge->width(), | |
349 theme_frame->height(), right_edge->width(), | 347 theme_frame->height(), right_edge->width(), |
350 remaining_height)); | 348 remaining_height), frame_color); |
351 int center_width = width() - left_edge->width() - right_edge->width(); | 349 int center_width = width() - left_edge->width() - right_edge->width(); |
352 if (center_width > 0) { | 350 if (center_width > 0) { |
353 // Now fill the bottom area. | 351 // Now fill the bottom area. |
354 canvas->FillRect(frame_color, | 352 canvas->FillRect(gfx::Rect(left_edge->width(), |
355 gfx::Rect(left_edge->width(), | 353 height() - bottom_edge->height(), center_width, |
356 height() - bottom_edge->height(), | 354 bottom_edge->height()), frame_color); |
357 center_width, bottom_edge->height())); | |
358 } | 355 } |
359 } | 356 } |
360 | 357 |
361 // Draw the theme frame. | 358 // Draw the theme frame. |
362 canvas->TileImageInt(*theme_frame, 0, 0, width(), theme_frame->height()); | 359 canvas->TileImageInt(*theme_frame, 0, 0, width(), theme_frame->height()); |
363 | 360 |
364 // Top. | 361 // Top. |
365 canvas->DrawBitmapInt(*top_left_corner, 0, 0); | 362 canvas->DrawBitmapInt(*top_left_corner, 0, 0); |
366 canvas->TileImageInt(*top_edge, top_left_corner->width(), 0, | 363 canvas->TileImageInt(*top_edge, top_left_corner->width(), 0, |
367 width() - top_right_corner->width(), top_edge->height()); | 364 width() - top_right_corner->width(), top_edge->height()); |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 } | 502 } |
506 | 503 |
507 gfx::Rect AppPanelBrowserFrameView::CalculateClientAreaBounds(int width, | 504 gfx::Rect AppPanelBrowserFrameView::CalculateClientAreaBounds(int width, |
508 int height) const { | 505 int height) const { |
509 int top_height = NonClientTopBorderHeight(); | 506 int top_height = NonClientTopBorderHeight(); |
510 int border_thickness = NonClientBorderThickness(); | 507 int border_thickness = NonClientBorderThickness(); |
511 return gfx::Rect(border_thickness, top_height, | 508 return gfx::Rect(border_thickness, top_height, |
512 std::max(0, width - (2 * border_thickness)), | 509 std::max(0, width - (2 * border_thickness)), |
513 std::max(0, height - top_height - border_thickness)); | 510 std::max(0, height - top_height - border_thickness)); |
514 } | 511 } |
OLD | NEW |