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

Side by Side Diff: ash/common/frame/default_header_painter.cc

Issue 2724693002: mash: improves browser frame decorations (Closed)
Patch Set: merge Created 3 years, 9 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 | « ash/common/frame/default_header_painter.h ('k') | ash/common/frame/header_view.h » ('j') | 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 "ash/common/frame/default_header_painter.h" 5 #include "ash/common/frame/default_header_painter.h"
6 6
7 #include "ash/common/ash_layout_constants.h" 7 #include "ash/common/ash_layout_constants.h"
8 #include "ash/common/frame/caption_buttons/frame_caption_button_container_view.h " 8 #include "ash/common/frame/caption_buttons/frame_caption_button_container_view.h "
9 #include "ash/common/frame/header_painter_util.h" 9 #include "ash/common/frame/header_painter_util.h"
10 #include "ash/resources/grit/ash_resources.h" 10 #include "ash/resources/grit/ash_resources.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 return *title_font_list; 70 return *title_font_list;
71 } 71 }
72 72
73 } // namespace 73 } // namespace
74 74
75 namespace ash { 75 namespace ash {
76 76
77 /////////////////////////////////////////////////////////////////////////////// 77 ///////////////////////////////////////////////////////////////////////////////
78 // DefaultHeaderPainter, public: 78 // DefaultHeaderPainter, public:
79 79
80 DefaultHeaderPainter::DefaultHeaderPainter() 80 DefaultHeaderPainter::DefaultHeaderPainter(mojom::WindowStyle window_style)
81 : frame_(NULL), 81 : window_style_(window_style),
82 view_(NULL), 82 frame_(nullptr),
83 left_header_view_(NULL), 83 view_(nullptr),
84 left_header_view_(nullptr),
84 active_frame_color_(kDefaultFrameColor), 85 active_frame_color_(kDefaultFrameColor),
85 inactive_frame_color_(kDefaultFrameColor), 86 inactive_frame_color_(kDefaultFrameColor),
86 caption_button_container_(NULL), 87 caption_button_container_(nullptr),
87 painted_height_(0), 88 painted_height_(0),
88 mode_(MODE_INACTIVE), 89 mode_(MODE_INACTIVE),
89 initial_paint_(true), 90 initial_paint_(true),
90 activation_animation_(new gfx::SlideAnimation(this)) {} 91 activation_animation_(new gfx::SlideAnimation(this)) {}
91 92
92 DefaultHeaderPainter::~DefaultHeaderPainter() {} 93 DefaultHeaderPainter::~DefaultHeaderPainter() {}
93 94
94 void DefaultHeaderPainter::Init( 95 void DefaultHeaderPainter::Init(
95 views::Widget* frame, 96 views::Widget* frame,
96 views::View* header_view, 97 views::View* header_view,
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 mode_ == MODE_INACTIVE && !UsesCustomFrameColors()) { 150 mode_ == MODE_INACTIVE && !UsesCustomFrameColors()) {
150 PaintHighlightForInactiveRestoredWindow(canvas); 151 PaintHighlightForInactiveRestoredWindow(canvas);
151 } 152 }
152 if (frame_->widget_delegate()->ShouldShowWindowTitle()) 153 if (frame_->widget_delegate()->ShouldShowWindowTitle())
153 PaintTitleBar(canvas); 154 PaintTitleBar(canvas);
154 if (!UsesCustomFrameColors()) 155 if (!UsesCustomFrameColors())
155 PaintHeaderContentSeparator(canvas); 156 PaintHeaderContentSeparator(canvas);
156 } 157 }
157 158
158 void DefaultHeaderPainter::LayoutHeader() { 159 void DefaultHeaderPainter::LayoutHeader() {
160 // TODO(sky): this needs to reset images as well.
161 if (window_style_ == mojom::WindowStyle::BROWSER) {
162 const bool use_maximized_size =
163 frame_->IsMaximized() || frame_->IsFullscreen();
164 const gfx::Size button_size(GetAshLayoutSize(
165 use_maximized_size ? AshLayoutSize::BROWSER_MAXIMIZED_CAPTION_BUTTON
166 : AshLayoutSize::BROWSER_RESTORED_CAPTION_BUTTON));
167 caption_button_container_->SetButtonSize(button_size);
168 }
169
159 caption_button_container_->SetUseLightImages(ShouldUseLightImages()); 170 caption_button_container_->SetUseLightImages(ShouldUseLightImages());
160 UpdateSizeButtonImages(); 171 UpdateSizeButtonImages();
161 caption_button_container_->Layout(); 172 caption_button_container_->Layout();
162 173
163 gfx::Size caption_button_container_size = 174 gfx::Size caption_button_container_size =
164 caption_button_container_->GetPreferredSize(); 175 caption_button_container_->GetPreferredSize();
165 caption_button_container_->SetBounds( 176 caption_button_container_->SetBounds(
166 view_->width() - caption_button_container_size.width(), 0, 177 view_->width() - caption_button_container_size.width(), 0,
167 caption_button_container_size.width(), 178 caption_button_container_size.width(),
168 caption_button_container_size.height()); 179 caption_button_container_size.height());
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 return HeaderPainterUtil::GetTitleBounds( 324 return HeaderPainterUtil::GetTitleBounds(
314 left_header_view_, caption_button_container_, GetTitleFontList()); 325 left_header_view_, caption_button_container_, GetTitleFontList());
315 } 326 }
316 327
317 bool DefaultHeaderPainter::UsesCustomFrameColors() const { 328 bool DefaultHeaderPainter::UsesCustomFrameColors() const {
318 return active_frame_color_ != kDefaultFrameColor || 329 return active_frame_color_ != kDefaultFrameColor ||
319 inactive_frame_color_ != kDefaultFrameColor; 330 inactive_frame_color_ != kDefaultFrameColor;
320 } 331 }
321 332
322 } // namespace ash 333 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/frame/default_header_painter.h ('k') | ash/common/frame/header_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698