OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "apps/ui/views/app_window_frame_view.h" | 5 #include "apps/ui/views/app_window_frame_view.h" |
6 | 6 |
7 #include "apps/ui/native_app_window.h" | 7 #include "apps/ui/native_app_window.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "extensions/common/draggable_region.h" | 9 #include "extensions/common/draggable_region.h" |
10 #include "grit/theme_resources.h" | 10 #include "grit/theme_resources.h" |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 | 222 |
223 // Caption is a safe default. | 223 // Caption is a safe default. |
224 return HTCAPTION; | 224 return HTCAPTION; |
225 } | 225 } |
226 | 226 |
227 void AppWindowFrameView::GetWindowMask(const gfx::Size& size, | 227 void AppWindowFrameView::GetWindowMask(const gfx::Size& size, |
228 gfx::Path* window_mask) { | 228 gfx::Path* window_mask) { |
229 // We got nothing to say about no window mask. | 229 // We got nothing to say about no window mask. |
230 } | 230 } |
231 | 231 |
232 gfx::Size AppWindowFrameView::GetPreferredSize() { | 232 gfx::Size AppWindowFrameView::GetPreferredSize() const { |
233 gfx::Size pref = widget_->client_view()->GetPreferredSize(); | 233 gfx::Size pref = widget_->client_view()->GetPreferredSize(); |
234 gfx::Rect bounds(0, 0, pref.width(), pref.height()); | 234 gfx::Rect bounds(0, 0, pref.width(), pref.height()); |
235 return widget_->non_client_view() | 235 return widget_->non_client_view() |
236 ->GetWindowBoundsForClientBounds(bounds) | 236 ->GetWindowBoundsForClientBounds(bounds) |
237 .size(); | 237 .size(); |
238 } | 238 } |
239 | 239 |
240 void AppWindowFrameView::Layout() { | 240 void AppWindowFrameView::Layout() { |
241 if (!draw_frame_) | 241 if (!draw_frame_) |
242 return; | 242 return; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 path.moveTo(0, 0); | 309 path.moveTo(0, 0); |
310 path.lineTo(width(), 0); | 310 path.lineTo(width(), 0); |
311 path.lineTo(width(), kCaptionHeight); | 311 path.lineTo(width(), kCaptionHeight); |
312 path.lineTo(0, kCaptionHeight); | 312 path.lineTo(0, kCaptionHeight); |
313 path.close(); | 313 path.close(); |
314 canvas->DrawPath(path, paint); | 314 canvas->DrawPath(path, paint); |
315 } | 315 } |
316 | 316 |
317 const char* AppWindowFrameView::GetClassName() const { return kViewClassName; } | 317 const char* AppWindowFrameView::GetClassName() const { return kViewClassName; } |
318 | 318 |
319 gfx::Size AppWindowFrameView::GetMinimumSize() { | 319 gfx::Size AppWindowFrameView::GetMinimumSize() const { |
320 gfx::Size min_size = widget_->client_view()->GetMinimumSize(); | 320 gfx::Size min_size = widget_->client_view()->GetMinimumSize(); |
321 if (!draw_frame_) | 321 if (!draw_frame_) |
322 return min_size; | 322 return min_size; |
323 | 323 |
324 // Ensure we can display the top of the caption area. | 324 // Ensure we can display the top of the caption area. |
325 gfx::Rect client_bounds = GetBoundsForClientView(); | 325 gfx::Rect client_bounds = GetBoundsForClientView(); |
326 min_size.Enlarge(0, client_bounds.y()); | 326 min_size.Enlarge(0, client_bounds.y()); |
327 // Ensure we have enough space for the window icon and buttons. We allow | 327 // Ensure we have enough space for the window icon and buttons. We allow |
328 // the title string to collapse to zero width. | 328 // the title string to collapse to zero width. |
329 int closeButtonOffsetX = (kCaptionHeight - close_button_->height()) / 2; | 329 int closeButtonOffsetX = (kCaptionHeight - close_button_->height()) / 2; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 restore_button_->SetImage( | 391 restore_button_->SetImage( |
392 views::CustomButton::STATE_NORMAL, | 392 views::CustomButton::STATE_NORMAL, |
393 rb.GetNativeImageNamed(IDR_APP_WINDOW_RESTORE).ToImageSkia()); | 393 rb.GetNativeImageNamed(IDR_APP_WINDOW_RESTORE).ToImageSkia()); |
394 minimize_button_->SetImage( | 394 minimize_button_->SetImage( |
395 views::CustomButton::STATE_NORMAL, | 395 views::CustomButton::STATE_NORMAL, |
396 rb.GetNativeImageNamed(IDR_APP_WINDOW_MINIMIZE).ToImageSkia()); | 396 rb.GetNativeImageNamed(IDR_APP_WINDOW_MINIMIZE).ToImageSkia()); |
397 } | 397 } |
398 } | 398 } |
399 | 399 |
400 } // namespace apps | 400 } // namespace apps |
OLD | NEW |