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

Side by Side Diff: chrome/browser/ui/views/constrained_window_views.cc

Issue 8488014: Give Constrained windows the proper square frame corners. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 1 month 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 | Annotate | Revision Log
« 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 (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/constrained_window_views.h" 5 #include "chrome/browser/ui/views/constrained_window_views.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/app/chrome_command_ids.h" 10 #include "chrome/app/chrome_command_ids.h"
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 // When the icon is shorter than the minimum space we reserve for the caption 422 // When the icon is shorter than the minimum space we reserve for the caption
423 // button, we vertically center it. We want to bias rounding to put extra 423 // button, we vertically center it. We want to bias rounding to put extra
424 // space above the icon, since the 3D edge + client edge below looks (to the 424 // space above the icon, since the 3D edge + client edge below looks (to the
425 // eye) more like additional space than does the 3D edge above; hence the +1. 425 // eye) more like additional space than does the 3D edge above; hence the +1.
426 int y = unavailable_px_at_top + (NonClientTopBorderHeight() - 426 int y = unavailable_px_at_top + (NonClientTopBorderHeight() -
427 unavailable_px_at_top - size - TitlebarBottomThickness() + 1) / 2; 427 unavailable_px_at_top - size - TitlebarBottomThickness() + 1) / 2;
428 return gfx::Rect(kFrameBorderThickness + kTitleLeftSpacing, y, size, size); 428 return gfx::Rect(kFrameBorderThickness + kTitleLeftSpacing, y, size, size);
429 } 429 }
430 430
431 void ConstrainedWindowFrameView::PaintFrameBorder(gfx::Canvas* canvas) { 431 void ConstrainedWindowFrameView::PaintFrameBorder(gfx::Canvas* canvas) {
432 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
433 #if defined(USE_AURA)
434 // TODO(jamescook): Remove this when Aura defaults to its own window frame,
435 // BrowserNonClientFrameViewAura. Until then, use custom square corners to
436 // avoid performance penalties associated with transparent layers.
437 SkBitmap* top_left_corner = rb.GetBitmapNamed(IDR_AURA_WINDOW_TOP_LEFT);
438 SkBitmap* top_right_corner = rb.GetBitmapNamed(IDR_AURA_WINDOW_TOP_RIGHT);
439 SkBitmap* bottom_left_corner =
440 rb.GetBitmapNamed(IDR_AURA_WINDOW_BOTTOM_LEFT);
441 SkBitmap* bottom_right_corner =
442 rb.GetBitmapNamed(IDR_AURA_WINDOW_BOTTOM_RIGHT);
443 SkBitmap* top_edge = rb.GetBitmapNamed(IDR_WINDOW_TOP_CENTER);
444 SkBitmap* right_edge = rb.GetBitmapNamed(IDR_WINDOW_RIGHT_SIDE);
445 SkBitmap* left_edge = rb.GetBitmapNamed(IDR_WINDOW_LEFT_SIDE);
446 SkBitmap* bottom_edge = rb.GetBitmapNamed(IDR_WINDOW_BOTTOM_CENTER);
447 #else
432 SkBitmap* top_left_corner = resources_->GetPartBitmap(FRAME_TOP_LEFT_CORNER); 448 SkBitmap* top_left_corner = resources_->GetPartBitmap(FRAME_TOP_LEFT_CORNER);
433 SkBitmap* top_right_corner = 449 SkBitmap* top_right_corner =
434 resources_->GetPartBitmap(FRAME_TOP_RIGHT_CORNER); 450 resources_->GetPartBitmap(FRAME_TOP_RIGHT_CORNER);
435 SkBitmap* top_edge = resources_->GetPartBitmap(FRAME_TOP_EDGE);
436 SkBitmap* right_edge = resources_->GetPartBitmap(FRAME_RIGHT_EDGE);
437 SkBitmap* left_edge = resources_->GetPartBitmap(FRAME_LEFT_EDGE);
438 SkBitmap* bottom_left_corner = 451 SkBitmap* bottom_left_corner =
439 resources_->GetPartBitmap(FRAME_BOTTOM_LEFT_CORNER); 452 resources_->GetPartBitmap(FRAME_BOTTOM_LEFT_CORNER);
440 SkBitmap* bottom_right_corner = 453 SkBitmap* bottom_right_corner =
441 resources_->GetPartBitmap(FRAME_BOTTOM_RIGHT_CORNER); 454 resources_->GetPartBitmap(FRAME_BOTTOM_RIGHT_CORNER);
455 SkBitmap* top_edge = resources_->GetPartBitmap(FRAME_TOP_EDGE);
456 SkBitmap* right_edge = resources_->GetPartBitmap(FRAME_RIGHT_EDGE);
457 SkBitmap* left_edge = resources_->GetPartBitmap(FRAME_LEFT_EDGE);
442 SkBitmap* bottom_edge = resources_->GetPartBitmap(FRAME_BOTTOM_EDGE); 458 SkBitmap* bottom_edge = resources_->GetPartBitmap(FRAME_BOTTOM_EDGE);
459 #endif
443 460
444 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
445 SkBitmap* theme_frame = rb.GetBitmapNamed(IDR_THEME_FRAME); 461 SkBitmap* theme_frame = rb.GetBitmapNamed(IDR_THEME_FRAME);
446 SkColor frame_color = ResourceBundle::frame_color; 462 SkColor frame_color = ResourceBundle::frame_color;
447 463
448 // Fill with the frame color first so we have a constant background for 464 // Fill with the frame color first so we have a constant background for
449 // areas not covered by the theme image. 465 // areas not covered by the theme image.
450 canvas->FillRect(frame_color, 466 canvas->FillRect(frame_color,
451 gfx::Rect(0, 0, width(), theme_frame->height())); 467 gfx::Rect(0, 0, width(), theme_frame->height()));
452 468
453 int remaining_height = height() - theme_frame->height(); 469 int remaining_height = height() - theme_frame->height();
454 if (remaining_height > 0) { 470 if (remaining_height > 0) {
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 } 676 }
661 677
662 void ConstrainedWindowViews::OnNativeConstrainedWindowMouseActivate() { 678 void ConstrainedWindowViews::OnNativeConstrainedWindowMouseActivate() {
663 Activate(); 679 Activate();
664 } 680 }
665 681
666 views::internal::NativeWidgetDelegate* 682 views::internal::NativeWidgetDelegate*
667 ConstrainedWindowViews::AsNativeWidgetDelegate() { 683 ConstrainedWindowViews::AsNativeWidgetDelegate() {
668 return this; 684 return this;
669 } 685 }
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