| OLD | NEW |
| 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/wm/custom_frame_view_ash.h" | 5 #include "ash/wm/custom_frame_view_ash.h" |
| 6 | 6 |
| 7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
| 8 #include "ash/wm/caption_buttons/frame_caption_button_container_view.h" | 8 #include "ash/wm/caption_buttons/frame_caption_button_container_view.h" |
| 9 #include "ash/wm/caption_buttons/frame_maximize_button.h" | 9 #include "ash/wm/caption_buttons/frame_maximize_button.h" |
| 10 #include "ash/wm/caption_buttons/frame_maximize_button_observer.h" | 10 #include "ash/wm/caption_buttons/frame_maximize_button_observer.h" |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 int CustomFrameViewAsh::HeaderView::GetMinimumWidth() const { | 256 int CustomFrameViewAsh::HeaderView::GetMinimumWidth() const { |
| 257 return header_painter_->GetMinimumHeaderWidth(); | 257 return header_painter_->GetMinimumHeaderWidth(); |
| 258 } | 258 } |
| 259 | 259 |
| 260 void CustomFrameViewAsh::HeaderView::Layout() { | 260 void CustomFrameViewAsh::HeaderView::Layout() { |
| 261 header_painter_->LayoutHeader(); | 261 header_painter_->LayoutHeader(); |
| 262 header_painter_->set_header_height(GetPreferredHeight()); | 262 header_painter_->set_header_height(GetPreferredHeight()); |
| 263 } | 263 } |
| 264 | 264 |
| 265 void CustomFrameViewAsh::HeaderView::OnPaint(gfx::Canvas* canvas) { | 265 void CustomFrameViewAsh::HeaderView::OnPaint(gfx::Canvas* canvas) { |
| 266 bool paint_as_active = |
| 267 frame_->non_client_view()->frame_view()->ShouldPaintAsActive(); |
| 268 caption_button_container_->SetPaintAsActive(paint_as_active); |
| 269 |
| 266 int theme_image_id = 0; | 270 int theme_image_id = 0; |
| 267 if (frame_->IsMaximized() || frame_->IsFullscreen()) | 271 if (paint_as_active) |
| 268 theme_image_id = IDR_AURA_WINDOW_HEADER_BASE_MINIMAL; | |
| 269 else if (frame_->non_client_view()->frame_view()->ShouldPaintAsActive()) | |
| 270 theme_image_id = IDR_AURA_WINDOW_HEADER_BASE_ACTIVE; | 272 theme_image_id = IDR_AURA_WINDOW_HEADER_BASE_ACTIVE; |
| 271 else | 273 else |
| 272 theme_image_id = IDR_AURA_WINDOW_HEADER_BASE_INACTIVE; | 274 theme_image_id = IDR_AURA_WINDOW_HEADER_BASE_INACTIVE; |
| 273 | 275 |
| 276 HeaderPainter::Mode header_mode = paint_as_active ? |
| 277 HeaderPainter::MODE_ACTIVE : HeaderPainter::MODE_INACTIVE; |
| 274 header_painter_->PaintHeader( | 278 header_painter_->PaintHeader( |
| 275 canvas, | 279 canvas, |
| 280 header_mode, |
| 276 theme_image_id, | 281 theme_image_id, |
| 277 0); | 282 0); |
| 278 header_painter_->PaintTitleBar(canvas, GetTitleFontList()); | 283 header_painter_->PaintTitleBar(canvas, GetTitleFontList()); |
| 279 header_painter_->PaintHeaderContentSeparator(canvas); | 284 header_painter_->PaintHeaderContentSeparator(canvas, header_mode); |
| 280 } | 285 } |
| 281 | 286 |
| 282 void CustomFrameViewAsh::HeaderView::OnImmersiveRevealStarted() { | 287 void CustomFrameViewAsh::HeaderView::OnImmersiveRevealStarted() { |
| 283 fullscreen_visible_fraction_ = 0; | 288 fullscreen_visible_fraction_ = 0; |
| 284 SetPaintToLayer(true); | 289 SetPaintToLayer(true); |
| 285 parent()->Layout(); | 290 parent()->Layout(); |
| 286 } | 291 } |
| 287 | 292 |
| 288 void CustomFrameViewAsh::HeaderView::OnImmersiveRevealEnded() { | 293 void CustomFrameViewAsh::HeaderView::OnImmersiveRevealEnded() { |
| 289 fullscreen_visible_fraction_ = 0; | 294 fullscreen_visible_fraction_ = 0; |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 } | 496 } |
| 492 | 497 |
| 493 //////////////////////////////////////////////////////////////////////////////// | 498 //////////////////////////////////////////////////////////////////////////////// |
| 494 // CustomFrameViewAsh, private: | 499 // CustomFrameViewAsh, private: |
| 495 | 500 |
| 496 int CustomFrameViewAsh::NonClientTopBorderHeight() const { | 501 int CustomFrameViewAsh::NonClientTopBorderHeight() const { |
| 497 return frame_->IsFullscreen() ? 0 : header_view_->GetPreferredHeight(); | 502 return frame_->IsFullscreen() ? 0 : header_view_->GetPreferredHeight(); |
| 498 } | 503 } |
| 499 | 504 |
| 500 } // namespace ash | 505 } // namespace ash |
| OLD | NEW |