Chromium Code Reviews| 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 25 matching lines...) Expand all Loading... | |
| 36 DISALLOW_COPY_AND_ASSIGN(SystemThemeX11); | 36 DISALLOW_COPY_AND_ASSIGN(SystemThemeX11); |
| 37 }; | 37 }; |
| 38 | 38 |
| 39 SystemThemeX11::SystemThemeX11(PrefService* pref_service) | 39 SystemThemeX11::SystemThemeX11(PrefService* pref_service) |
| 40 : CustomThemeSupplier(NATIVE_X11), | 40 : CustomThemeSupplier(NATIVE_X11), |
| 41 linux_ui_(views::LinuxUI::instance()), | 41 linux_ui_(views::LinuxUI::instance()), |
| 42 pref_service_(pref_service) {} | 42 pref_service_(pref_service) {} |
| 43 | 43 |
| 44 void SystemThemeX11::StartUsingTheme() { | 44 void SystemThemeX11::StartUsingTheme() { |
| 45 pref_service_->SetBoolean(prefs::kUsesSystemTheme, true); | 45 pref_service_->SetBoolean(prefs::kUsesSystemTheme, true); |
| 46 // Have the former theme notify its observers of change. | 46 // Both old and new themes' observers should be notified of the change. |
|
Elliot Glaysher
2014/06/13 20:05:54
Could you please expand this comment to include mo
Evan Stade
2014/06/13 20:14:39
Done.
| |
| 47 if (linux_ui_) | |
| 48 linux_ui_->GetNativeTheme(NULL)->NotifyObservers(); | |
| 47 ui::NativeThemeAura::instance()->NotifyObservers(); | 49 ui::NativeThemeAura::instance()->NotifyObservers(); |
| 48 } | 50 } |
| 49 | 51 |
| 50 void SystemThemeX11::StopUsingTheme() { | 52 void SystemThemeX11::StopUsingTheme() { |
| 51 pref_service_->SetBoolean(prefs::kUsesSystemTheme, false); | 53 pref_service_->SetBoolean(prefs::kUsesSystemTheme, false); |
| 52 // Have the former theme notify its observers of change. | 54 // Both old and new themes' observers should be notified of the change. |
| 55 ui::NativeThemeAura::instance()->NotifyObservers(); | |
| 53 if (linux_ui_) | 56 if (linux_ui_) |
| 54 linux_ui_->GetNativeTheme(NULL)->NotifyObservers(); | 57 linux_ui_->GetNativeTheme(NULL)->NotifyObservers(); |
| 55 } | 58 } |
| 56 | 59 |
| 57 bool SystemThemeX11::GetColor(int id, SkColor* color) const { | 60 bool SystemThemeX11::GetColor(int id, SkColor* color) const { |
| 58 return linux_ui_ && linux_ui_->GetColor(id, color); | 61 return linux_ui_ && linux_ui_->GetColor(id, color); |
| 59 } | 62 } |
| 60 | 63 |
| 61 gfx::Image SystemThemeX11::GetImageNamed(int id) { | 64 gfx::Image SystemThemeX11::GetImageNamed(int id) { |
| 62 return linux_ui_ ? linux_ui_->GetThemeImageNamed(id) : gfx::Image(); | 65 return linux_ui_ ? linux_ui_->GetThemeImageNamed(id) : gfx::Image(); |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 84 | 87 |
| 85 bool ThemeServiceAuraX11::UsingDefaultTheme() const { | 88 bool ThemeServiceAuraX11::UsingDefaultTheme() const { |
| 86 return ThemeService::UsingDefaultTheme() && !UsingSystemTheme(); | 89 return ThemeService::UsingDefaultTheme() && !UsingSystemTheme(); |
| 87 } | 90 } |
| 88 | 91 |
| 89 bool ThemeServiceAuraX11::UsingSystemTheme() const { | 92 bool ThemeServiceAuraX11::UsingSystemTheme() const { |
| 90 const CustomThemeSupplier* theme_supplier = get_theme_supplier(); | 93 const CustomThemeSupplier* theme_supplier = get_theme_supplier(); |
| 91 return theme_supplier && | 94 return theme_supplier && |
| 92 theme_supplier->get_theme_type() == CustomThemeSupplier::NATIVE_X11; | 95 theme_supplier->get_theme_type() == CustomThemeSupplier::NATIVE_X11; |
| 93 } | 96 } |
| OLD | NEW |