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/extensions/shell_window_frame_view.h" | 5 #include "chrome/browser/ui/views/extensions/shell_window_frame_view.h" |
6 | 6 |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/browser/ui/views/extensions/native_app_window_views.h" | 8 #include "chrome/browser/ui/views/extensions/native_app_window_views.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 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 int closeButtonOffsetX = | 338 int closeButtonOffsetX = |
339 (kCaptionHeight - close_button_->height()) / 2; | 339 (kCaptionHeight - close_button_->height()) / 2; |
340 int header_width = close_button_->width() + closeButtonOffsetX * 2; | 340 int header_width = close_button_->width() + closeButtonOffsetX * 2; |
341 if (header_width > min_size.width()) | 341 if (header_width > min_size.width()) |
342 min_size.set_width(header_width); | 342 min_size.set_width(header_width); |
343 return min_size; | 343 return min_size; |
344 } | 344 } |
345 | 345 |
346 gfx::Size ShellWindowFrameView::GetMaximumSize() { | 346 gfx::Size ShellWindowFrameView::GetMaximumSize() { |
347 gfx::Size max_size = frame_->client_view()->GetMaximumSize(); | 347 gfx::Size max_size = frame_->client_view()->GetMaximumSize(); |
348 if (window_->frameless()) | |
349 return max_size; | |
350 | 348 |
351 if (!max_size.IsEmpty()) { | 349 // Add to the client maximum size the height of any title bar and borders. |
352 gfx::Rect client_bounds = GetBoundsForClientView(); | 350 gfx::Size client_size = GetBoundsForClientView().size(); |
353 max_size.Enlarge(0, client_bounds.y()); | 351 if (max_size.width()) |
354 } | 352 max_size.Enlarge(width() - client_size.width(), 0); |
| 353 if (max_size.height()) |
| 354 max_size.Enlarge(0, height() - client_size.height()); |
| 355 |
355 return max_size; | 356 return max_size; |
356 } | 357 } |
357 | 358 |
358 // views::ButtonListener implementation. | 359 // views::ButtonListener implementation. |
359 | 360 |
360 void ShellWindowFrameView::ButtonPressed(views::Button* sender, | 361 void ShellWindowFrameView::ButtonPressed(views::Button* sender, |
361 const ui::Event& event) { | 362 const ui::Event& event) { |
362 DCHECK(!window_->frameless()); | 363 DCHECK(!window_->frameless()); |
363 if (sender == close_button_) | 364 if (sender == close_button_) |
364 frame_->Close(); | 365 frame_->Close(); |
365 else if (sender == maximize_button_) | 366 else if (sender == maximize_button_) |
366 frame_->Maximize(); | 367 frame_->Maximize(); |
367 else if (sender == restore_button_) | 368 else if (sender == restore_button_) |
368 frame_->Restore(); | 369 frame_->Restore(); |
369 else if (sender == minimize_button_) | 370 else if (sender == minimize_button_) |
370 frame_->Minimize(); | 371 frame_->Minimize(); |
371 } | 372 } |
OLD | NEW |