Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Side by Side Diff: apps/ui/views/app_window_frame_view.cc

Issue 586323002: Prevent frameless packaged apps from being resized to 0x0 on CrOS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698