| OLD | NEW |
| 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/themes/theme_service_aurax11.h" | 5 #include "chrome/browser/themes/theme_service_aurax11.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/themes/custom_theme_supplier.h" | 10 #include "chrome/browser/themes/custom_theme_supplier.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 DISALLOW_COPY_AND_ASSIGN(NativeThemeX11); | 35 DISALLOW_COPY_AND_ASSIGN(NativeThemeX11); |
| 36 }; | 36 }; |
| 37 | 37 |
| 38 NativeThemeX11::NativeThemeX11(PrefService* pref_service) | 38 NativeThemeX11::NativeThemeX11(PrefService* pref_service) |
| 39 : CustomThemeSupplier(NATIVE_X11), | 39 : CustomThemeSupplier(NATIVE_X11), |
| 40 linux_ui_(views::LinuxUI::instance()), | 40 linux_ui_(views::LinuxUI::instance()), |
| 41 pref_service_(pref_service) {} | 41 pref_service_(pref_service) {} |
| 42 | 42 |
| 43 void NativeThemeX11::StartUsingTheme() { | 43 void NativeThemeX11::StartUsingTheme() { |
| 44 if (linux_ui_) | |
| 45 linux_ui_->SetUseSystemTheme(true); | |
| 46 | |
| 47 pref_service_->SetBoolean(prefs::kUsesSystemTheme, true); | 44 pref_service_->SetBoolean(prefs::kUsesSystemTheme, true); |
| 48 } | 45 } |
| 49 | 46 |
| 50 void NativeThemeX11::StopUsingTheme() { | 47 void NativeThemeX11::StopUsingTheme() { |
| 51 if (linux_ui_) | |
| 52 linux_ui_->SetUseSystemTheme(false); | |
| 53 | |
| 54 pref_service_->SetBoolean(prefs::kUsesSystemTheme, false); | 48 pref_service_->SetBoolean(prefs::kUsesSystemTheme, false); |
| 55 } | 49 } |
| 56 | 50 |
| 57 bool NativeThemeX11::GetColor(int id, SkColor* color) const { | 51 bool NativeThemeX11::GetColor(int id, SkColor* color) const { |
| 58 return linux_ui_ && linux_ui_->GetColor(id, color); | 52 return linux_ui_ && linux_ui_->GetColor(id, color); |
| 59 } | 53 } |
| 60 | 54 |
| 61 gfx::Image NativeThemeX11::GetImageNamed(int id) { | 55 gfx::Image NativeThemeX11::GetImageNamed(int id) { |
| 62 return linux_ui_ ? linux_ui_->GetThemeImageNamed(id) : gfx::Image(); | 56 return linux_ui_ ? linux_ui_->GetThemeImageNamed(id) : gfx::Image(); |
| 63 } | 57 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 84 | 78 |
| 85 bool ThemeServiceAuraX11::UsingDefaultTheme() const { | 79 bool ThemeServiceAuraX11::UsingDefaultTheme() const { |
| 86 return ThemeService::UsingDefaultTheme() && !UsingNativeTheme(); | 80 return ThemeService::UsingDefaultTheme() && !UsingNativeTheme(); |
| 87 } | 81 } |
| 88 | 82 |
| 89 bool ThemeServiceAuraX11::UsingNativeTheme() const { | 83 bool ThemeServiceAuraX11::UsingNativeTheme() const { |
| 90 const CustomThemeSupplier* theme_supplier = get_theme_supplier(); | 84 const CustomThemeSupplier* theme_supplier = get_theme_supplier(); |
| 91 return theme_supplier && | 85 return theme_supplier && |
| 92 theme_supplier->get_theme_type() == CustomThemeSupplier::NATIVE_X11; | 86 theme_supplier->get_theme_type() == CustomThemeSupplier::NATIVE_X11; |
| 93 } | 87 } |
| OLD | NEW |