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