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" |
11 #include "content/public/browser/web_contents.h" | 11 #include "content/public/browser/web_contents.h" |
12 #include "grit/chromium_strings.h" | 12 #include "grit/chromium_strings.h" |
13 #include "grit/generated_resources.h" | 13 #include "grit/generated_resources.h" |
14 #include "grit/theme_resources_standard.h" | 14 #include "grit/theme_resources_standard.h" |
15 #include "grit/ui_resources.h" | 15 #include "grit/ui_resources.h" |
16 #include "grit/ui_resources_standard.h" | 16 #include "grit/ui_resources_standard.h" |
17 #include "ui/base/hit_test.h" | 17 #include "ui/base/hit_test.h" |
18 #include "ui/base/l10n/l10n_util.h" | 18 #include "ui/base/l10n/l10n_util.h" |
19 #include "ui/base/resource/resource_bundle.h" | 19 #include "ui/base/resource/resource_bundle.h" |
20 #include "ui/gfx/canvas.h" | 20 #include "ui/gfx/canvas.h" |
21 #include "ui/gfx/font.h" | 21 #include "ui/gfx/font.h" |
22 #include "ui/gfx/path.h" | 22 #include "ui/gfx/path.h" |
| 23 #include "ui/views/color_constants.h" |
23 #include "ui/views/controls/button/image_button.h" | 24 #include "ui/views/controls/button/image_button.h" |
24 #include "ui/views/widget/widget.h" | 25 #include "ui/views/widget/widget.h" |
25 #include "ui/views/widget/widget_delegate.h" | 26 #include "ui/views/widget/widget_delegate.h" |
26 | 27 |
27 using content::WebContents; | 28 using content::WebContents; |
28 | 29 |
29 namespace { | 30 namespace { |
30 | 31 |
31 // The frame border is only visible in restored mode and is hardcoded to 1 px on | 32 // The frame border is only visible in restored mode and is hardcoded to 1 px on |
32 // each side regardless of the system window border size. | 33 // each side regardless of the system window border size. |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 client_area_bottom); | 448 client_area_bottom); |
448 canvas->TileImageInt(*bottom, client_area_bounds.x(), client_area_bottom, | 449 canvas->TileImageInt(*bottom, client_area_bounds.x(), client_area_bottom, |
449 client_area_bounds.width(), bottom_right->height()); | 450 client_area_bounds.width(), bottom_right->height()); |
450 canvas->DrawBitmapInt(*bottom_left, | 451 canvas->DrawBitmapInt(*bottom_left, |
451 client_area_bounds.x() - bottom_left->width(), client_area_bottom); | 452 client_area_bounds.x() - bottom_left->width(), client_area_bottom); |
452 | 453 |
453 // Left. | 454 // Left. |
454 canvas->TileImageInt(*left, client_area_bounds.x() - left->width(), | 455 canvas->TileImageInt(*left, client_area_bounds.x() - left->width(), |
455 client_area_top, left->width(), client_area_height); | 456 client_area_top, left->width(), client_area_height); |
456 | 457 |
457 // Draw the toolbar color to fill in the edges. | 458 // Draw the color to fill in the edges. |
458 canvas->DrawRect(gfx::Rect( | 459 canvas->DrawRect(gfx::Rect( |
459 client_area_bounds.x() - kClientEdgeThickness, | 460 client_area_bounds.x() - kClientEdgeThickness, |
460 client_area_top - kClientEdgeThickness, | 461 client_area_top - kClientEdgeThickness, |
461 client_area_bounds.width() + kClientEdgeThickness, | 462 client_area_bounds.width() + kClientEdgeThickness, |
462 client_area_bottom - client_area_top + kClientEdgeThickness), | 463 client_area_bottom - client_area_top + kClientEdgeThickness), |
463 ResourceBundle::toolbar_color); | 464 views::kClientEdgeColor); |
464 } | 465 } |
465 | 466 |
466 void AppPanelBrowserFrameView::LayoutWindowControls() { | 467 void AppPanelBrowserFrameView::LayoutWindowControls() { |
467 close_button_->SetImageAlignment(views::ImageButton::ALIGN_LEFT, | 468 close_button_->SetImageAlignment(views::ImageButton::ALIGN_LEFT, |
468 views::ImageButton::ALIGN_BOTTOM); | 469 views::ImageButton::ALIGN_BOTTOM); |
469 bool is_maximized = frame()->IsMaximized(); | 470 bool is_maximized = frame()->IsMaximized(); |
470 // There should always be the same number of non-border pixels visible to the | 471 // There should always be the same number of non-border pixels visible to the |
471 // side of the close button. In maximized mode we extend the button to the | 472 // side of the close button. In maximized mode we extend the button to the |
472 // screen corner to obey Fitts' Law. | 473 // screen corner to obey Fitts' Law. |
473 int right_extra_width = is_maximized ? kCloseButtonFrameBorderSpacing : 0; | 474 int right_extra_width = is_maximized ? kCloseButtonFrameBorderSpacing : 0; |
(...skipping 28 matching lines...) Expand all Loading... |
502 } | 503 } |
503 | 504 |
504 gfx::Rect AppPanelBrowserFrameView::CalculateClientAreaBounds(int width, | 505 gfx::Rect AppPanelBrowserFrameView::CalculateClientAreaBounds(int width, |
505 int height) const { | 506 int height) const { |
506 int top_height = NonClientTopBorderHeight(); | 507 int top_height = NonClientTopBorderHeight(); |
507 int border_thickness = NonClientBorderThickness(); | 508 int border_thickness = NonClientBorderThickness(); |
508 return gfx::Rect(border_thickness, top_height, | 509 return gfx::Rect(border_thickness, top_height, |
509 std::max(0, width - (2 * border_thickness)), | 510 std::max(0, width - (2 * border_thickness)), |
510 std::max(0, height - top_height - border_thickness)); | 511 std::max(0, height - top_height - border_thickness)); |
511 } | 512 } |
OLD | NEW |