Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(481)

Side by Side Diff: chrome/browser/ui/views/toolbar/toolbar_view.cc

Issue 136093007: Widget::ShouldUseNativeFrame is now meaningful on Linux. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/toolbar/toolbar_view.h" 5 #include "chrome/browser/ui/views/toolbar/toolbar_view.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/i18n/number_formatting.h" 9 #include "base/i18n/number_formatting.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 browser_actions_->GetPreferredSize().width() + 507 browser_actions_->GetPreferredSize().width() +
508 app_menu_->GetPreferredSize().width() + kRightEdgeSpacing, 508 app_menu_->GetPreferredSize().width() + kRightEdgeSpacing,
509 0); 509 0);
510 gfx::ImageSkia* normal_background = 510 gfx::ImageSkia* normal_background =
511 GetThemeProvider()->GetImageSkiaNamed(IDR_CONTENT_TOP_CENTER); 511 GetThemeProvider()->GetImageSkiaNamed(IDR_CONTENT_TOP_CENTER);
512 size.SetToMax( 512 size.SetToMax(
513 gfx::Size(0, normal_background->height() - content_shadow_height())); 513 gfx::Size(0, normal_background->height() - content_shadow_height()));
514 } else { 514 } else {
515 const int kPopupBottomSpacingGlass = 1; 515 const int kPopupBottomSpacingGlass = 1;
516 const int kPopupBottomSpacingNonGlass = 2; 516 const int kPopupBottomSpacingNonGlass = 2;
517 size.Enlarge( 517 size.Enlarge(0,
518 0, 518 PopupTopSpacing() + (UsingWindowsGlass()
519 PopupTopSpacing() + (GetWidget()->ShouldUseNativeFrame() ? 519 ? kPopupBottomSpacingGlass
520 kPopupBottomSpacingGlass : kPopupBottomSpacingNonGlass)); 520 : kPopupBottomSpacingNonGlass));
521 } 521 }
522 return size; 522 return size;
523 } 523 }
524 524
525 void ToolbarView::Layout() { 525 void ToolbarView::Layout() {
526 // If we have not been initialized yet just do nothing. 526 // If we have not been initialized yet just do nothing.
527 if (back_ == NULL) 527 if (back_ == NULL)
528 return; 528 return;
529 529
530 if (!is_display_mode_normal()) { 530 if (!is_display_mode_normal()) {
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 void ToolbarView::OnPaint(gfx::Canvas* canvas) { 649 void ToolbarView::OnPaint(gfx::Canvas* canvas) {
650 View::OnPaint(canvas); 650 View::OnPaint(canvas);
651 651
652 if (is_display_mode_normal()) 652 if (is_display_mode_normal())
653 return; 653 return;
654 654
655 // For glass, we need to draw a black line below the location bar to separate 655 // For glass, we need to draw a black line below the location bar to separate
656 // it from the content area. For non-glass, the NonClientView draws the 656 // it from the content area. For non-glass, the NonClientView draws the
657 // toolbar background below the location bar for us. 657 // toolbar background below the location bar for us.
658 // NOTE: Keep this in sync with BrowserView::GetInfoBarSeparatorColor()! 658 // NOTE: Keep this in sync with BrowserView::GetInfoBarSeparatorColor()!
659 if (GetWidget()->ShouldUseNativeFrame()) 659 if (UsingWindowsGlass())
660 canvas->FillRect(gfx::Rect(0, height() - 1, width(), 1), SK_ColorBLACK); 660 canvas->FillRect(gfx::Rect(0, height() - 1, width(), 1), SK_ColorBLACK);
661 } 661 }
662 662
663 void ToolbarView::OnThemeChanged() { 663 void ToolbarView::OnThemeChanged() {
664 LoadImages(); 664 LoadImages();
665 } 665 }
666 666
667 const char* ToolbarView::GetClassName() const { 667 const char* ToolbarView::GetClassName() const {
668 return kViewClassName; 668 return kViewClassName;
669 } 669 }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
725 EnumerateModulesModel* loaded_modules = EnumerateModulesModel::GetInstance(); 725 EnumerateModulesModel* loaded_modules = EnumerateModulesModel::GetInstance();
726 loaded_modules->MaybePostScanningTask(); 726 loaded_modules->MaybePostScanningTask();
727 return loaded_modules->ShouldShowConflictWarning(); 727 return loaded_modules->ShouldShowConflictWarning();
728 #else 728 #else
729 return false; 729 return false;
730 #endif 730 #endif
731 } 731 }
732 732
733 int ToolbarView::PopupTopSpacing() const { 733 int ToolbarView::PopupTopSpacing() const {
734 const int kPopupTopSpacingNonGlass = 3; 734 const int kPopupTopSpacingNonGlass = 3;
735 return GetWidget()->ShouldUseNativeFrame() ? 0 : kPopupTopSpacingNonGlass; 735 return UsingWindowsGlass() ? 0 : kPopupTopSpacingNonGlass;
736 }
737
738 bool ToolbarView::UsingWindowsGlass() const {
739 #if defined(OS_WIN)
740 return GetWidget()->ShouldUseNativeFrame();
741 #endif
742 return false;
736 } 743 }
737 744
738 void ToolbarView::LoadImages() { 745 void ToolbarView::LoadImages() {
739 ui::ThemeProvider* tp = GetThemeProvider(); 746 ui::ThemeProvider* tp = GetThemeProvider();
740 747
741 back_->SetImage(views::Button::STATE_NORMAL, 748 back_->SetImage(views::Button::STATE_NORMAL,
742 *(tp->GetImageSkiaNamed(IDR_BACK))); 749 *(tp->GetImageSkiaNamed(IDR_BACK)));
743 back_->SetImage(views::Button::STATE_DISABLED, 750 back_->SetImage(views::Button::STATE_DISABLED,
744 *(tp->GetImageSkiaNamed(IDR_BACK_D))); 751 *(tp->GetImageSkiaNamed(IDR_BACK_D)));
745 752
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 833
827 void ToolbarView::OnShowHomeButtonChanged() { 834 void ToolbarView::OnShowHomeButtonChanged() {
828 Layout(); 835 Layout();
829 SchedulePaint(); 836 SchedulePaint();
830 } 837 }
831 838
832 int ToolbarView::content_shadow_height() const { 839 int ToolbarView::content_shadow_height() const {
833 return browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH ? 840 return browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH ?
834 kContentShadowHeightAsh : kContentShadowHeight; 841 kContentShadowHeightAsh : kContentShadowHeight;
835 } 842 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698