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

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 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 0); 513 0);
514 gfx::ImageSkia* normal_background = 514 gfx::ImageSkia* normal_background =
515 GetThemeProvider()->GetImageSkiaNamed(IDR_CONTENT_TOP_CENTER); 515 GetThemeProvider()->GetImageSkiaNamed(IDR_CONTENT_TOP_CENTER);
516 size.SetToMax( 516 size.SetToMax(
517 gfx::Size(0, normal_background->height() - content_shadow_height())); 517 gfx::Size(0, normal_background->height() - content_shadow_height()));
518 } else { 518 } else {
519 const int kPopupBottomSpacingGlass = 1; 519 const int kPopupBottomSpacingGlass = 1;
520 const int kPopupBottomSpacingNonGlass = 2; 520 const int kPopupBottomSpacingNonGlass = 2;
521 size.Enlarge( 521 size.Enlarge(
522 0, 522 0,
523 PopupTopSpacing() + (GetWidget()->ShouldUseNativeFrame() ? 523 PopupTopSpacing() + (GetWidget()->ShouldWindowContentsBeTransparent() ?
524 kPopupBottomSpacingGlass : kPopupBottomSpacingNonGlass)); 524 kPopupBottomSpacingGlass : kPopupBottomSpacingNonGlass));
525 } 525 }
526 return size; 526 return size;
527 } 527 }
528 528
529 void ToolbarView::Layout() { 529 void ToolbarView::Layout() {
530 // If we have not been initialized yet just do nothing. 530 // If we have not been initialized yet just do nothing.
531 if (back_ == NULL) 531 if (back_ == NULL)
532 return; 532 return;
533 533
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 void ToolbarView::OnPaint(gfx::Canvas* canvas) { 656 void ToolbarView::OnPaint(gfx::Canvas* canvas) {
657 View::OnPaint(canvas); 657 View::OnPaint(canvas);
658 658
659 if (is_display_mode_normal()) 659 if (is_display_mode_normal())
660 return; 660 return;
661 661
662 // For glass, we need to draw a black line below the location bar to separate 662 // For glass, we need to draw a black line below the location bar to separate
663 // it from the content area. For non-glass, the NonClientView draws the 663 // it from the content area. For non-glass, the NonClientView draws the
664 // toolbar background below the location bar for us. 664 // toolbar background below the location bar for us.
665 // NOTE: Keep this in sync with BrowserView::GetInfoBarSeparatorColor()! 665 // NOTE: Keep this in sync with BrowserView::GetInfoBarSeparatorColor()!
666 if (GetWidget()->ShouldUseNativeFrame()) 666 if (GetWidget()->ShouldWindowContentsBeTransparent())
667 canvas->FillRect(gfx::Rect(0, height() - 1, width(), 1), SK_ColorBLACK); 667 canvas->FillRect(gfx::Rect(0, height() - 1, width(), 1), SK_ColorBLACK);
668 } 668 }
669 669
670 void ToolbarView::OnThemeChanged() { 670 void ToolbarView::OnThemeChanged() {
671 LoadImages(); 671 LoadImages();
672 } 672 }
673 673
674 const char* ToolbarView::GetClassName() const { 674 const char* ToolbarView::GetClassName() const {
675 return kViewClassName; 675 return kViewClassName;
676 } 676 }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 EnumerateModulesModel* loaded_modules = EnumerateModulesModel::GetInstance(); 732 EnumerateModulesModel* loaded_modules = EnumerateModulesModel::GetInstance();
733 loaded_modules->MaybePostScanningTask(); 733 loaded_modules->MaybePostScanningTask();
734 return loaded_modules->ShouldShowConflictWarning(); 734 return loaded_modules->ShouldShowConflictWarning();
735 #else 735 #else
736 return false; 736 return false;
737 #endif 737 #endif
738 } 738 }
739 739
740 int ToolbarView::PopupTopSpacing() const { 740 int ToolbarView::PopupTopSpacing() const {
741 const int kPopupTopSpacingNonGlass = 3; 741 const int kPopupTopSpacingNonGlass = 3;
742 return GetWidget()->ShouldUseNativeFrame() ? 0 : kPopupTopSpacingNonGlass; 742 return GetWidget()->ShouldWindowContentsBeTransparent()
743 ? 0
744 : kPopupTopSpacingNonGlass;
743 } 745 }
744 746
745 void ToolbarView::LoadImages() { 747 void ToolbarView::LoadImages() {
746 ui::ThemeProvider* tp = GetThemeProvider(); 748 ui::ThemeProvider* tp = GetThemeProvider();
747 749
748 back_->SetImage(views::Button::STATE_NORMAL, 750 back_->SetImage(views::Button::STATE_NORMAL,
749 *(tp->GetImageSkiaNamed(IDR_BACK))); 751 *(tp->GetImageSkiaNamed(IDR_BACK)));
750 back_->SetImage(views::Button::STATE_DISABLED, 752 back_->SetImage(views::Button::STATE_DISABLED,
751 *(tp->GetImageSkiaNamed(IDR_BACK_D))); 753 *(tp->GetImageSkiaNamed(IDR_BACK_D)));
752 754
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 835
834 void ToolbarView::OnShowHomeButtonChanged() { 836 void ToolbarView::OnShowHomeButtonChanged() {
835 Layout(); 837 Layout();
836 SchedulePaint(); 838 SchedulePaint();
837 } 839 }
838 840
839 int ToolbarView::content_shadow_height() const { 841 int ToolbarView::content_shadow_height() const {
840 return browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH ? 842 return browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH ?
841 kContentShadowHeightAsh : kContentShadowHeight; 843 kContentShadowHeightAsh : kContentShadowHeight;
842 } 844 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/tabs/tab_strip.cc ('k') | ui/views/widget/desktop_aura/desktop_native_widget_aura.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698