| 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/frame/caption_buttons/frame_caption_button_container_view.h" | 9 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h" |
| 10 #include "ash/frame/default_header_painter.h" | 10 #include "ash/frame/default_header_painter.h" |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 AddChildView(caption_button_container_); | 119 AddChildView(caption_button_container_); |
| 120 | 120 |
| 121 // Initializing the TabIconView is expensive, so only do it if we need to. | 121 // Initializing the TabIconView is expensive, so only do it if we need to. |
| 122 if (browser_view()->ShouldShowWindowIcon()) { | 122 if (browser_view()->ShouldShowWindowIcon()) { |
| 123 window_icon_ = new TabIconView(this, nullptr); | 123 window_icon_ = new TabIconView(this, nullptr); |
| 124 window_icon_->set_is_light(true); | 124 window_icon_->set_is_light(true); |
| 125 AddChildView(window_icon_); | 125 AddChildView(window_icon_); |
| 126 window_icon_->Update(); | 126 window_icon_->Update(); |
| 127 } | 127 } |
| 128 | 128 |
| 129 if (browser_view()->IsRegularOrGuestSession() && | 129 UpdateAvatar(); |
| 130 switches::IsNewAvatarMenu()) { | |
| 131 UpdateNewStyleAvatarInfo(this, NewAvatarButton::NATIVE_BUTTON); | |
| 132 } else { | |
| 133 UpdateAvatarInfo(); | |
| 134 } | |
| 135 | 130 |
| 136 // HeaderPainter handles layout. | 131 // HeaderPainter handles layout. |
| 137 if (UsePackagedAppHeaderStyle()) { | 132 if (UsePackagedAppHeaderStyle()) { |
| 138 ash::DefaultHeaderPainter* header_painter = new ash::DefaultHeaderPainter; | 133 ash::DefaultHeaderPainter* header_painter = new ash::DefaultHeaderPainter; |
| 139 header_painter_.reset(header_painter); | 134 header_painter_.reset(header_painter); |
| 140 header_painter->Init(frame(), this, caption_button_container_); | 135 header_painter->Init(frame(), this, caption_button_container_); |
| 141 if (window_icon_) { | 136 if (window_icon_) { |
| 142 header_painter->UpdateLeftHeaderView(window_icon_); | 137 header_painter->UpdateLeftHeaderView(window_icon_); |
| 143 } | 138 } |
| 144 } else if (UseWebAppHeaderStyle()) { | 139 } else if (UseWebAppHeaderStyle()) { |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 web_app_left_header_view_->Update(); | 210 web_app_left_header_view_->Update(); |
| 216 } | 211 } |
| 217 | 212 |
| 218 views::View* BrowserNonClientFrameViewAsh::GetLocationIconView() const { | 213 views::View* BrowserNonClientFrameViewAsh::GetLocationIconView() const { |
| 219 if (web_app_left_header_view_) | 214 if (web_app_left_header_view_) |
| 220 return web_app_left_header_view_->GetLocationIconView(); | 215 return web_app_left_header_view_->GetLocationIconView(); |
| 221 | 216 |
| 222 return nullptr; | 217 return nullptr; |
| 223 } | 218 } |
| 224 | 219 |
| 220 void BrowserNonClientFrameViewAsh::UpdateNewStyleAvatar() { |
| 221 UpdateNewStyleAvatarInfo(this, NewAvatarButton::NATIVE_BUTTON); |
| 222 } |
| 223 |
| 225 /////////////////////////////////////////////////////////////////////////////// | 224 /////////////////////////////////////////////////////////////////////////////// |
| 226 // views::NonClientFrameView: | 225 // views::NonClientFrameView: |
| 227 | 226 |
| 228 gfx::Rect BrowserNonClientFrameViewAsh::GetBoundsForClientView() const { | 227 gfx::Rect BrowserNonClientFrameViewAsh::GetBoundsForClientView() const { |
| 229 // The ClientView must be flush with the top edge of the widget so that the | 228 // The ClientView must be flush with the top edge of the widget so that the |
| 230 // web contents can take up the entire screen in immersive fullscreen (with | 229 // web contents can take up the entire screen in immersive fullscreen (with |
| 231 // or without the top-of-window views revealed). When in immersive fullscreen | 230 // or without the top-of-window views revealed). When in immersive fullscreen |
| 232 // and the top-of-window views are revealed, the TopContainerView paints the | 231 // and the top-of-window views are revealed, the TopContainerView paints the |
| 233 // window header by redirecting paints from its background to | 232 // window header by redirecting paints from its background to |
| 234 // BrowserNonClientFrameViewAsh. | 233 // BrowserNonClientFrameViewAsh. |
| (...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 665 ThemeProperties::COLOR_TOOLBAR_SEPARATOR)); | 664 ThemeProperties::COLOR_TOOLBAR_SEPARATOR)); |
| 666 } | 665 } |
| 667 | 666 |
| 668 void BrowserNonClientFrameViewAsh::PaintContentEdge(gfx::Canvas* canvas) { | 667 void BrowserNonClientFrameViewAsh::PaintContentEdge(gfx::Canvas* canvas) { |
| 669 DCHECK(!UsePackagedAppHeaderStyle() && !UseWebAppHeaderStyle()); | 668 DCHECK(!UsePackagedAppHeaderStyle() && !UseWebAppHeaderStyle()); |
| 670 canvas->FillRect(gfx::Rect(0, caption_button_container_->bounds().bottom(), | 669 canvas->FillRect(gfx::Rect(0, caption_button_container_->bounds().bottom(), |
| 671 width(), kClientEdgeThickness), | 670 width(), kClientEdgeThickness), |
| 672 ThemeProperties::GetDefaultColor( | 671 ThemeProperties::GetDefaultColor( |
| 673 ThemeProperties::COLOR_TOOLBAR_SEPARATOR)); | 672 ThemeProperties::COLOR_TOOLBAR_SEPARATOR)); |
| 674 } | 673 } |
| OLD | NEW |