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/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 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 if (ShouldPaintAsActive()) { | 333 if (ShouldPaintAsActive()) { |
334 theme_frame = rb.GetBitmapNamed(IDR_FRAME_APP_PANEL); | 334 theme_frame = rb.GetBitmapNamed(IDR_FRAME_APP_PANEL); |
335 frame_color = ResourceBundle::frame_color_app_panel; | 335 frame_color = ResourceBundle::frame_color_app_panel; |
336 } else { | 336 } else { |
337 theme_frame = rb.GetBitmapNamed(IDR_FRAME_APP_PANEL); // TODO | 337 theme_frame = rb.GetBitmapNamed(IDR_FRAME_APP_PANEL); // TODO |
338 frame_color = ResourceBundle::frame_color_app_panel_inactive; | 338 frame_color = ResourceBundle::frame_color_app_panel_inactive; |
339 } | 339 } |
340 | 340 |
341 // Fill with the frame color first so we have a constant background for | 341 // Fill with the frame color first so we have a constant background for |
342 // areas not covered by the theme image. | 342 // areas not covered by the theme image. |
343 canvas->FillRectInt(frame_color, 0, 0, width(), theme_frame->height()); | 343 canvas->FillRect(frame_color, |
344 // Now fill down the sides. | 344 gfx::Rect(0, 0, width(), theme_frame->height())); |
345 canvas->FillRectInt(frame_color, 0, theme_frame->height(), left_edge->width(), | 345 |
346 height() - theme_frame->height()); | 346 int remaining_height = height() - theme_frame->height(); |
347 canvas->FillRectInt(frame_color, width() - right_edge->width(), | 347 if (remaining_height > 0) { |
348 theme_frame->height(), right_edge->width(), | 348 // Now fill down the sides. |
349 height() - theme_frame->height()); | 349 canvas->FillRect(frame_color, |
350 // Now fill the bottom area. | 350 gfx::Rect(0, theme_frame->height(), left_edge->width(), |
351 canvas->FillRectInt(frame_color, left_edge->width(), | 351 remaining_height)); |
352 height() - bottom_edge->height(), | 352 canvas->FillRect(frame_color, |
353 width() - left_edge->width() - right_edge->width(), | 353 gfx::Rect(width() - right_edge->width(), |
354 bottom_edge->height()); | 354 theme_frame->height(), right_edge->width(), |
| 355 remaining_height)); |
| 356 int center_width = width() - left_edge->width() - right_edge->width(); |
| 357 if (center_width > 0) { |
| 358 // Now fill the bottom area. |
| 359 canvas->FillRect(frame_color, |
| 360 gfx::Rect(left_edge->width(), |
| 361 height() - bottom_edge->height(), |
| 362 center_width, bottom_edge->height())); |
| 363 } |
| 364 } |
355 | 365 |
356 // Draw the theme frame. | 366 // Draw the theme frame. |
357 canvas->TileImageInt(*theme_frame, 0, 0, width(), theme_frame->height()); | 367 canvas->TileImageInt(*theme_frame, 0, 0, width(), theme_frame->height()); |
358 | 368 |
359 // Top. | 369 // Top. |
360 canvas->DrawBitmapInt(*top_left_corner, 0, 0); | 370 canvas->DrawBitmapInt(*top_left_corner, 0, 0); |
361 canvas->TileImageInt(*top_edge, top_left_corner->width(), 0, | 371 canvas->TileImageInt(*top_edge, top_left_corner->width(), 0, |
362 width() - top_right_corner->width(), top_edge->height()); | 372 width() - top_right_corner->width(), top_edge->height()); |
363 canvas->DrawBitmapInt(*top_right_corner, | 373 canvas->DrawBitmapInt(*top_right_corner, |
364 width() - top_right_corner->width(), 0); | 374 width() - top_right_corner->width(), 0); |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 } | 509 } |
500 | 510 |
501 gfx::Rect AppPanelBrowserFrameView::CalculateClientAreaBounds(int width, | 511 gfx::Rect AppPanelBrowserFrameView::CalculateClientAreaBounds(int width, |
502 int height) const { | 512 int height) const { |
503 int top_height = NonClientTopBorderHeight(); | 513 int top_height = NonClientTopBorderHeight(); |
504 int border_thickness = NonClientBorderThickness(); | 514 int border_thickness = NonClientBorderThickness(); |
505 return gfx::Rect(border_thickness, top_height, | 515 return gfx::Rect(border_thickness, top_height, |
506 std::max(0, width - (2 * border_thickness)), | 516 std::max(0, width - (2 * border_thickness)), |
507 std::max(0, height - top_height - border_thickness)); | 517 std::max(0, height - top_height - border_thickness)); |
508 } | 518 } |
OLD | NEW |