| 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/opaque_browser_frame_view.h" | 5 #include "chrome/browser/ui/views/frame/opaque_browser_frame_view.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
| 9 #include "app/theme_provider.h" | 9 #include "app/theme_provider.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 tp->GetBitmapNamed(IDR_MINIMIZE)); | 115 tp->GetBitmapNamed(IDR_MINIMIZE)); |
| 116 minimize_button_->SetImage(views::CustomButton::BS_HOT, | 116 minimize_button_->SetImage(views::CustomButton::BS_HOT, |
| 117 tp->GetBitmapNamed(IDR_MINIMIZE_H)); | 117 tp->GetBitmapNamed(IDR_MINIMIZE_H)); |
| 118 minimize_button_->SetImage(views::CustomButton::BS_PUSHED, | 118 minimize_button_->SetImage(views::CustomButton::BS_PUSHED, |
| 119 tp->GetBitmapNamed(IDR_MINIMIZE_P)); | 119 tp->GetBitmapNamed(IDR_MINIMIZE_P)); |
| 120 if (browser_view_->IsBrowserTypeNormal()) { | 120 if (browser_view_->IsBrowserTypeNormal()) { |
| 121 minimize_button_->SetBackground(color, background, | 121 minimize_button_->SetBackground(color, background, |
| 122 tp->GetBitmapNamed(IDR_MINIMIZE_BUTTON_MASK)); | 122 tp->GetBitmapNamed(IDR_MINIMIZE_BUTTON_MASK)); |
| 123 } | 123 } |
| 124 minimize_button_->SetAccessibleName( | 124 minimize_button_->SetAccessibleName( |
| 125 UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_MINIMIZE))); | 125 l10n_util::GetStringUTF16(IDS_ACCNAME_MINIMIZE)); |
| 126 AddChildView(minimize_button_); | 126 AddChildView(minimize_button_); |
| 127 | 127 |
| 128 maximize_button_->SetImage(views::CustomButton::BS_NORMAL, | 128 maximize_button_->SetImage(views::CustomButton::BS_NORMAL, |
| 129 tp->GetBitmapNamed(IDR_MAXIMIZE)); | 129 tp->GetBitmapNamed(IDR_MAXIMIZE)); |
| 130 maximize_button_->SetImage(views::CustomButton::BS_HOT, | 130 maximize_button_->SetImage(views::CustomButton::BS_HOT, |
| 131 tp->GetBitmapNamed(IDR_MAXIMIZE_H)); | 131 tp->GetBitmapNamed(IDR_MAXIMIZE_H)); |
| 132 maximize_button_->SetImage(views::CustomButton::BS_PUSHED, | 132 maximize_button_->SetImage(views::CustomButton::BS_PUSHED, |
| 133 tp->GetBitmapNamed(IDR_MAXIMIZE_P)); | 133 tp->GetBitmapNamed(IDR_MAXIMIZE_P)); |
| 134 if (browser_view_->IsBrowserTypeNormal()) { | 134 if (browser_view_->IsBrowserTypeNormal()) { |
| 135 maximize_button_->SetBackground(color, background, | 135 maximize_button_->SetBackground(color, background, |
| 136 tp->GetBitmapNamed(IDR_MAXIMIZE_BUTTON_MASK)); | 136 tp->GetBitmapNamed(IDR_MAXIMIZE_BUTTON_MASK)); |
| 137 } | 137 } |
| 138 maximize_button_->SetAccessibleName( | 138 maximize_button_->SetAccessibleName( |
| 139 UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_MAXIMIZE))); | 139 l10n_util::GetStringUTF16(IDS_ACCNAME_MAXIMIZE)); |
| 140 AddChildView(maximize_button_); | 140 AddChildView(maximize_button_); |
| 141 | 141 |
| 142 restore_button_->SetImage(views::CustomButton::BS_NORMAL, | 142 restore_button_->SetImage(views::CustomButton::BS_NORMAL, |
| 143 tp->GetBitmapNamed(IDR_RESTORE)); | 143 tp->GetBitmapNamed(IDR_RESTORE)); |
| 144 restore_button_->SetImage(views::CustomButton::BS_HOT, | 144 restore_button_->SetImage(views::CustomButton::BS_HOT, |
| 145 tp->GetBitmapNamed(IDR_RESTORE_H)); | 145 tp->GetBitmapNamed(IDR_RESTORE_H)); |
| 146 restore_button_->SetImage(views::CustomButton::BS_PUSHED, | 146 restore_button_->SetImage(views::CustomButton::BS_PUSHED, |
| 147 tp->GetBitmapNamed(IDR_RESTORE_P)); | 147 tp->GetBitmapNamed(IDR_RESTORE_P)); |
| 148 if (browser_view_->IsBrowserTypeNormal()) { | 148 if (browser_view_->IsBrowserTypeNormal()) { |
| 149 restore_button_->SetBackground(color, background, | 149 restore_button_->SetBackground(color, background, |
| 150 tp->GetBitmapNamed(IDR_RESTORE_BUTTON_MASK)); | 150 tp->GetBitmapNamed(IDR_RESTORE_BUTTON_MASK)); |
| 151 } | 151 } |
| 152 restore_button_->SetAccessibleName( | 152 restore_button_->SetAccessibleName( |
| 153 UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_RESTORE))); | 153 l10n_util::GetStringUTF16(IDS_ACCNAME_RESTORE)); |
| 154 AddChildView(restore_button_); | 154 AddChildView(restore_button_); |
| 155 | 155 |
| 156 close_button_->SetImage(views::CustomButton::BS_NORMAL, | 156 close_button_->SetImage(views::CustomButton::BS_NORMAL, |
| 157 tp->GetBitmapNamed(IDR_CLOSE)); | 157 tp->GetBitmapNamed(IDR_CLOSE)); |
| 158 close_button_->SetImage(views::CustomButton::BS_HOT, | 158 close_button_->SetImage(views::CustomButton::BS_HOT, |
| 159 tp->GetBitmapNamed(IDR_CLOSE_H)); | 159 tp->GetBitmapNamed(IDR_CLOSE_H)); |
| 160 close_button_->SetImage(views::CustomButton::BS_PUSHED, | 160 close_button_->SetImage(views::CustomButton::BS_PUSHED, |
| 161 tp->GetBitmapNamed(IDR_CLOSE_P)); | 161 tp->GetBitmapNamed(IDR_CLOSE_P)); |
| 162 if (browser_view_->IsBrowserTypeNormal()) { | 162 if (browser_view_->IsBrowserTypeNormal()) { |
| 163 close_button_->SetBackground(color, background, | 163 close_button_->SetBackground(color, background, |
| 164 tp->GetBitmapNamed(IDR_CLOSE_BUTTON_MASK)); | 164 tp->GetBitmapNamed(IDR_CLOSE_BUTTON_MASK)); |
| 165 } | 165 } |
| 166 close_button_->SetAccessibleName( | 166 close_button_->SetAccessibleName( |
| 167 UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE))); | 167 l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE)); |
| 168 AddChildView(close_button_); | 168 AddChildView(close_button_); |
| 169 | 169 |
| 170 // Initializing the TabIconView is expensive, so only do it if we need to. | 170 // Initializing the TabIconView is expensive, so only do it if we need to. |
| 171 if (browser_view_->ShouldShowWindowIcon()) { | 171 if (browser_view_->ShouldShowWindowIcon()) { |
| 172 window_icon_ = new TabIconView(this); | 172 window_icon_ = new TabIconView(this); |
| 173 window_icon_->set_is_light(true); | 173 window_icon_->set_is_light(true); |
| 174 AddChildView(window_icon_); | 174 AddChildView(window_icon_); |
| 175 window_icon_->Update(); | 175 window_icon_->Update(); |
| 176 } | 176 } |
| 177 } | 177 } |
| (...skipping 885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1063 | 1063 |
| 1064 gfx::Rect OpaqueBrowserFrameView::CalculateClientAreaBounds(int width, | 1064 gfx::Rect OpaqueBrowserFrameView::CalculateClientAreaBounds(int width, |
| 1065 int height) const { | 1065 int height) const { |
| 1066 int top_height = NonClientTopBorderHeight(false, false); | 1066 int top_height = NonClientTopBorderHeight(false, false); |
| 1067 int border_thickness = NonClientBorderThickness(); | 1067 int border_thickness = NonClientBorderThickness(); |
| 1068 return gfx::Rect(border_thickness, top_height, | 1068 return gfx::Rect(border_thickness, top_height, |
| 1069 std::max(0, width - (2 * border_thickness)), | 1069 std::max(0, width - (2 * border_thickness)), |
| 1070 std::max(0, height - GetReservedHeight() - | 1070 std::max(0, height - GetReservedHeight() - |
| 1071 top_height - border_thickness)); | 1071 top_height - border_thickness)); |
| 1072 } | 1072 } |
| OLD | NEW |