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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/memory/ref_counted_memory.h" | 8 #include "base/memory/ref_counted_memory.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 void ThemeService::Observe(int type, | 240 void ThemeService::Observe(int type, |
241 const content::NotificationSource& source, | 241 const content::NotificationSource& source, |
242 const content::NotificationDetails& details) { | 242 const content::NotificationDetails& details) { |
243 using content::Details; | 243 using content::Details; |
244 switch (type) { | 244 switch (type) { |
245 case chrome::NOTIFICATION_EXTENSIONS_READY: | 245 case chrome::NOTIFICATION_EXTENSIONS_READY: |
246 registrar_.Remove(this, chrome::NOTIFICATION_EXTENSIONS_READY, | 246 registrar_.Remove(this, chrome::NOTIFICATION_EXTENSIONS_READY, |
247 content::Source<Profile>(profile_)); | 247 content::Source<Profile>(profile_)); |
248 OnExtensionServiceReady(); | 248 OnExtensionServiceReady(); |
249 break; | 249 break; |
250 case chrome::NOTIFICATION_EXTENSION_INSTALLED: | 250 case chrome::NOTIFICATION_EXTENSION_INSTALLED_DEPRECATED: { |
251 { | |
252 // The theme may be initially disabled. Wait till it is loaded (if ever). | 251 // The theme may be initially disabled. Wait till it is loaded (if ever). |
253 Details<const extensions::InstalledExtensionInfo> installed_details( | 252 Details<const extensions::InstalledExtensionInfo> installed_details( |
254 details); | 253 details); |
255 if (installed_details->extension->is_theme()) | 254 if (installed_details->extension->is_theme()) |
256 installed_pending_load_id_ = installed_details->extension->id(); | 255 installed_pending_load_id_ = installed_details->extension->id(); |
257 break; | 256 break; |
258 } | 257 } |
259 case chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: | 258 case chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: |
260 { | 259 { |
261 const Extension* extension = Details<const Extension>(details).ptr(); | 260 const Extension* extension = Details<const Extension>(details).ptr(); |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 // be recreated from the extension. | 493 // be recreated from the extension. |
495 MigrateTheme(); | 494 MigrateTheme(); |
496 set_ready(); | 495 set_ready(); |
497 | 496 |
498 // Send notification in case anyone requested data and cached it when the | 497 // Send notification in case anyone requested data and cached it when the |
499 // theme service was not ready yet. | 498 // theme service was not ready yet. |
500 NotifyThemeChanged(); | 499 NotifyThemeChanged(); |
501 } | 500 } |
502 | 501 |
503 registrar_.Add(this, | 502 registrar_.Add(this, |
504 chrome::NOTIFICATION_EXTENSION_INSTALLED, | 503 chrome::NOTIFICATION_EXTENSION_INSTALLED_DEPRECATED, |
505 content::Source<Profile>(profile_)); | 504 content::Source<Profile>(profile_)); |
506 registrar_.Add(this, | 505 registrar_.Add(this, |
507 chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, | 506 chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, |
508 content::Source<Profile>(profile_)); | 507 content::Source<Profile>(profile_)); |
509 registrar_.Add(this, | 508 registrar_.Add(this, |
510 chrome::NOTIFICATION_EXTENSION_ENABLED, | 509 chrome::NOTIFICATION_EXTENSION_ENABLED, |
511 content::Source<Profile>(profile_)); | 510 content::Source<Profile>(profile_)); |
512 registrar_.Add(this, | 511 registrar_.Add(this, |
513 chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, | 512 chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, |
514 content::Source<Profile>(profile_)); | 513 content::Source<Profile>(profile_)); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
597 void ThemeService::OnInfobarDestroyed() { | 596 void ThemeService::OnInfobarDestroyed() { |
598 number_of_infobars_--; | 597 number_of_infobars_--; |
599 | 598 |
600 if (number_of_infobars_ == 0) | 599 if (number_of_infobars_ == 0) |
601 RemoveUnusedThemes(false); | 600 RemoveUnusedThemes(false); |
602 } | 601 } |
603 | 602 |
604 ThemeSyncableService* ThemeService::GetThemeSyncableService() const { | 603 ThemeSyncableService* ThemeService::GetThemeSyncableService() const { |
605 return theme_syncable_service_.get(); | 604 return theme_syncable_service_.get(); |
606 } | 605 } |
OLD | NEW |