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

Side by Side Diff: chrome/browser/ui/views/frame/opaque_browser_frame_view.cc

Issue 244893004: Improve some naming (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/opaque_browser_frame_view.h" 5 #include "chrome/browser/ui/views/frame/opaque_browser_frame_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 ui::ThemeProvider* tp = GetThemeProvider(); 640 ui::ThemeProvider* tp = GetThemeProvider();
641 frame_background_->set_frame_color(GetFrameColor()); 641 frame_background_->set_frame_color(GetFrameColor());
642 frame_background_->set_theme_image(GetFrameImage()); 642 frame_background_->set_theme_image(GetFrameImage());
643 frame_background_->set_theme_overlay_image(GetFrameOverlayImage()); 643 frame_background_->set_theme_overlay_image(GetFrameOverlayImage());
644 frame_background_->set_top_area_height(GetTopAreaHeight()); 644 frame_background_->set_top_area_height(GetTopAreaHeight());
645 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) 645 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
646 // The window manager typically shows a gradient in the native title bar (when 646 // The window manager typically shows a gradient in the native title bar (when
647 // the system title bar pref is set, or when maximized on Ubuntu). Hide the 647 // the system title bar pref is set, or when maximized on Ubuntu). Hide the
648 // gradient in the tab strip (by shifting it up vertically) to avoid a 648 // gradient in the tab strip (by shifting it up vertically) to avoid a
649 // double-gradient effect. 649 // double-gradient effect.
650 if (tp->UsingNativeTheme()) 650 if (tp->UsingSystemTheme())
651 frame_background_->set_maximized_top_inset(kGTKThemeCondensedFrameTopInset); 651 frame_background_->set_maximized_top_inset(kGTKThemeCondensedFrameTopInset);
652 #endif 652 #endif
653 653
654 frame_background_->PaintMaximized(canvas, this); 654 frame_background_->PaintMaximized(canvas, this);
655 655
656 // TODO(jamescook): Migrate this into FrameBackground. 656 // TODO(jamescook): Migrate this into FrameBackground.
657 if (!browser_view()->IsToolbarVisible()) { 657 if (!browser_view()->IsToolbarVisible()) {
658 // There's no toolbar to edge the frame border, so we need to draw a bottom 658 // There's no toolbar to edge the frame border, so we need to draw a bottom
659 // edge. The graphic we use for this has a built in client edge, so we clip 659 // edge. The graphic we use for this has a built in client edge, so we clip
660 // it off the bottom. 660 // it off the bottom.
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
863 color_id = is_incognito ? 863 color_id = is_incognito ?
864 ThemeProperties::COLOR_FRAME_INCOGNITO : 864 ThemeProperties::COLOR_FRAME_INCOGNITO :
865 ThemeProperties::COLOR_FRAME; 865 ThemeProperties::COLOR_FRAME;
866 } else { 866 } else {
867 color_id = is_incognito ? 867 color_id = is_incognito ?
868 ThemeProperties::COLOR_FRAME_INCOGNITO_INACTIVE : 868 ThemeProperties::COLOR_FRAME_INCOGNITO_INACTIVE :
869 ThemeProperties::COLOR_FRAME_INACTIVE; 869 ThemeProperties::COLOR_FRAME_INACTIVE;
870 } 870 }
871 871
872 if (browser_view()->IsBrowserTypeNormal() || 872 if (browser_view()->IsBrowserTypeNormal() ||
873 platform_observer_->IsUsingNativeTheme()) { 873 platform_observer_->IsUsingSystemTheme()) {
874 return GetThemeProvider()->GetColor(color_id); 874 return GetThemeProvider()->GetColor(color_id);
875 } 875 }
876 876
877 // Never theme app and popup windows unless the |platform_observer_| 877 // Never theme app and popup windows unless the |platform_observer_|
878 // requested an override. 878 // requested an override.
879 return ThemeProperties::GetDefaultColor(color_id); 879 return ThemeProperties::GetDefaultColor(color_id);
880 } 880 }
881 881
882 gfx::ImageSkia* OpaqueBrowserFrameView::GetFrameImage() const { 882 gfx::ImageSkia* OpaqueBrowserFrameView::GetFrameImage() const {
883 bool is_incognito = browser_view()->IsOffTheRecord(); 883 bool is_incognito = browser_view()->IsOffTheRecord();
884 int resource_id; 884 int resource_id;
885 if (browser_view()->IsBrowserTypeNormal()) { 885 if (browser_view()->IsBrowserTypeNormal()) {
886 if (ShouldPaintAsActive()) { 886 if (ShouldPaintAsActive()) {
887 resource_id = is_incognito ? 887 resource_id = is_incognito ?
888 IDR_THEME_FRAME_INCOGNITO : IDR_THEME_FRAME; 888 IDR_THEME_FRAME_INCOGNITO : IDR_THEME_FRAME;
889 } else { 889 } else {
890 resource_id = is_incognito ? 890 resource_id = is_incognito ?
891 IDR_THEME_FRAME_INCOGNITO_INACTIVE : IDR_THEME_FRAME_INACTIVE; 891 IDR_THEME_FRAME_INCOGNITO_INACTIVE : IDR_THEME_FRAME_INACTIVE;
892 } 892 }
893 return GetThemeProvider()->GetImageSkiaNamed(resource_id); 893 return GetThemeProvider()->GetImageSkiaNamed(resource_id);
894 } 894 }
895 if (ShouldPaintAsActive()) { 895 if (ShouldPaintAsActive()) {
896 resource_id = is_incognito ? 896 resource_id = is_incognito ?
897 IDR_THEME_FRAME_INCOGNITO : IDR_FRAME; 897 IDR_THEME_FRAME_INCOGNITO : IDR_FRAME;
898 } else { 898 } else {
899 resource_id = is_incognito ? 899 resource_id = is_incognito ?
900 IDR_THEME_FRAME_INCOGNITO_INACTIVE : IDR_THEME_FRAME_INACTIVE; 900 IDR_THEME_FRAME_INCOGNITO_INACTIVE : IDR_THEME_FRAME_INACTIVE;
901 } 901 }
902 902
903 if (platform_observer_->IsUsingNativeTheme()) { 903 if (platform_observer_->IsUsingSystemTheme()) {
904 // We want to use theme images provided by the platform theme when enabled, 904 // We want to use theme images provided by the platform theme when enabled,
905 // even if we are an app or popup window. 905 // even if we are an app or popup window.
906 return GetThemeProvider()->GetImageSkiaNamed(resource_id); 906 return GetThemeProvider()->GetImageSkiaNamed(resource_id);
907 } 907 }
908 908
909 // Otherwise, never theme app and popup windows. 909 // Otherwise, never theme app and popup windows.
910 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 910 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
911 return rb.GetImageSkiaNamed(chrome::MapThemeImage( 911 return rb.GetImageSkiaNamed(chrome::MapThemeImage(
912 chrome::GetHostDesktopTypeForNativeWindow( 912 chrome::GetHostDesktopTypeForNativeWindow(
913 browser_view()->GetNativeWindow()), 913 browser_view()->GetNativeWindow()),
(...skipping 13 matching lines...) Expand all
927 927
928 int OpaqueBrowserFrameView::GetTopAreaHeight() const { 928 int OpaqueBrowserFrameView::GetTopAreaHeight() const {
929 gfx::ImageSkia* frame_image = GetFrameImage(); 929 gfx::ImageSkia* frame_image = GetFrameImage();
930 int top_area_height = frame_image->height(); 930 int top_area_height = frame_image->height();
931 if (browser_view()->IsTabStripVisible()) { 931 if (browser_view()->IsTabStripVisible()) {
932 top_area_height = std::max(top_area_height, 932 top_area_height = std::max(top_area_height,
933 GetBoundsForTabStrip(browser_view()->tabstrip()).bottom()); 933 GetBoundsForTabStrip(browser_view()->tabstrip()).bottom());
934 } 934 }
935 return top_area_height; 935 return top_area_height;
936 } 936 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698