| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ash/common/ash_layout_constants.h" | 9 #include "ash/common/ash_layout_constants.h" |
| 10 #include "ash/common/frame/caption_buttons/frame_caption_button_container_view.h
" | 10 #include "ash/common/frame/caption_buttons/frame_caption_button_container_view.h
" |
| 11 #include "ash/common/frame/default_header_painter.h" | 11 #include "ash/common/frame/default_header_painter.h" |
| 12 #include "ash/common/frame/frame_border_hit_test.h" | 12 #include "ash/common/frame/frame_border_hit_test.h" |
| 13 #include "ash/common/frame/header_painter_util.h" | 13 #include "ash/common/frame/header_painter_util.h" |
| 14 #include "ash/common/material_design/material_design_controller.h" |
| 14 #include "ash/common/wm_lookup.h" | 15 #include "ash/common/wm_lookup.h" |
| 15 #include "ash/common/wm_shell.h" | 16 #include "ash/common/wm_shell.h" |
| 16 #include "ash/common/wm_window.h" | 17 #include "ash/common/wm_window.h" |
| 17 #include "build/build_config.h" | 18 #include "build/build_config.h" |
| 18 #include "chrome/browser/profiles/profiles_state.h" | 19 #include "chrome/browser/profiles/profiles_state.h" |
| 19 #include "chrome/browser/themes/theme_properties.h" | 20 #include "chrome/browser/themes/theme_properties.h" |
| 20 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" | 21 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" |
| 21 #include "chrome/browser/ui/browser.h" | 22 #include "chrome/browser/ui/browser.h" |
| 22 #include "chrome/browser/ui/layout_constants.h" | 23 #include "chrome/browser/ui/layout_constants.h" |
| 23 #include "chrome/browser/ui/views/frame/browser_frame.h" | 24 #include "chrome/browser/ui/views/frame/browser_frame.h" |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 } | 256 } |
| 256 } | 257 } |
| 257 | 258 |
| 258 void BrowserNonClientFrameViewAsh::Layout() { | 259 void BrowserNonClientFrameViewAsh::Layout() { |
| 259 // The header must be laid out before computing |painted_height| because the | 260 // The header must be laid out before computing |painted_height| because the |
| 260 // computation of |painted_height| for app and popup windows depends on the | 261 // computation of |painted_height| for app and popup windows depends on the |
| 261 // position of the window controls. | 262 // position of the window controls. |
| 262 header_painter_->LayoutHeader(); | 263 header_painter_->LayoutHeader(); |
| 263 | 264 |
| 264 int painted_height = GetTopInset(false); | 265 int painted_height = GetTopInset(false); |
| 265 if (browser_view()->IsTabStripVisible()) | 266 if (browser_view()->IsTabStripVisible()) { |
| 266 painted_height += browser_view()->tabstrip()->GetPreferredSize().height(); | 267 const ImmersiveModeController* const immersive_controller = |
| 268 browser_view()->immersive_mode_controller(); |
| 269 if (!immersive_controller->IsEnabled() || |
| 270 immersive_controller->IsRevealed() || |
| 271 !ash::MaterialDesignController::IsImmersiveModeMaterial()) { |
| 272 painted_height += browser_view()->tabstrip()->GetPreferredSize().height(); |
| 273 } |
| 274 } |
| 267 | 275 |
| 268 header_painter_->SetHeaderHeightForPainting(painted_height); | 276 header_painter_->SetHeaderHeightForPainting(painted_height); |
| 269 | 277 |
| 270 if (profile_indicator_icon()) | 278 if (profile_indicator_icon()) |
| 271 LayoutProfileIndicatorIcon(); | 279 LayoutProfileIndicatorIcon(); |
| 272 BrowserNonClientFrameView::Layout(); | 280 BrowserNonClientFrameView::Layout(); |
| 273 frame()->GetNativeWindow()->SetProperty( | 281 frame()->GetNativeWindow()->SetProperty( |
| 274 aura::client::kTopViewInset, | 282 aura::client::kTopViewInset, |
| 275 browser_view()->IsTabStripVisible() ? 0 : GetTopInset(true)); | 283 browser_view()->IsTabStripVisible() ? 0 : GetTopInset(true)); |
| 276 } | 284 } |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 : 0; | 385 : 0; |
| 378 return avatar_right + kAvatarIconPadding; | 386 return avatar_right + kAvatarIconPadding; |
| 379 } | 387 } |
| 380 | 388 |
| 381 int BrowserNonClientFrameViewAsh::GetTabStripRightInset() const { | 389 int BrowserNonClientFrameViewAsh::GetTabStripRightInset() const { |
| 382 return kTabstripRightSpacing + | 390 return kTabstripRightSpacing + |
| 383 caption_button_container_->GetPreferredSize().width(); | 391 caption_button_container_->GetPreferredSize().width(); |
| 384 } | 392 } |
| 385 | 393 |
| 386 bool BrowserNonClientFrameViewAsh::UseImmersiveLightbarHeaderStyle() const { | 394 bool BrowserNonClientFrameViewAsh::UseImmersiveLightbarHeaderStyle() const { |
| 395 if (ash::MaterialDesignController::IsImmersiveModeMaterial()) |
| 396 return false; |
| 397 |
| 387 const ImmersiveModeController* const immersive_controller = | 398 const ImmersiveModeController* const immersive_controller = |
| 388 browser_view()->immersive_mode_controller(); | 399 browser_view()->immersive_mode_controller(); |
| 389 return immersive_controller->IsEnabled() && | 400 return immersive_controller->IsEnabled() && |
| 390 !immersive_controller->IsRevealed() && | 401 !immersive_controller->IsRevealed() && |
| 391 browser_view()->IsTabStripVisible(); | 402 browser_view()->IsTabStripVisible(); |
| 392 } | 403 } |
| 393 | 404 |
| 394 bool BrowserNonClientFrameViewAsh::UsePackagedAppHeaderStyle() const { | 405 bool BrowserNonClientFrameViewAsh::UsePackagedAppHeaderStyle() const { |
| 395 // Use for non tabbed trusted source windows, e.g. Settings, as well as apps. | 406 // Use for non tabbed trusted source windows, e.g. Settings, as well as apps. |
| 396 const Browser* const browser = browser_view()->browser(); | 407 const Browser* const browser = browser_view()->browser(); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 toolbar_bounds.width(), 0); | 477 toolbar_bounds.width(), 0); |
| 467 BrowserView::Paint1pxHorizontalLine(canvas, GetToolbarTopSeparatorColor(), | 478 BrowserView::Paint1pxHorizontalLine(canvas, GetToolbarTopSeparatorColor(), |
| 468 separator_rect, true); | 479 separator_rect, true); |
| 469 | 480 |
| 470 // Toolbar/content separator. | 481 // Toolbar/content separator. |
| 471 toolbar_bounds.Inset(kClientEdgeThickness, 0); | 482 toolbar_bounds.Inset(kClientEdgeThickness, 0); |
| 472 BrowserView::Paint1pxHorizontalLine( | 483 BrowserView::Paint1pxHorizontalLine( |
| 473 canvas, tp->GetColor(ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR), | 484 canvas, tp->GetColor(ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR), |
| 474 toolbar_bounds, true); | 485 toolbar_bounds, true); |
| 475 } | 486 } |
| OLD | NEW |