| 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 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 /////////////////////////////////////////////////////////////////////////////// | 444 /////////////////////////////////////////////////////////////////////////////// |
| 450 // views::ButtonListener: | 445 // views::ButtonListener: |
| 451 | 446 |
| 452 void BrowserNonClientFrameViewAsh::ButtonPressed(views::Button* sender, | 447 void BrowserNonClientFrameViewAsh::ButtonPressed(views::Button* sender, |
| 453 const ui::Event& event) { | 448 const ui::Event& event) { |
| 454 DCHECK(sender == new_avatar_button()); | 449 DCHECK(sender == new_avatar_button()); |
| 455 chrome::ExecuteCommand(browser_view()->browser(), IDC_SHOW_AVATAR_MENU); | 450 chrome::ExecuteCommand(browser_view()->browser(), IDC_SHOW_AVATAR_MENU); |
| 456 } | 451 } |
| 457 | 452 |
| 458 /////////////////////////////////////////////////////////////////////////////// | 453 /////////////////////////////////////////////////////////////////////////////// |
| 454 // BrowserNonClientFrameViewAsh, protected: |
| 455 |
| 456 // BrowserNonClientFrameView: |
| 457 void BrowserNonClientFrameViewAsh::UpdateNewStyleAvatar() { |
| 458 UpdateNewStyleAvatarInfo(this, NewAvatarButton::NATIVE_BUTTON); |
| 459 } |
| 460 |
| 461 /////////////////////////////////////////////////////////////////////////////// |
| 459 // BrowserNonClientFrameViewAsh, private: | 462 // BrowserNonClientFrameViewAsh, private: |
| 460 | 463 |
| 461 // views::NonClientFrameView: | 464 // views::NonClientFrameView: |
| 462 bool BrowserNonClientFrameViewAsh::DoesIntersectRect( | 465 bool BrowserNonClientFrameViewAsh::DoesIntersectRect( |
| 463 const views::View* target, | 466 const views::View* target, |
| 464 const gfx::Rect& rect) const { | 467 const gfx::Rect& rect) const { |
| 465 CHECK_EQ(target, this); | 468 CHECK_EQ(target, this); |
| 466 if (!views::ViewTargeterDelegate::DoesIntersectRect(this, rect)) { | 469 if (!views::ViewTargeterDelegate::DoesIntersectRect(this, rect)) { |
| 467 // |rect| is outside BrowserNonClientFrameViewAsh's bounds. | 470 // |rect| is outside BrowserNonClientFrameViewAsh's bounds. |
| 468 return false; | 471 return false; |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 665 ThemeProperties::COLOR_TOOLBAR_SEPARATOR)); | 668 ThemeProperties::COLOR_TOOLBAR_SEPARATOR)); |
| 666 } | 669 } |
| 667 | 670 |
| 668 void BrowserNonClientFrameViewAsh::PaintContentEdge(gfx::Canvas* canvas) { | 671 void BrowserNonClientFrameViewAsh::PaintContentEdge(gfx::Canvas* canvas) { |
| 669 DCHECK(!UsePackagedAppHeaderStyle() && !UseWebAppHeaderStyle()); | 672 DCHECK(!UsePackagedAppHeaderStyle() && !UseWebAppHeaderStyle()); |
| 670 canvas->FillRect(gfx::Rect(0, caption_button_container_->bounds().bottom(), | 673 canvas->FillRect(gfx::Rect(0, caption_button_container_->bounds().bottom(), |
| 671 width(), kClientEdgeThickness), | 674 width(), kClientEdgeThickness), |
| 672 ThemeProperties::GetDefaultColor( | 675 ThemeProperties::GetDefaultColor( |
| 673 ThemeProperties::COLOR_TOOLBAR_SEPARATOR)); | 676 ThemeProperties::COLOR_TOOLBAR_SEPARATOR)); |
| 674 } | 677 } |
| OLD | NEW |