| 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 "chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.h" | 5 #include "chrome/browser/ui/views/frame/browser_non_client_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/frame_border_hit_test_controller.h" | 9 #include "ash/wm/frame_border_hit_test_controller.h" |
| 10 #include "ash/wm/header_painter.h" | 10 #include "ash/wm/header_painter.h" |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 // The primary header image changes based on window activation state and | 246 // The primary header image changes based on window activation state and |
| 247 // theme, so we look it up for each paint. | 247 // theme, so we look it up for each paint. |
| 248 int theme_frame_image_id = GetThemeFrameImageId(); | 248 int theme_frame_image_id = GetThemeFrameImageId(); |
| 249 int theme_frame_overlay_image_id = GetThemeFrameOverlayImageId(); | 249 int theme_frame_overlay_image_id = GetThemeFrameOverlayImageId(); |
| 250 | 250 |
| 251 ui::ThemeProvider* theme_provider = GetThemeProvider(); | 251 ui::ThemeProvider* theme_provider = GetThemeProvider(); |
| 252 if (!theme_provider->HasCustomImage(theme_frame_image_id) && | 252 if (!theme_provider->HasCustomImage(theme_frame_image_id) && |
| 253 (theme_frame_overlay_image_id == 0 || | 253 (theme_frame_overlay_image_id == 0 || |
| 254 !theme_provider->HasCustomImage(theme_frame_overlay_image_id))) { | 254 !theme_provider->HasCustomImage(theme_frame_overlay_image_id))) { |
| 255 if (frame()->IsMaximized() || frame()->IsFullscreen()) | 255 if (frame()->IsMaximized() || frame()->IsFullscreen()) |
| 256 theme_frame_image_id = IDR_AURA_WINDOW_HEADER_BASE_MINIMAL; | 256 theme_frame_image_id = IDR_AURA_BROWSER_WINDOW_HEADER_BASE_MAXIMIZED; |
| 257 } | 257 } |
| 258 header_painter_->PaintHeader( | 258 header_painter_->PaintHeader( |
| 259 canvas, | 259 canvas, |
| 260 theme_frame_image_id, | 260 theme_frame_image_id, |
| 261 theme_frame_overlay_image_id); | 261 theme_frame_overlay_image_id); |
| 262 if (browser_view()->ShouldShowWindowTitle()) | 262 if (browser_view()->ShouldShowWindowTitle()) |
| 263 header_painter_->PaintTitleBar(canvas, BrowserFrame::GetTitleFontList()); | 263 header_painter_->PaintTitleBar(canvas, BrowserFrame::GetTitleFontList()); |
| 264 if (browser_view()->IsToolbarVisible()) | 264 if (browser_view()->IsToolbarVisible()) |
| 265 PaintToolbarBackground(canvas); | 265 PaintToolbarBackground(canvas); |
| 266 else | 266 else |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 browser_view()->immersive_mode_controller(); | 429 browser_view()->immersive_mode_controller(); |
| 430 return immersive_mode_controller->IsEnabled() && | 430 return immersive_mode_controller->IsEnabled() && |
| 431 (immersive_mode_controller->IsRevealed() || | 431 (immersive_mode_controller->IsRevealed() || |
| 432 UseImmersiveLightbarHeaderStyle()); | 432 UseImmersiveLightbarHeaderStyle()); |
| 433 } | 433 } |
| 434 | 434 |
| 435 void BrowserNonClientFrameViewAsh::PaintImmersiveLightbarStyleHeader( | 435 void BrowserNonClientFrameViewAsh::PaintImmersiveLightbarStyleHeader( |
| 436 gfx::Canvas* canvas) { | 436 gfx::Canvas* canvas) { |
| 437 // The light bar header is not themed because theming it does not look good. | 437 // The light bar header is not themed because theming it does not look good. |
| 438 gfx::ImageSkia* frame_image = GetThemeProvider()->GetImageSkiaNamed( | 438 gfx::ImageSkia* frame_image = GetThemeProvider()->GetImageSkiaNamed( |
| 439 IDR_AURA_WINDOW_HEADER_BASE_MINIMAL); | 439 IDR_AURA_BROWSER_WINDOW_HEADER_BASE_MAXIMIZED); |
| 440 canvas->TileImageInt(*frame_image, 0, 0, width(), frame_image->height()); | 440 canvas->TileImageInt(*frame_image, 0, 0, width(), frame_image->height()); |
| 441 } | 441 } |
| 442 | 442 |
| 443 void BrowserNonClientFrameViewAsh::PaintToolbarBackground(gfx::Canvas* canvas) { | 443 void BrowserNonClientFrameViewAsh::PaintToolbarBackground(gfx::Canvas* canvas) { |
| 444 gfx::Rect toolbar_bounds(browser_view()->GetToolbarBounds()); | 444 gfx::Rect toolbar_bounds(browser_view()->GetToolbarBounds()); |
| 445 if (toolbar_bounds.IsEmpty()) | 445 if (toolbar_bounds.IsEmpty()) |
| 446 return; | 446 return; |
| 447 gfx::Point toolbar_origin(toolbar_bounds.origin()); | 447 gfx::Point toolbar_origin(toolbar_bounds.origin()); |
| 448 View::ConvertPointToTarget(browser_view(), this, &toolbar_origin); | 448 View::ConvertPointToTarget(browser_view(), this, &toolbar_origin); |
| 449 toolbar_bounds.set_origin(toolbar_origin); | 449 toolbar_bounds.set_origin(toolbar_origin); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 if (ShouldPaintAsActive()) { | 532 if (ShouldPaintAsActive()) { |
| 533 return is_incognito ? | 533 return is_incognito ? |
| 534 IDR_THEME_FRAME_INCOGNITO : IDR_THEME_FRAME; | 534 IDR_THEME_FRAME_INCOGNITO : IDR_THEME_FRAME; |
| 535 } | 535 } |
| 536 return is_incognito ? | 536 return is_incognito ? |
| 537 IDR_THEME_FRAME_INCOGNITO_INACTIVE : IDR_THEME_FRAME_INACTIVE; | 537 IDR_THEME_FRAME_INCOGNITO_INACTIVE : IDR_THEME_FRAME_INACTIVE; |
| 538 } | 538 } |
| 539 // Never theme app and popup windows. | 539 // Never theme app and popup windows. |
| 540 if (ShouldPaintAsActive()) { | 540 if (ShouldPaintAsActive()) { |
| 541 return is_incognito ? | 541 return is_incognito ? |
| 542 IDR_AURA_WINDOW_HEADER_BASE_INCOGNITO_ACTIVE : | 542 IDR_AURA_BROWSER_WINDOW_HEADER_BASE_RESTORED_INCOGNITO_ACTIVE : |
| 543 IDR_AURA_WINDOW_HEADER_BASE_ACTIVE; | 543 IDR_AURA_BROWSER_WINDOW_HEADER_BASE_RESTORED_ACTIVE; |
| 544 } | 544 } |
| 545 return is_incognito ? | 545 return is_incognito ? |
| 546 IDR_AURA_WINDOW_HEADER_BASE_INCOGNITO_INACTIVE : | 546 IDR_AURA_BROWSER_WINDOW_HEADER_BASE_RESTORED_INCOGNITO_INACTIVE : |
| 547 IDR_AURA_WINDOW_HEADER_BASE_INACTIVE; | 547 IDR_AURA_BROWSER_WINDOW_HEADER_BASE_RESTORED_INACTIVE; |
| 548 } | 548 } |
| 549 | 549 |
| 550 int BrowserNonClientFrameViewAsh::GetThemeFrameOverlayImageId() const { | 550 int BrowserNonClientFrameViewAsh::GetThemeFrameOverlayImageId() const { |
| 551 ui::ThemeProvider* tp = GetThemeProvider(); | 551 ui::ThemeProvider* tp = GetThemeProvider(); |
| 552 if (tp->HasCustomImage(IDR_THEME_FRAME_OVERLAY) && | 552 if (tp->HasCustomImage(IDR_THEME_FRAME_OVERLAY) && |
| 553 browser_view()->IsBrowserTypeNormal() && | 553 browser_view()->IsBrowserTypeNormal() && |
| 554 !browser_view()->IsOffTheRecord()) { | 554 !browser_view()->IsOffTheRecord()) { |
| 555 return ShouldPaintAsActive() ? | 555 return ShouldPaintAsActive() ? |
| 556 IDR_THEME_FRAME_OVERLAY : IDR_THEME_FRAME_OVERLAY_INACTIVE; | 556 IDR_THEME_FRAME_OVERLAY : IDR_THEME_FRAME_OVERLAY_INACTIVE; |
| 557 } | 557 } |
| 558 return 0; | 558 return 0; |
| 559 } | 559 } |
| OLD | NEW |