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

Side by Side Diff: ash/frame/custom_frame_view_ash.cc

Issue 664443002: Support chrome app frame colors on ChromeOS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update comment Created 6 years, 2 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/frame/custom_frame_view_ash.h ('k') | ash/frame/default_header_painter.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 (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 "ash/frame/custom_frame_view_ash.h" 5 #include "ash/frame/custom_frame_view_ash.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/ash_switches.h" 10 #include "ash/ash_switches.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 // Returns the view's preferred height. 146 // Returns the view's preferred height.
147 int GetPreferredHeight() const; 147 int GetPreferredHeight() const;
148 148
149 // Returns the view's minimum width. 149 // Returns the view's minimum width.
150 int GetMinimumWidth() const; 150 int GetMinimumWidth() const;
151 151
152 void UpdateAvatarIcon(); 152 void UpdateAvatarIcon();
153 153
154 void SizeConstraintsChanged(); 154 void SizeConstraintsChanged();
155 155
156 void SetFrameColors(SkColor active_frame_color, SkColor inactive_frame_color);
157
156 // views::View: 158 // views::View:
157 virtual void Layout() override; 159 virtual void Layout() override;
158 virtual void OnPaint(gfx::Canvas* canvas) override; 160 virtual void OnPaint(gfx::Canvas* canvas) override;
159 virtual void ChildPreferredSizeChanged(views::View* child) override; 161 virtual void ChildPreferredSizeChanged(views::View* child) override;
160 162
161 // ShellObserver: 163 // ShellObserver:
162 virtual void OnMaximizeModeStarted() override; 164 virtual void OnMaximizeModeStarted() override;
163 virtual void OnMaximizeModeEnded() override; 165 virtual void OnMaximizeModeEnded() override;
164 166
165 FrameCaptionButtonContainerView* caption_button_container() { 167 FrameCaptionButtonContainerView* caption_button_container() {
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 header_painter_->UpdateLeftHeaderView(avatar_icon_); 266 header_painter_->UpdateLeftHeaderView(avatar_icon_);
265 Layout(); 267 Layout();
266 } 268 }
267 269
268 void CustomFrameViewAsh::HeaderView::SizeConstraintsChanged() { 270 void CustomFrameViewAsh::HeaderView::SizeConstraintsChanged() {
269 caption_button_container_->ResetWindowControls(); 271 caption_button_container_->ResetWindowControls();
270 caption_button_container_->UpdateSizeButtonVisibility(); 272 caption_button_container_->UpdateSizeButtonVisibility();
271 Layout(); 273 Layout();
272 } 274 }
273 275
276 void CustomFrameViewAsh::HeaderView::SetFrameColors(
277 SkColor active_frame_color, SkColor inactive_frame_color) {
278 header_painter_->SetFrameColors(active_frame_color, inactive_frame_color);
279 }
280
274 /////////////////////////////////////////////////////////////////////////////// 281 ///////////////////////////////////////////////////////////////////////////////
275 // CustomFrameViewAsh::HeaderView, views::View overrides: 282 // CustomFrameViewAsh::HeaderView, views::View overrides:
276 283
277 void CustomFrameViewAsh::HeaderView::Layout() { 284 void CustomFrameViewAsh::HeaderView::Layout() {
278 header_painter_->LayoutHeader(); 285 header_painter_->LayoutHeader();
279 } 286 }
280 287
281 void CustomFrameViewAsh::HeaderView::OnPaint(gfx::Canvas* canvas) { 288 void CustomFrameViewAsh::HeaderView::OnPaint(gfx::Canvas* canvas) {
282 bool paint_as_active = 289 bool paint_as_active =
283 frame_->non_client_view()->frame_view()->ShouldPaintAsActive(); 290 frame_->non_client_view()->frame_view()->ShouldPaintAsActive();
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 } 453 }
447 454
448 CustomFrameViewAsh::~CustomFrameViewAsh() { 455 CustomFrameViewAsh::~CustomFrameViewAsh() {
449 } 456 }
450 457
451 void CustomFrameViewAsh::InitImmersiveFullscreenControllerForView( 458 void CustomFrameViewAsh::InitImmersiveFullscreenControllerForView(
452 ImmersiveFullscreenController* immersive_fullscreen_controller) { 459 ImmersiveFullscreenController* immersive_fullscreen_controller) {
453 immersive_fullscreen_controller->Init(header_view_, frame_, header_view_); 460 immersive_fullscreen_controller->Init(header_view_, frame_, header_view_);
454 } 461 }
455 462
463 void CustomFrameViewAsh::SetFrameColors(SkColor active_frame_color,
464 SkColor inactive_frame_color) {
465 header_view_->SetFrameColors(active_frame_color, inactive_frame_color);
466 }
467
456 //////////////////////////////////////////////////////////////////////////////// 468 ////////////////////////////////////////////////////////////////////////////////
457 // CustomFrameViewAsh, views::NonClientFrameView overrides: 469 // CustomFrameViewAsh, views::NonClientFrameView overrides:
458 470
459 gfx::Rect CustomFrameViewAsh::GetBoundsForClientView() const { 471 gfx::Rect CustomFrameViewAsh::GetBoundsForClientView() const {
460 gfx::Rect client_bounds = bounds(); 472 gfx::Rect client_bounds = bounds();
461 client_bounds.Inset(0, NonClientTopBorderHeight(), 0, 0); 473 client_bounds.Inset(0, NonClientTopBorderHeight(), 0, 0);
462 return client_bounds; 474 return client_bounds;
463 } 475 }
464 476
465 gfx::Rect CustomFrameViewAsh::GetWindowBoundsForClientBounds( 477 gfx::Rect CustomFrameViewAsh::GetWindowBoundsForClientBounds(
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 FrameCaptionButtonContainerView* CustomFrameViewAsh:: 585 FrameCaptionButtonContainerView* CustomFrameViewAsh::
574 GetFrameCaptionButtonContainerViewForTest() { 586 GetFrameCaptionButtonContainerViewForTest() {
575 return header_view_->caption_button_container(); 587 return header_view_->caption_button_container();
576 } 588 }
577 589
578 int CustomFrameViewAsh::NonClientTopBorderHeight() const { 590 int CustomFrameViewAsh::NonClientTopBorderHeight() const {
579 return frame_->IsFullscreen() ? 0 : header_view_->GetPreferredHeight(); 591 return frame_->IsFullscreen() ? 0 : header_view_->GetPreferredHeight();
580 } 592 }
581 593
582 } // namespace ash 594 } // namespace ash
OLDNEW
« no previous file with comments | « ash/frame/custom_frame_view_ash.h ('k') | ash/frame/default_header_painter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698