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

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: mac and win Created 6 years, 7 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 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 ui::ThemeProvider* tp = GetThemeProvider(); 609 ui::ThemeProvider* tp = GetThemeProvider();
610 frame_background_->set_frame_color(GetFrameColor()); 610 frame_background_->set_frame_color(GetFrameColor());
611 frame_background_->set_theme_image(GetFrameImage()); 611 frame_background_->set_theme_image(GetFrameImage());
612 frame_background_->set_theme_overlay_image(GetFrameOverlayImage()); 612 frame_background_->set_theme_overlay_image(GetFrameOverlayImage());
613 frame_background_->set_top_area_height(GetTopAreaHeight()); 613 frame_background_->set_top_area_height(GetTopAreaHeight());
614 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) 614 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
615 // The window manager typically shows a gradient in the native title bar (when 615 // The window manager typically shows a gradient in the native title bar (when
616 // the system title bar pref is set, or when maximized on Ubuntu). Hide the 616 // the system title bar pref is set, or when maximized on Ubuntu). Hide the
617 // gradient in the tab strip (by shifting it up vertically) to avoid a 617 // gradient in the tab strip (by shifting it up vertically) to avoid a
618 // double-gradient effect. 618 // double-gradient effect.
619 if (tp->UsingNativeTheme()) 619 if (tp->UsingSystemTheme())
620 frame_background_->set_maximized_top_inset(kGTKThemeCondensedFrameTopInset); 620 frame_background_->set_maximized_top_inset(kGTKThemeCondensedFrameTopInset);
621 #endif 621 #endif
622 622
623 frame_background_->PaintMaximized(canvas, this); 623 frame_background_->PaintMaximized(canvas, this);
624 624
625 // TODO(jamescook): Migrate this into FrameBackground. 625 // TODO(jamescook): Migrate this into FrameBackground.
626 if (!browser_view()->IsToolbarVisible()) { 626 if (!browser_view()->IsToolbarVisible()) {
627 // There's no toolbar to edge the frame border, so we need to draw a bottom 627 // There's no toolbar to edge the frame border, so we need to draw a bottom
628 // edge. The graphic we use for this has a built in client edge, so we clip 628 // edge. The graphic we use for this has a built in client edge, so we clip
629 // it off the bottom. 629 // it off the bottom.
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
832 color_id = is_incognito ? 832 color_id = is_incognito ?
833 ThemeProperties::COLOR_FRAME_INCOGNITO : 833 ThemeProperties::COLOR_FRAME_INCOGNITO :
834 ThemeProperties::COLOR_FRAME; 834 ThemeProperties::COLOR_FRAME;
835 } else { 835 } else {
836 color_id = is_incognito ? 836 color_id = is_incognito ?
837 ThemeProperties::COLOR_FRAME_INCOGNITO_INACTIVE : 837 ThemeProperties::COLOR_FRAME_INCOGNITO_INACTIVE :
838 ThemeProperties::COLOR_FRAME_INACTIVE; 838 ThemeProperties::COLOR_FRAME_INACTIVE;
839 } 839 }
840 840
841 if (browser_view()->IsBrowserTypeNormal() || 841 if (browser_view()->IsBrowserTypeNormal() ||
842 platform_observer_->IsUsingNativeTheme()) { 842 platform_observer_->IsUsingSystemTheme()) {
843 return GetThemeProvider()->GetColor(color_id); 843 return GetThemeProvider()->GetColor(color_id);
844 } 844 }
845 845
846 // Never theme app and popup windows unless the |platform_observer_| 846 // Never theme app and popup windows unless the |platform_observer_|
847 // requested an override. 847 // requested an override.
848 return ThemeProperties::GetDefaultColor(color_id); 848 return ThemeProperties::GetDefaultColor(color_id);
849 } 849 }
850 850
851 gfx::ImageSkia* OpaqueBrowserFrameView::GetFrameImage() const { 851 gfx::ImageSkia* OpaqueBrowserFrameView::GetFrameImage() const {
852 bool is_incognito = browser_view()->IsOffTheRecord(); 852 bool is_incognito = browser_view()->IsOffTheRecord();
853 int resource_id; 853 int resource_id;
854 if (browser_view()->IsBrowserTypeNormal()) { 854 if (browser_view()->IsBrowserTypeNormal()) {
855 if (ShouldPaintAsActive()) { 855 if (ShouldPaintAsActive()) {
856 resource_id = is_incognito ? 856 resource_id = is_incognito ?
857 IDR_THEME_FRAME_INCOGNITO : IDR_THEME_FRAME; 857 IDR_THEME_FRAME_INCOGNITO : IDR_THEME_FRAME;
858 } else { 858 } else {
859 resource_id = is_incognito ? 859 resource_id = is_incognito ?
860 IDR_THEME_FRAME_INCOGNITO_INACTIVE : IDR_THEME_FRAME_INACTIVE; 860 IDR_THEME_FRAME_INCOGNITO_INACTIVE : IDR_THEME_FRAME_INACTIVE;
861 } 861 }
862 return GetThemeProvider()->GetImageSkiaNamed(resource_id); 862 return GetThemeProvider()->GetImageSkiaNamed(resource_id);
863 } 863 }
864 if (ShouldPaintAsActive()) { 864 if (ShouldPaintAsActive()) {
865 resource_id = is_incognito ? 865 resource_id = is_incognito ?
866 IDR_THEME_FRAME_INCOGNITO : IDR_FRAME; 866 IDR_THEME_FRAME_INCOGNITO : IDR_FRAME;
867 } else { 867 } else {
868 resource_id = is_incognito ? 868 resource_id = is_incognito ?
869 IDR_THEME_FRAME_INCOGNITO_INACTIVE : IDR_THEME_FRAME_INACTIVE; 869 IDR_THEME_FRAME_INCOGNITO_INACTIVE : IDR_THEME_FRAME_INACTIVE;
870 } 870 }
871 871
872 if (platform_observer_->IsUsingNativeTheme()) { 872 if (platform_observer_->IsUsingSystemTheme()) {
873 // We want to use theme images provided by the platform theme when enabled, 873 // We want to use theme images provided by the system theme when enabled,
874 // even if we are an app or popup window. 874 // even if we are an app or popup window.
875 return GetThemeProvider()->GetImageSkiaNamed(resource_id); 875 return GetThemeProvider()->GetImageSkiaNamed(resource_id);
876 } 876 }
877 877
878 // Otherwise, never theme app and popup windows. 878 // Otherwise, never theme app and popup windows.
879 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 879 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
880 return rb.GetImageSkiaNamed(chrome::MapThemeImage( 880 return rb.GetImageSkiaNamed(chrome::MapThemeImage(
881 chrome::GetHostDesktopTypeForNativeWindow( 881 chrome::GetHostDesktopTypeForNativeWindow(
882 browser_view()->GetNativeWindow()), 882 browser_view()->GetNativeWindow()),
883 resource_id)); 883 resource_id));
(...skipping 12 matching lines...) Expand all
896 896
897 int OpaqueBrowserFrameView::GetTopAreaHeight() const { 897 int OpaqueBrowserFrameView::GetTopAreaHeight() const {
898 gfx::ImageSkia* frame_image = GetFrameImage(); 898 gfx::ImageSkia* frame_image = GetFrameImage();
899 int top_area_height = frame_image->height(); 899 int top_area_height = frame_image->height();
900 if (browser_view()->IsTabStripVisible()) { 900 if (browser_view()->IsTabStripVisible()) {
901 top_area_height = std::max(top_area_height, 901 top_area_height = std::max(top_area_height,
902 GetBoundsForTabStrip(browser_view()->tabstrip()).bottom()); 902 GetBoundsForTabStrip(browser_view()->tabstrip()).bottom());
903 } 903 }
904 return top_area_height; 904 return top_area_height;
905 } 905 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698