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

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: merge and ShouldInitWithSystemTheme 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 623 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 ui::ThemeProvider* tp = GetThemeProvider(); 634 ui::ThemeProvider* tp = GetThemeProvider();
635 frame_background_->set_frame_color(GetFrameColor()); 635 frame_background_->set_frame_color(GetFrameColor());
636 frame_background_->set_theme_image(GetFrameImage()); 636 frame_background_->set_theme_image(GetFrameImage());
637 frame_background_->set_theme_overlay_image(GetFrameOverlayImage()); 637 frame_background_->set_theme_overlay_image(GetFrameOverlayImage());
638 frame_background_->set_top_area_height(GetTopAreaHeight()); 638 frame_background_->set_top_area_height(GetTopAreaHeight());
639 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) 639 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
640 // The window manager typically shows a gradient in the native title bar (when 640 // The window manager typically shows a gradient in the native title bar (when
641 // the system title bar pref is set, or when maximized on Ubuntu). Hide the 641 // the system title bar pref is set, or when maximized on Ubuntu). Hide the
642 // gradient in the tab strip (by shifting it up vertically) to avoid a 642 // gradient in the tab strip (by shifting it up vertically) to avoid a
643 // double-gradient effect. 643 // double-gradient effect.
644 if (tp->UsingNativeTheme()) 644 if (tp->UsingSystemTheme())
645 frame_background_->set_maximized_top_inset(kGTKThemeCondensedFrameTopInset); 645 frame_background_->set_maximized_top_inset(kGTKThemeCondensedFrameTopInset);
646 #endif 646 #endif
647 647
648 frame_background_->PaintMaximized(canvas, this); 648 frame_background_->PaintMaximized(canvas, this);
649 649
650 // TODO(jamescook): Migrate this into FrameBackground. 650 // TODO(jamescook): Migrate this into FrameBackground.
651 if (!browser_view()->IsToolbarVisible()) { 651 if (!browser_view()->IsToolbarVisible()) {
652 // There's no toolbar to edge the frame border, so we need to draw a bottom 652 // There's no toolbar to edge the frame border, so we need to draw a bottom
653 // edge. The graphic we use for this has a built in client edge, so we clip 653 // edge. The graphic we use for this has a built in client edge, so we clip
654 // it off the bottom. 654 // it off the bottom.
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
857 color_id = is_incognito ? 857 color_id = is_incognito ?
858 ThemeProperties::COLOR_FRAME_INCOGNITO : 858 ThemeProperties::COLOR_FRAME_INCOGNITO :
859 ThemeProperties::COLOR_FRAME; 859 ThemeProperties::COLOR_FRAME;
860 } else { 860 } else {
861 color_id = is_incognito ? 861 color_id = is_incognito ?
862 ThemeProperties::COLOR_FRAME_INCOGNITO_INACTIVE : 862 ThemeProperties::COLOR_FRAME_INCOGNITO_INACTIVE :
863 ThemeProperties::COLOR_FRAME_INACTIVE; 863 ThemeProperties::COLOR_FRAME_INACTIVE;
864 } 864 }
865 865
866 if (browser_view()->IsBrowserTypeNormal() || 866 if (browser_view()->IsBrowserTypeNormal() ||
867 platform_observer_->IsUsingNativeTheme()) { 867 platform_observer_->IsUsingSystemTheme()) {
868 return GetThemeProvider()->GetColor(color_id); 868 return GetThemeProvider()->GetColor(color_id);
869 } 869 }
870 870
871 // Never theme app and popup windows unless the |platform_observer_| 871 // Never theme app and popup windows unless the |platform_observer_|
872 // requested an override. 872 // requested an override.
873 return ThemeProperties::GetDefaultColor(color_id); 873 return ThemeProperties::GetDefaultColor(color_id);
874 } 874 }
875 875
876 gfx::ImageSkia* OpaqueBrowserFrameView::GetFrameImage() const { 876 gfx::ImageSkia* OpaqueBrowserFrameView::GetFrameImage() const {
877 bool is_incognito = browser_view()->IsOffTheRecord(); 877 bool is_incognito = browser_view()->IsOffTheRecord();
878 int resource_id; 878 int resource_id;
879 if (browser_view()->IsBrowserTypeNormal()) { 879 if (browser_view()->IsBrowserTypeNormal()) {
880 if (ShouldPaintAsActive()) { 880 if (ShouldPaintAsActive()) {
881 resource_id = is_incognito ? 881 resource_id = is_incognito ?
882 IDR_THEME_FRAME_INCOGNITO : IDR_THEME_FRAME; 882 IDR_THEME_FRAME_INCOGNITO : IDR_THEME_FRAME;
883 } else { 883 } else {
884 resource_id = is_incognito ? 884 resource_id = is_incognito ?
885 IDR_THEME_FRAME_INCOGNITO_INACTIVE : IDR_THEME_FRAME_INACTIVE; 885 IDR_THEME_FRAME_INCOGNITO_INACTIVE : IDR_THEME_FRAME_INACTIVE;
886 } 886 }
887 return GetThemeProvider()->GetImageSkiaNamed(resource_id); 887 return GetThemeProvider()->GetImageSkiaNamed(resource_id);
888 } 888 }
889 if (ShouldPaintAsActive()) { 889 if (ShouldPaintAsActive()) {
890 resource_id = is_incognito ? 890 resource_id = is_incognito ?
891 IDR_THEME_FRAME_INCOGNITO : IDR_FRAME; 891 IDR_THEME_FRAME_INCOGNITO : IDR_FRAME;
892 } else { 892 } else {
893 resource_id = is_incognito ? 893 resource_id = is_incognito ?
894 IDR_THEME_FRAME_INCOGNITO_INACTIVE : IDR_THEME_FRAME_INACTIVE; 894 IDR_THEME_FRAME_INCOGNITO_INACTIVE : IDR_THEME_FRAME_INACTIVE;
895 } 895 }
896 896
897 if (platform_observer_->IsUsingNativeTheme()) { 897 if (platform_observer_->IsUsingSystemTheme()) {
898 // We want to use theme images provided by the platform theme when enabled, 898 // We want to use theme images provided by the platform theme when enabled,
899 // even if we are an app or popup window. 899 // even if we are an app or popup window.
900 return GetThemeProvider()->GetImageSkiaNamed(resource_id); 900 return GetThemeProvider()->GetImageSkiaNamed(resource_id);
901 } 901 }
902 902
903 // Otherwise, never theme app and popup windows. 903 // Otherwise, never theme app and popup windows.
904 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 904 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
905 return rb.GetImageSkiaNamed(chrome::MapThemeImage( 905 return rb.GetImageSkiaNamed(chrome::MapThemeImage(
906 chrome::GetHostDesktopTypeForNativeWindow( 906 chrome::GetHostDesktopTypeForNativeWindow(
907 browser_view()->GetNativeWindow()), 907 browser_view()->GetNativeWindow()),
(...skipping 13 matching lines...) Expand all
921 921
922 int OpaqueBrowserFrameView::GetTopAreaHeight() const { 922 int OpaqueBrowserFrameView::GetTopAreaHeight() const {
923 gfx::ImageSkia* frame_image = GetFrameImage(); 923 gfx::ImageSkia* frame_image = GetFrameImage();
924 int top_area_height = frame_image->height(); 924 int top_area_height = frame_image->height();
925 if (browser_view()->IsTabStripVisible()) { 925 if (browser_view()->IsTabStripVisible()) {
926 top_area_height = std::max(top_area_height, 926 top_area_height = std::max(top_area_height,
927 GetBoundsForTabStrip(browser_view()->tabstrip()).bottom()); 927 GetBoundsForTabStrip(browser_view()->tabstrip()).bottom());
928 } 928 }
929 return top_area_height; 929 return top_area_height;
930 } 930 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698