OLD | NEW |
---|---|
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/themes/theme_service.h" | 5 #include "chrome/browser/themes/theme_service.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
737 | 737 |
738 // static | 738 // static |
739 const ui::ThemeProvider& ThemeService::GetThemeProviderForProfile( | 739 const ui::ThemeProvider& ThemeService::GetThemeProviderForProfile( |
740 Profile* profile) { | 740 Profile* profile) { |
741 ThemeService* service = ThemeServiceFactory::GetForProfile(profile); | 741 ThemeService* service = ThemeServiceFactory::GetForProfile(profile); |
742 #if defined(OS_MACOSX) | 742 #if defined(OS_MACOSX) |
743 // TODO(estade): this doesn't work for OSX yet; fall back to normal theming | 743 // TODO(estade): this doesn't work for OSX yet; fall back to normal theming |
744 // in incognito. Since the OSX version of ThemeService caches colors, and | 744 // in incognito. Since the OSX version of ThemeService caches colors, and |
745 // both ThemeProviders use the same ThemeService some code needs to be | 745 // both ThemeProviders use the same ThemeService some code needs to be |
746 // rearranged. | 746 // rearranged. |
747 bool off_the_record = false; | 747 bool incognito = false; |
748 #else | 748 #else |
749 bool off_the_record = profile->IsOffTheRecord(); | 749 bool incognito = profile->GetProfileType() == Profile::INCOGNITO_PROFILE; |
Peter Kasting
2016/01/26 23:05:29
Nit: You might want to explicitly note why calling
| |
750 #endif | 750 #endif |
751 return off_the_record ? service->otr_theme_provider_ | 751 return incognito ? service->otr_theme_provider_ |
752 : service->original_theme_provider_; | 752 : service->original_theme_provider_; |
753 } | 753 } |
754 | 754 |
755 ThemeService::BrowserThemeProvider::BrowserThemeProvider( | 755 ThemeService::BrowserThemeProvider::BrowserThemeProvider( |
756 const ThemeService& theme_service, | 756 const ThemeService& theme_service, |
757 bool off_the_record) | 757 bool incognito) |
758 : theme_service_(theme_service), off_the_record_(off_the_record) {} | 758 : theme_service_(theme_service), incognito_(incognito) {} |
759 | 759 |
760 ThemeService::BrowserThemeProvider::~BrowserThemeProvider() {} | 760 ThemeService::BrowserThemeProvider::~BrowserThemeProvider() {} |
761 | 761 |
762 gfx::ImageSkia* ThemeService::BrowserThemeProvider::GetImageSkiaNamed( | 762 gfx::ImageSkia* ThemeService::BrowserThemeProvider::GetImageSkiaNamed( |
763 int id) const { | 763 int id) const { |
764 return theme_service_.GetImageSkiaNamed(id); | 764 return theme_service_.GetImageSkiaNamed(id); |
765 } | 765 } |
766 | 766 |
767 SkColor ThemeService::BrowserThemeProvider::GetColor(int id) const { | 767 SkColor ThemeService::BrowserThemeProvider::GetColor(int id) const { |
768 return theme_service_.GetColor(id, off_the_record_); | 768 return theme_service_.GetColor(id, incognito_); |
769 } | 769 } |
770 | 770 |
771 int ThemeService::BrowserThemeProvider::GetDisplayProperty(int id) const { | 771 int ThemeService::BrowserThemeProvider::GetDisplayProperty(int id) const { |
772 return theme_service_.GetDisplayProperty(id); | 772 return theme_service_.GetDisplayProperty(id); |
773 } | 773 } |
774 | 774 |
775 bool ThemeService::BrowserThemeProvider::ShouldUseNativeFrame() const { | 775 bool ThemeService::BrowserThemeProvider::ShouldUseNativeFrame() const { |
776 return theme_service_.ShouldUseNativeFrame(); | 776 return theme_service_.ShouldUseNativeFrame(); |
777 } | 777 } |
778 | 778 |
779 bool ThemeService::BrowserThemeProvider::HasCustomImage(int id) const { | 779 bool ThemeService::BrowserThemeProvider::HasCustomImage(int id) const { |
780 return theme_service_.HasCustomImage(id); | 780 return theme_service_.HasCustomImage(id); |
781 } | 781 } |
782 | 782 |
783 base::RefCountedMemory* ThemeService::BrowserThemeProvider::GetRawData( | 783 base::RefCountedMemory* ThemeService::BrowserThemeProvider::GetRawData( |
784 int id, | 784 int id, |
785 ui::ScaleFactor scale_factor) const { | 785 ui::ScaleFactor scale_factor) const { |
786 return theme_service_.GetRawData(id, scale_factor); | 786 return theme_service_.GetRawData(id, scale_factor); |
787 } | 787 } |
OLD | NEW |