| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 BrowserView* browser_view) | 58 BrowserView* browser_view) |
| 59 : BrowserNonClientFrameView(), | 59 : BrowserNonClientFrameView(), |
| 60 ALLOW_THIS_IN_INITIALIZER_LIST( | 60 ALLOW_THIS_IN_INITIALIZER_LIST( |
| 61 close_button_(new views::ImageButton(this))), | 61 close_button_(new views::ImageButton(this))), |
| 62 window_icon_(NULL), | 62 window_icon_(NULL), |
| 63 frame_(frame), | 63 frame_(frame), |
| 64 browser_view_(browser_view) { | 64 browser_view_(browser_view) { |
| 65 DCHECK(browser_view->ShouldShowWindowIcon()); | 65 DCHECK(browser_view->ShouldShowWindowIcon()); |
| 66 DCHECK(browser_view->ShouldShowWindowTitle()); | 66 DCHECK(browser_view->ShouldShowWindowTitle()); |
| 67 | 67 |
| 68 frame_->set_frame_type(views::Window::FRAME_TYPE_FORCE_CUSTOM); | |
| 69 | |
| 70 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 68 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 71 close_button_->SetImage(views::CustomButton::BS_NORMAL, | 69 close_button_->SetImage(views::CustomButton::BS_NORMAL, |
| 72 rb.GetBitmapNamed(IDR_CLOSE_BAR)); | 70 rb.GetBitmapNamed(IDR_CLOSE_BAR)); |
| 73 close_button_->SetImage(views::CustomButton::BS_HOT, | 71 close_button_->SetImage(views::CustomButton::BS_HOT, |
| 74 rb.GetBitmapNamed(IDR_CLOSE_BAR_H)); | 72 rb.GetBitmapNamed(IDR_CLOSE_BAR_H)); |
| 75 close_button_->SetImage(views::CustomButton::BS_PUSHED, | 73 close_button_->SetImage(views::CustomButton::BS_PUSHED, |
| 76 rb.GetBitmapNamed(IDR_CLOSE_BAR_P)); | 74 rb.GetBitmapNamed(IDR_CLOSE_BAR_P)); |
| 77 close_button_->SetAccessibleName( | 75 close_button_->SetAccessibleName( |
| 78 l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE)); | 76 l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE)); |
| 79 AddChildView(close_button_); | 77 AddChildView(close_button_); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 return min_size; | 117 return min_size; |
| 120 } | 118 } |
| 121 | 119 |
| 122 /////////////////////////////////////////////////////////////////////////////// | 120 /////////////////////////////////////////////////////////////////////////////// |
| 123 // AppPanelBrowserFrameView, views::NonClientFrameView implementation: | 121 // AppPanelBrowserFrameView, views::NonClientFrameView implementation: |
| 124 | 122 |
| 125 gfx::Rect AppPanelBrowserFrameView::GetBoundsForClientView() const { | 123 gfx::Rect AppPanelBrowserFrameView::GetBoundsForClientView() const { |
| 126 return client_view_bounds_; | 124 return client_view_bounds_; |
| 127 } | 125 } |
| 128 | 126 |
| 127 bool AppPanelBrowserFrameView::AlwaysUseCustomFrame() const { |
| 128 return true; |
| 129 } |
| 130 |
| 131 bool AppPanelBrowserFrameView::AlwaysUseNativeFrame() const { |
| 132 return frame_->AlwaysUseNativeFrame(); |
| 133 } |
| 134 |
| 129 gfx::Rect AppPanelBrowserFrameView::GetWindowBoundsForClientBounds( | 135 gfx::Rect AppPanelBrowserFrameView::GetWindowBoundsForClientBounds( |
| 130 const gfx::Rect& client_bounds) const { | 136 const gfx::Rect& client_bounds) const { |
| 131 int top_height = NonClientTopBorderHeight(); | 137 int top_height = NonClientTopBorderHeight(); |
| 132 int border_thickness = NonClientBorderThickness(); | 138 int border_thickness = NonClientBorderThickness(); |
| 133 return gfx::Rect(std::max(0, client_bounds.x() - border_thickness), | 139 return gfx::Rect(std::max(0, client_bounds.x() - border_thickness), |
| 134 std::max(0, client_bounds.y() - top_height), | 140 std::max(0, client_bounds.y() - top_height), |
| 135 client_bounds.width() + (2 * border_thickness), | 141 client_bounds.width() + (2 * border_thickness), |
| 136 client_bounds.height() + top_height + border_thickness); | 142 client_bounds.height() + top_height + border_thickness); |
| 137 } | 143 } |
| 138 | 144 |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 } | 501 } |
| 496 | 502 |
| 497 gfx::Rect AppPanelBrowserFrameView::CalculateClientAreaBounds(int width, | 503 gfx::Rect AppPanelBrowserFrameView::CalculateClientAreaBounds(int width, |
| 498 int height) const { | 504 int height) const { |
| 499 int top_height = NonClientTopBorderHeight(); | 505 int top_height = NonClientTopBorderHeight(); |
| 500 int border_thickness = NonClientBorderThickness(); | 506 int border_thickness = NonClientBorderThickness(); |
| 501 return gfx::Rect(border_thickness, top_height, | 507 return gfx::Rect(border_thickness, top_height, |
| 502 std::max(0, width - (2 * border_thickness)), | 508 std::max(0, width - (2 * border_thickness)), |
| 503 std::max(0, height - top_height - border_thickness)); | 509 std::max(0, height - top_height - border_thickness)); |
| 504 } | 510 } |
| OLD | NEW |