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 "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "extensions/browser/app_window/native_app_window.h" | 8 #include "extensions/browser/app_window/native_app_window.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 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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() const { | 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 min_size.SetToMax(gfx::Size(1, 1)); |
322 return min_size; | 323 return min_size; |
| 324 } |
323 | 325 |
324 // Ensure we can display the top of the caption area. | 326 // Ensure we can display the top of the caption area. |
325 gfx::Rect client_bounds = GetBoundsForClientView(); | 327 gfx::Rect client_bounds = GetBoundsForClientView(); |
326 min_size.Enlarge(0, client_bounds.y()); | 328 min_size.Enlarge(0, client_bounds.y()); |
327 // Ensure we have enough space for the window icon and buttons. We allow | 329 // Ensure we have enough space for the window icon and buttons. We allow |
328 // the title string to collapse to zero width. | 330 // the title string to collapse to zero width. |
329 int closeButtonOffsetX = (kCaptionHeight - close_button_->height()) / 2; | 331 int closeButtonOffsetX = (kCaptionHeight - close_button_->height()) / 2; |
330 int header_width = close_button_->width() + closeButtonOffsetX * 2; | 332 int header_width = close_button_->width() + closeButtonOffsetX * 2; |
331 if (header_width > min_size.width()) | 333 if (header_width > min_size.width()) |
332 min_size.set_width(header_width); | 334 min_size.set_width(header_width); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 restore_button_->SetImage( | 393 restore_button_->SetImage( |
392 views::CustomButton::STATE_NORMAL, | 394 views::CustomButton::STATE_NORMAL, |
393 rb.GetNativeImageNamed(IDR_APP_WINDOW_RESTORE).ToImageSkia()); | 395 rb.GetNativeImageNamed(IDR_APP_WINDOW_RESTORE).ToImageSkia()); |
394 minimize_button_->SetImage( | 396 minimize_button_->SetImage( |
395 views::CustomButton::STATE_NORMAL, | 397 views::CustomButton::STATE_NORMAL, |
396 rb.GetNativeImageNamed(IDR_APP_WINDOW_MINIMIZE).ToImageSkia()); | 398 rb.GetNativeImageNamed(IDR_APP_WINDOW_MINIMIZE).ToImageSkia()); |
397 } | 399 } |
398 } | 400 } |
399 | 401 |
400 } // namespace apps | 402 } // namespace apps |
OLD | NEW |