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/opaque_browser_frame_view.h" | 5 #include "chrome/browser/ui/views/frame/opaque_browser_frame_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 | 456 |
457 views::ImageButton* OpaqueBrowserFrameView::InitWindowCaptionButton( | 457 views::ImageButton* OpaqueBrowserFrameView::InitWindowCaptionButton( |
458 int normal_bitmap_id, | 458 int normal_bitmap_id, |
459 int hot_bitmap_id, | 459 int hot_bitmap_id, |
460 int pushed_bitmap_id, | 460 int pushed_bitmap_id, |
461 int mask_bitmap_id, | 461 int mask_bitmap_id, |
462 int accessibility_string_id) { | 462 int accessibility_string_id) { |
463 views::ImageButton* button = new views::ImageButton(this); | 463 views::ImageButton* button = new views::ImageButton(this); |
464 ui::ThemeProvider* tp = frame()->GetThemeProvider(); | 464 ui::ThemeProvider* tp = frame()->GetThemeProvider(); |
465 button->SetImage(views::CustomButton::BS_NORMAL, | 465 button->SetImage(views::CustomButton::BS_NORMAL, |
466 tp->GetBitmapNamed(normal_bitmap_id)); | 466 tp->GetImageSkiaNamed(normal_bitmap_id)); |
467 button->SetImage(views::CustomButton::BS_HOT, | 467 button->SetImage(views::CustomButton::BS_HOT, |
468 tp->GetBitmapNamed(hot_bitmap_id)); | 468 tp->GetImageSkiaNamed(hot_bitmap_id)); |
469 button->SetImage(views::CustomButton::BS_PUSHED, | 469 button->SetImage(views::CustomButton::BS_PUSHED, |
470 tp->GetBitmapNamed(pushed_bitmap_id)); | 470 tp->GetImageSkiaNamed(pushed_bitmap_id)); |
471 if (browser_view()->IsBrowserTypeNormal()) { | 471 if (browser_view()->IsBrowserTypeNormal()) { |
472 button->SetBackground( | 472 button->SetBackground( |
473 tp->GetColor(ThemeService::COLOR_BUTTON_BACKGROUND), | 473 tp->GetColor(ThemeService::COLOR_BUTTON_BACKGROUND), |
474 tp->GetBitmapNamed(IDR_THEME_WINDOW_CONTROL_BACKGROUND), | 474 tp->GetImageSkiaNamed(IDR_THEME_WINDOW_CONTROL_BACKGROUND), |
475 tp->GetBitmapNamed(mask_bitmap_id)); | 475 tp->GetImageSkiaNamed(mask_bitmap_id)); |
476 } | 476 } |
477 button->SetAccessibleName( | 477 button->SetAccessibleName( |
478 l10n_util::GetStringUTF16(accessibility_string_id)); | 478 l10n_util::GetStringUTF16(accessibility_string_id)); |
479 AddChildView(button); | 479 AddChildView(button); |
480 return button; | 480 return button; |
481 } | 481 } |
482 | 482 |
483 int OpaqueBrowserFrameView::FrameBorderThickness(bool restored) const { | 483 int OpaqueBrowserFrameView::FrameBorderThickness(bool restored) const { |
484 return (!restored && (frame()->IsMaximized() || frame()->IsFullscreen())) ? | 484 return (!restored && (frame()->IsMaximized() || frame()->IsFullscreen())) ? |
485 0 : kFrameBorderThickness; | 485 0 : kFrameBorderThickness; |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
968 | 968 |
969 gfx::Rect OpaqueBrowserFrameView::CalculateClientAreaBounds(int width, | 969 gfx::Rect OpaqueBrowserFrameView::CalculateClientAreaBounds(int width, |
970 int height) const { | 970 int height) const { |
971 int top_height = NonClientTopBorderHeight(false); | 971 int top_height = NonClientTopBorderHeight(false); |
972 int border_thickness = NonClientBorderThickness(); | 972 int border_thickness = NonClientBorderThickness(); |
973 return gfx::Rect(border_thickness, top_height, | 973 return gfx::Rect(border_thickness, top_height, |
974 std::max(0, width - (2 * border_thickness)), | 974 std::max(0, width - (2 * border_thickness)), |
975 std::max(0, height - GetReservedHeight() - | 975 std::max(0, height - GetReservedHeight() - |
976 top_height - border_thickness)); | 976 top_height - border_thickness)); |
977 } | 977 } |
OLD | NEW |