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

Side by Side Diff: chrome/views/window/custom_frame_view.cc

Issue 56142: Merge r12900.... (Closed) Base URL: svn://chrome-svn.corp.google.com/chrome/branches/172/src/
Patch Set: Created 11 years, 8 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 (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/views/window/custom_frame_view.h" 5 #include "chrome/views/window/custom_frame_view.h"
6 6
7 #include "base/win_util.h" 7 #include "base/win_util.h"
8 #include "chrome/common/gfx/path.h" 8 #include "chrome/common/gfx/path.h"
9 #include "chrome/common/gfx/chrome_canvas.h" 9 #include "chrome/common/gfx/chrome_canvas.h"
10 #include "chrome/common/gfx/chrome_font.h" 10 #include "chrome/common/gfx/chrome_font.h"
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 NonClientBorderThickness(), kResizeAreaCornerSize, kResizeAreaCornerSize, 310 NonClientBorderThickness(), kResizeAreaCornerSize, kResizeAreaCornerSize,
311 frame_->GetDelegate()->CanResize()); 311 frame_->GetDelegate()->CanResize());
312 // Fall back to the caption if no other component matches. 312 // Fall back to the caption if no other component matches.
313 return (window_component == HTNOWHERE) ? HTCAPTION : window_component; 313 return (window_component == HTNOWHERE) ? HTCAPTION : window_component;
314 } 314 }
315 315
316 void CustomFrameView::GetWindowMask(const gfx::Size& size, 316 void CustomFrameView::GetWindowMask(const gfx::Size& size,
317 gfx::Path* window_mask) { 317 gfx::Path* window_mask) {
318 DCHECK(window_mask); 318 DCHECK(window_mask);
319 319
320 if (frame_->IsMaximized())
321 return;
322
320 // Redefine the window visible region for the new size. 323 // Redefine the window visible region for the new size.
321 window_mask->moveTo(0, 3); 324 window_mask->moveTo(0, 3);
322 window_mask->lineTo(1, 2); 325 window_mask->lineTo(1, 2);
323 window_mask->lineTo(1, 1); 326 window_mask->lineTo(1, 1);
324 window_mask->lineTo(2, 1); 327 window_mask->lineTo(2, 1);
325 window_mask->lineTo(3, 0); 328 window_mask->lineTo(3, 0);
326 329
327 window_mask->lineTo(SkIntToScalar(size.width() - 3), 0); 330 window_mask->lineTo(SkIntToScalar(size.width() - 3), 0);
328 window_mask->lineTo(SkIntToScalar(size.width() - 2), 1); 331 window_mask->lineTo(SkIntToScalar(size.width() - 2), 1);
329 window_mask->lineTo(SkIntToScalar(size.width() - 1), 1); 332 window_mask->lineTo(SkIntToScalar(size.width() - 1), 1);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 else if (sender == maximize_button_) 388 else if (sender == maximize_button_)
386 frame_->Maximize(); 389 frame_->Maximize();
387 else if (sender == restore_button_) 390 else if (sender == restore_button_)
388 frame_->Restore(); 391 frame_->Restore();
389 } 392 }
390 393
391 /////////////////////////////////////////////////////////////////////////////// 394 ///////////////////////////////////////////////////////////////////////////////
392 // CustomFrameView, private: 395 // CustomFrameView, private:
393 396
394 int CustomFrameView::FrameBorderThickness() const { 397 int CustomFrameView::FrameBorderThickness() const {
395 return frame_->IsMaximized() ? 398 return frame_->IsMaximized() ? 0 : kFrameBorderThickness;
396 GetSystemMetrics(SM_CXSIZEFRAME) : kFrameBorderThickness;
397 } 399 }
398 400
399 int CustomFrameView::NonClientBorderThickness() const { 401 int CustomFrameView::NonClientBorderThickness() const {
400 // In maximized mode, we don't show a client edge. 402 // In maximized mode, we don't show a client edge.
401 return FrameBorderThickness() + 403 return FrameBorderThickness() +
402 (frame_->IsMaximized() ? 0 : kClientEdgeThickness); 404 (frame_->IsMaximized() ? 0 : kClientEdgeThickness);
403 } 405 }
404 406
405 int CustomFrameView::NonClientTopBorderHeight() const { 407 int CustomFrameView::NonClientTopBorderHeight() const {
406 int title_top_spacing, title_thickness; 408 int title_top_spacing, title_thickness;
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 // drawn flush with the screen edge, they still obey Fitts' Law. 565 // drawn flush with the screen edge, they still obey Fitts' Law.
564 bool is_maximized = frame_->IsMaximized(); 566 bool is_maximized = frame_->IsMaximized();
565 int frame_thickness = FrameBorderThickness(); 567 int frame_thickness = FrameBorderThickness();
566 int caption_y = is_maximized ? frame_thickness : kCaptionTopSpacing; 568 int caption_y = is_maximized ? frame_thickness : kCaptionTopSpacing;
567 int top_extra_height = is_maximized ? kCaptionTopSpacing : 0; 569 int top_extra_height = is_maximized ? kCaptionTopSpacing : 0;
568 // There should always be the same number of non-shadow pixels visible to the 570 // There should always be the same number of non-shadow pixels visible to the
569 // side of the caption buttons. In maximized mode we extend the rightmost 571 // side of the caption buttons. In maximized mode we extend the rightmost
570 // button to the screen corner to obey Fitts' Law. 572 // button to the screen corner to obey Fitts' Law.
571 int right_extra_width = is_maximized ? 573 int right_extra_width = is_maximized ?
572 (kFrameBorderThickness - kFrameShadowThickness) : 0; 574 (kFrameBorderThickness - kFrameShadowThickness) : 0;
573 int right_spacing = is_maximized ?
574 (GetSystemMetrics(SM_CXSIZEFRAME) + right_extra_width) : frame_thickness;
575 gfx::Size close_button_size = close_button_->GetPreferredSize(); 575 gfx::Size close_button_size = close_button_->GetPreferredSize();
576 close_button_->SetBounds(width() - close_button_size.width() - right_spacing, 576 close_button_->SetBounds(width() - close_button_size.width() -
577 caption_y, 577 right_extra_width - frame_thickness, caption_y,
578 close_button_size.width() + right_extra_width, 578 close_button_size.width() + right_extra_width,
579 close_button_size.height() + top_extra_height); 579 close_button_size.height() + top_extra_height);
580 580
581 // When the window is restored, we show a maximized button; otherwise, we show 581 // When the window is restored, we show a maximized button; otherwise, we show
582 // a restore button. 582 // a restore button.
583 bool is_restored = !is_maximized && !frame_->IsMinimized(); 583 bool is_restored = !is_maximized && !frame_->IsMinimized();
584 views::ImageButton* invisible_button = is_restored ? 584 views::ImageButton* invisible_button = is_restored ?
585 restore_button_ : maximize_button_; 585 restore_button_ : maximize_button_;
586 invisible_button->SetVisible(false); 586 invisible_button->SetVisible(false);
587 587
588 views::ImageButton* visible_button = is_restored ? 588 views::ImageButton* visible_button = is_restored ?
589 maximize_button_ : restore_button_; 589 maximize_button_ : restore_button_;
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 active_resources_ = new ActiveWindowResources; 688 active_resources_ = new ActiveWindowResources;
689 inactive_resources_ = new InactiveWindowResources; 689 inactive_resources_ = new InactiveWindowResources;
690 690
691 title_font_ = win_util::GetWindowTitleFont(); 691 title_font_ = win_util::GetWindowTitleFont();
692 692
693 initialized = true; 693 initialized = true;
694 } 694 }
695 } 695 }
696 696
697 } // namespace views 697 } // namespace views
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