| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef CHROME_BROWSER_FONT_FAMILY_CACHE_H_ | 5 #ifndef CHROME_BROWSER_FONT_FAMILY_CACHE_H_ |
| 6 #define CHROME_BROWSER_FONT_FAMILY_CACHE_H_ | 6 #define CHROME_BROWSER_FONT_FAMILY_CACHE_H_ |
| 7 | 7 |
| 8 #include "base/containers/hash_tables.h" | 8 #include "base/containers/hash_tables.h" |
| 9 #include "base/gtest_prod_util.h" | 9 #include "base/gtest_prod_util.h" |
| 10 #include "base/prefs/pref_change_registrar.h" | 10 #include "base/prefs/pref_change_registrar.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 | 67 |
| 68 // Called when font family preferences changed. | 68 // Called when font family preferences changed. |
| 69 // Invalidates the cached entry, and removes the relevant observer. | 69 // Invalidates the cached entry, and removes the relevant observer. |
| 70 // Note: It is safe to remove the observer from the pref change callback. | 70 // Note: It is safe to remove the observer from the pref change callback. |
| 71 void OnPrefsChanged(const std::string& pref_name); | 71 void OnPrefsChanged(const std::string& pref_name); |
| 72 | 72 |
| 73 // content::NotificationObserver override. | 73 // content::NotificationObserver override. |
| 74 // Called when the profile is being destructed. | 74 // Called when the profile is being destructed. |
| 75 virtual void Observe(int type, | 75 virtual void Observe(int type, |
| 76 const content::NotificationSource& source, | 76 const content::NotificationSource& source, |
| 77 const content::NotificationDetails& details) OVERRIDE; | 77 const content::NotificationDetails& details) override; |
| 78 | 78 |
| 79 // Cache of font family preferences. | 79 // Cache of font family preferences. |
| 80 FontFamilyMap font_family_map_; | 80 FontFamilyMap font_family_map_; |
| 81 | 81 |
| 82 // Weak reference. | 82 // Weak reference. |
| 83 // Note: The lifetime of this object is tied to the lifetime of the | 83 // Note: The lifetime of this object is tied to the lifetime of the |
| 84 // PrefService, so there is no worry about an invalid pointer. | 84 // PrefService, so there is no worry about an invalid pointer. |
| 85 const PrefService* prefs_; | 85 const PrefService* prefs_; |
| 86 | 86 |
| 87 // Reacts to profile changes. | 87 // Reacts to profile changes. |
| 88 PrefChangeRegistrar profile_pref_registrar_; | 88 PrefChangeRegistrar profile_pref_registrar_; |
| 89 | 89 |
| 90 // Listens for profile destruction. | 90 // Listens for profile destruction. |
| 91 content::NotificationRegistrar notification_registrar_; | 91 content::NotificationRegistrar notification_registrar_; |
| 92 | 92 |
| 93 DISALLOW_COPY_AND_ASSIGN(FontFamilyCache); | 93 DISALLOW_COPY_AND_ASSIGN(FontFamilyCache); |
| 94 }; | 94 }; |
| 95 | 95 |
| 96 #endif // CHROME_BROWSER_FONT_FAMILY_CACHE_H_ | 96 #endif // CHROME_BROWSER_FONT_FAMILY_CACHE_H_ |
| OLD | NEW |