Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_mus.h" | 5 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view_mus.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "chrome/browser/profiles/profiles_state.h" | 9 #include "chrome/browser/profiles/profiles_state.h" |
| 10 #include "chrome/browser/themes/theme_properties.h" | 10 #include "chrome/browser/themes/theme_properties.h" |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 364 void BrowserNonClientFrameViewMus::TabStripMaxXChanged(TabStrip* tab_strip) { | 364 void BrowserNonClientFrameViewMus::TabStripMaxXChanged(TabStrip* tab_strip) { |
| 365 UpdateClientArea(); | 365 UpdateClientArea(); |
| 366 } | 366 } |
| 367 | 367 |
| 368 void BrowserNonClientFrameViewMus::TabStripDeleted(TabStrip* tab_strip) { | 368 void BrowserNonClientFrameViewMus::TabStripDeleted(TabStrip* tab_strip) { |
| 369 tab_strip_->RemoveObserver(this); | 369 tab_strip_->RemoveObserver(this); |
| 370 tab_strip_ = nullptr; | 370 tab_strip_ = nullptr; |
| 371 } | 371 } |
| 372 | 372 |
| 373 int BrowserNonClientFrameViewMus::GetTabStripLeftInset() const { | 373 int BrowserNonClientFrameViewMus::GetTabStripLeftInset() const { |
| 374 const int pad = GetLayoutConstant(AVATAR_ICON_PADDING); | 374 const int pad = kAvatarIconPadding; |
|
Peter Kasting
2016/12/08 20:57:49
Nit: Use directly below?
Evan Stade
2016/12/13 01:31:17
Done.
| |
| 375 const int avatar_right = profile_indicator_icon() | 375 const int avatar_right = profile_indicator_icon() |
| 376 ? (pad + GetIncognitoAvatarIcon().width()) | 376 ? (pad + GetIncognitoAvatarIcon().width()) |
| 377 : 0; | 377 : 0; |
| 378 return avatar_right + pad + frame_values().normal_insets.left(); | 378 return avatar_right + pad + frame_values().normal_insets.left(); |
| 379 } | 379 } |
| 380 | 380 |
| 381 int BrowserNonClientFrameViewMus::GetTabStripRightInset() const { | 381 int BrowserNonClientFrameViewMus::GetTabStripRightInset() const { |
| 382 const int frame_right_insets = frame_values().normal_insets.right() + | 382 const int frame_right_insets = frame_values().normal_insets.right() + |
| 383 frame_values().max_title_bar_button_width; | 383 frame_values().max_title_bar_button_width; |
| 384 int right_inset = kTabstripRightSpacing + frame_right_insets; | 384 int right_inset = kTabstripRightSpacing + frame_right_insets; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 417 Browser::FEATURE_WEBAPPFRAME); | 417 Browser::FEATURE_WEBAPPFRAME); |
| 418 } | 418 } |
| 419 | 419 |
| 420 void BrowserNonClientFrameViewMus::LayoutIncognitoButton() { | 420 void BrowserNonClientFrameViewMus::LayoutIncognitoButton() { |
| 421 DCHECK(profile_indicator_icon()); | 421 DCHECK(profile_indicator_icon()); |
| 422 #if !defined(OS_CHROMEOS) | 422 #if !defined(OS_CHROMEOS) |
| 423 // ChromeOS shows avatar on V1 app. | 423 // ChromeOS shows avatar on V1 app. |
| 424 DCHECK(browser_view()->IsTabStripVisible()); | 424 DCHECK(browser_view()->IsTabStripVisible()); |
| 425 #endif | 425 #endif |
| 426 gfx::ImageSkia incognito_icon = GetIncognitoAvatarIcon(); | 426 gfx::ImageSkia incognito_icon = GetIncognitoAvatarIcon(); |
| 427 const int pad = GetLayoutConstant(AVATAR_ICON_PADDING); | 427 const int pad = kAvatarIconPadding; |
|
Peter Kasting
2016/12/08 20:57:49
Nit: Use directly below? Or make constexpr
Evan Stade
2016/12/13 01:31:17
Done.
| |
| 428 int avatar_bottom = | 428 int avatar_bottom = |
| 429 GetTopInset(false) + browser_view()->GetTabStripHeight() - pad; | 429 GetTopInset(false) + browser_view()->GetTabStripHeight() - pad; |
| 430 int avatar_y = avatar_bottom - incognito_icon.height(); | 430 int avatar_y = avatar_bottom - incognito_icon.height(); |
| 431 | 431 |
| 432 // Hide the incognito icon in immersive fullscreen when the tab light bar is | 432 // Hide the incognito icon in immersive fullscreen when the tab light bar is |
| 433 // visible because the header is too short for the icognito icon to be | 433 // visible because the header is too short for the icognito icon to be |
| 434 // recognizable. | 434 // recognizable. |
| 435 bool avatar_visible = !UseImmersiveLightbarHeaderStyle(); | 435 bool avatar_visible = !UseImmersiveLightbarHeaderStyle(); |
| 436 int avatar_height = avatar_visible ? incognito_icon.height() : 0; | 436 int avatar_height = avatar_visible ? incognito_icon.height() : 0; |
| 437 | 437 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 507 } | 507 } |
| 508 | 508 |
| 509 void BrowserNonClientFrameViewMus::PaintContentEdge(gfx::Canvas* canvas) { | 509 void BrowserNonClientFrameViewMus::PaintContentEdge(gfx::Canvas* canvas) { |
| 510 DCHECK(!UsePackagedAppHeaderStyle() && !UseWebAppHeaderStyle()); | 510 DCHECK(!UsePackagedAppHeaderStyle() && !UseWebAppHeaderStyle()); |
| 511 const int bottom = frame_values().normal_insets.bottom(); | 511 const int bottom = frame_values().normal_insets.bottom(); |
| 512 canvas->FillRect( | 512 canvas->FillRect( |
| 513 gfx::Rect(0, bottom, width(), kClientEdgeThickness), | 513 gfx::Rect(0, bottom, width(), kClientEdgeThickness), |
| 514 GetThemeProvider()->GetColor( | 514 GetThemeProvider()->GetColor( |
| 515 ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR)); | 515 ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR)); |
| 516 } | 516 } |
| OLD | NEW |