| 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/material_design/material_design_controller.h" |
| 15 #include "ash/common/wm_lookup.h" | 15 #include "ash/common/wm_lookup.h" |
| 16 #include "ash/common/wm_shell.h" | 16 #include "ash/common/wm_shell.h" |
| 17 #include "ash/common/wm_window.h" | 17 #include "ash/common/wm_window.h" |
| 18 #include "base/feature_list.h" | |
| 19 #include "build/build_config.h" | 18 #include "build/build_config.h" |
| 20 #include "chrome/browser/profiles/profiles_state.h" | 19 #include "chrome/browser/profiles/profiles_state.h" |
| 21 #include "chrome/browser/themes/theme_properties.h" | 20 #include "chrome/browser/themes/theme_properties.h" |
| 22 #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" |
| 23 #include "chrome/browser/ui/browser.h" | 22 #include "chrome/browser/ui/browser.h" |
| 24 #include "chrome/browser/ui/layout_constants.h" | 23 #include "chrome/browser/ui/layout_constants.h" |
| 25 #include "chrome/browser/ui/views/frame/browser_frame.h" | 24 #include "chrome/browser/ui/views/frame/browser_frame.h" |
| 26 #include "chrome/browser/ui/views/frame/browser_header_painter_ash.h" | 25 #include "chrome/browser/ui/views/frame/browser_header_painter_ash.h" |
| 27 #include "chrome/browser/ui/views/frame/browser_view.h" | 26 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 28 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" | 27 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" |
| 29 #include "chrome/browser/ui/views/profiles/profile_indicator_icon.h" | 28 #include "chrome/browser/ui/views/profiles/profile_indicator_icon.h" |
| 30 #include "chrome/browser/ui/views/tab_icon_view.h" | 29 #include "chrome/browser/ui/views/tab_icon_view.h" |
| 31 #include "chrome/browser/ui/views/tabs/tab_strip.h" | 30 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
| 32 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" | 31 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" |
| 33 #include "chrome/browser/web_applications/web_app.h" | 32 #include "chrome/browser/web_applications/web_app.h" |
| 34 #include "chrome/common/chrome_features.h" | |
| 35 #include "chrome/grit/theme_resources.h" | 33 #include "chrome/grit/theme_resources.h" |
| 36 #include "content/public/browser/web_contents.h" | 34 #include "content/public/browser/web_contents.h" |
| 37 #include "third_party/skia/include/core/SkColor.h" | |
| 38 #include "ui/accessibility/ax_node_data.h" | 35 #include "ui/accessibility/ax_node_data.h" |
| 39 #include "ui/aura/client/aura_constants.h" | 36 #include "ui/aura/client/aura_constants.h" |
| 40 #include "ui/aura/window.h" | 37 #include "ui/aura/window.h" |
| 41 #include "ui/base/hit_test.h" | 38 #include "ui/base/hit_test.h" |
| 42 #include "ui/base/layout.h" | 39 #include "ui/base/layout.h" |
| 43 #include "ui/base/theme_provider.h" | 40 #include "ui/base/theme_provider.h" |
| 44 #include "ui/compositor/layer_animator.h" | 41 #include "ui/compositor/layer_animator.h" |
| 45 #include "ui/gfx/canvas.h" | 42 #include "ui/gfx/canvas.h" |
| 46 #include "ui/gfx/image/image_skia.h" | 43 #include "ui/gfx/image/image_skia.h" |
| 47 #include "ui/gfx/scoped_canvas.h" | 44 #include "ui/gfx/scoped_canvas.h" |
| 48 #include "ui/views/controls/label.h" | 45 #include "ui/views/controls/label.h" |
| 49 #include "ui/views/layout/layout_constants.h" | 46 #include "ui/views/layout/layout_constants.h" |
| 50 #include "ui/views/widget/widget.h" | 47 #include "ui/views/widget/widget.h" |
| 51 #include "ui/views/widget/widget_delegate.h" | 48 #include "ui/views/widget/widget_delegate.h" |
| 52 | 49 |
| 53 #if defined(OS_CHROMEOS) | 50 #if defined(OS_CHROMEOS) |
| 54 #include "ash/shared/app_types.h" | 51 #include "ash/shared/app_types.h" |
| 55 #endif | 52 #endif |
| 56 | 53 |
| 57 namespace { | 54 namespace { |
| 58 | 55 |
| 59 // Space between right edge of tabstrip and maximize button. | 56 // Space between right edge of tabstrip and maximize button. |
| 60 constexpr int kTabstripRightSpacing = 10; | 57 const int kTabstripRightSpacing = 10; |
| 61 // Height of the shadow in the tab image, used to ensure clicks in the shadow | 58 // Height of the shadow in the tab image, used to ensure clicks in the shadow |
| 62 // area still drag restored windows. This keeps the clickable area large enough | 59 // area still drag restored windows. This keeps the clickable area large enough |
| 63 // to hit easily. | 60 // to hit easily. |
| 64 constexpr int kTabShadowHeight = 4; | 61 const int kTabShadowHeight = 4; |
| 65 | |
| 66 constexpr SkColor kMdWebUIFrameColor = SkColorSetRGB(0x25, 0x4f, 0xae); | |
| 67 | 62 |
| 68 } // namespace | 63 } // namespace |
| 69 | 64 |
| 70 /////////////////////////////////////////////////////////////////////////////// | 65 /////////////////////////////////////////////////////////////////////////////// |
| 71 // BrowserNonClientFrameViewAsh, public: | 66 // BrowserNonClientFrameViewAsh, public: |
| 72 | 67 |
| 73 BrowserNonClientFrameViewAsh::BrowserNonClientFrameViewAsh( | 68 BrowserNonClientFrameViewAsh::BrowserNonClientFrameViewAsh( |
| 74 BrowserFrame* frame, | 69 BrowserFrame* frame, |
| 75 BrowserView* browser_view) | 70 BrowserView* browser_view) |
| 76 : BrowserNonClientFrameView(frame, browser_view), | 71 : BrowserNonClientFrameView(frame, browser_view), |
| (...skipping 21 matching lines...) Expand all Loading... |
| 98 AddChildView(window_icon_); | 93 AddChildView(window_icon_); |
| 99 window_icon_->Update(); | 94 window_icon_->Update(); |
| 100 } | 95 } |
| 101 | 96 |
| 102 if (UsePackagedAppHeaderStyle()) { | 97 if (UsePackagedAppHeaderStyle()) { |
| 103 ash::DefaultHeaderPainter* header_painter = new ash::DefaultHeaderPainter; | 98 ash::DefaultHeaderPainter* header_painter = new ash::DefaultHeaderPainter; |
| 104 header_painter_.reset(header_painter); | 99 header_painter_.reset(header_painter); |
| 105 header_painter->Init(frame(), this, caption_button_container_); | 100 header_painter->Init(frame(), this, caption_button_container_); |
| 106 if (window_icon_) | 101 if (window_icon_) |
| 107 header_painter->UpdateLeftHeaderView(window_icon_); | 102 header_painter->UpdateLeftHeaderView(window_icon_); |
| 108 if (base::FeatureList::IsEnabled(features::kMaterialDesignSettings)) { | |
| 109 // For non app (i.e. WebUI) windows (e.g. Settings) use MD frame color. | |
| 110 if (!browser_view()->browser()->is_app()) | |
| 111 header_painter->SetFrameColors(kMdWebUIFrameColor, kMdWebUIFrameColor); | |
| 112 } | |
| 113 } else { | 103 } else { |
| 114 BrowserHeaderPainterAsh* header_painter = new BrowserHeaderPainterAsh; | 104 BrowserHeaderPainterAsh* header_painter = new BrowserHeaderPainterAsh; |
| 115 header_painter_.reset(header_painter); | 105 header_painter_.reset(header_painter); |
| 116 header_painter->Init(frame(), browser_view(), this, window_icon_, | 106 header_painter->Init(frame(), browser_view(), this, window_icon_, |
| 117 caption_button_container_); | 107 caption_button_container_); |
| 118 } | 108 } |
| 119 | 109 |
| 120 #if defined(OS_CHROMEOS) | 110 #if defined(OS_CHROMEOS) |
| 121 if (browser_view()->browser()->is_app()) { | 111 if (browser_view()->browser()->is_app()) { |
| 122 frame()->GetNativeWindow()->SetProperty( | 112 frame()->GetNativeWindow()->SetProperty( |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 toolbar_bounds.width(), 0); | 477 toolbar_bounds.width(), 0); |
| 488 BrowserView::Paint1pxHorizontalLine(canvas, GetToolbarTopSeparatorColor(), | 478 BrowserView::Paint1pxHorizontalLine(canvas, GetToolbarTopSeparatorColor(), |
| 489 separator_rect, true); | 479 separator_rect, true); |
| 490 | 480 |
| 491 // Toolbar/content separator. | 481 // Toolbar/content separator. |
| 492 toolbar_bounds.Inset(kClientEdgeThickness, 0); | 482 toolbar_bounds.Inset(kClientEdgeThickness, 0); |
| 493 BrowserView::Paint1pxHorizontalLine( | 483 BrowserView::Paint1pxHorizontalLine( |
| 494 canvas, tp->GetColor(ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR), | 484 canvas, tp->GetColor(ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR), |
| 495 toolbar_bounds, true); | 485 toolbar_bounds, true); |
| 496 } | 486 } |
| OLD | NEW |