| 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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 break; | 249 break; |
| 250 case chrome::NOTIFICATION_EXTENSION_INSTALLED: | 250 case chrome::NOTIFICATION_EXTENSION_INSTALLED: |
| 251 { | 251 { |
| 252 // The theme may be initially disabled. Wait till it is loaded (if ever). | 252 // The theme may be initially disabled. Wait till it is loaded (if ever). |
| 253 Details<const extensions::InstalledExtensionInfo> installed_details( | 253 Details<const extensions::InstalledExtensionInfo> installed_details( |
| 254 details); | 254 details); |
| 255 if (installed_details->extension->is_theme()) | 255 if (installed_details->extension->is_theme()) |
| 256 installed_pending_load_id_ = installed_details->extension->id(); | 256 installed_pending_load_id_ = installed_details->extension->id(); |
| 257 break; | 257 break; |
| 258 } | 258 } |
| 259 case chrome::NOTIFICATION_EXTENSION_LOADED: | 259 case chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: |
| 260 { | 260 { |
| 261 const Extension* extension = Details<const Extension>(details).ptr(); | 261 const Extension* extension = Details<const Extension>(details).ptr(); |
| 262 if (extension->is_theme() && | 262 if (extension->is_theme() && |
| 263 installed_pending_load_id_ != kDefaultThemeID && | 263 installed_pending_load_id_ != kDefaultThemeID && |
| 264 installed_pending_load_id_ == extension->id()) { | 264 installed_pending_load_id_ == extension->id()) { |
| 265 SetTheme(extension); | 265 SetTheme(extension); |
| 266 } | 266 } |
| 267 installed_pending_load_id_ = kDefaultThemeID; | 267 installed_pending_load_id_ = kDefaultThemeID; |
| 268 break; | 268 break; |
| 269 } | 269 } |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 | 497 |
| 498 // Send notification in case anyone requested data and cached it when the | 498 // Send notification in case anyone requested data and cached it when the |
| 499 // theme service was not ready yet. | 499 // theme service was not ready yet. |
| 500 NotifyThemeChanged(); | 500 NotifyThemeChanged(); |
| 501 } | 501 } |
| 502 | 502 |
| 503 registrar_.Add(this, | 503 registrar_.Add(this, |
| 504 chrome::NOTIFICATION_EXTENSION_INSTALLED, | 504 chrome::NOTIFICATION_EXTENSION_INSTALLED, |
| 505 content::Source<Profile>(profile_)); | 505 content::Source<Profile>(profile_)); |
| 506 registrar_.Add(this, | 506 registrar_.Add(this, |
| 507 chrome::NOTIFICATION_EXTENSION_LOADED, | 507 chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, |
| 508 content::Source<Profile>(profile_)); | 508 content::Source<Profile>(profile_)); |
| 509 registrar_.Add(this, | 509 registrar_.Add(this, |
| 510 chrome::NOTIFICATION_EXTENSION_ENABLED, | 510 chrome::NOTIFICATION_EXTENSION_ENABLED, |
| 511 content::Source<Profile>(profile_)); | 511 content::Source<Profile>(profile_)); |
| 512 registrar_.Add(this, | 512 registrar_.Add(this, |
| 513 chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, | 513 chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, |
| 514 content::Source<Profile>(profile_)); | 514 content::Source<Profile>(profile_)); |
| 515 | 515 |
| 516 base::MessageLoop::current()->PostDelayedTask(FROM_HERE, | 516 base::MessageLoop::current()->PostDelayedTask(FROM_HERE, |
| 517 base::Bind(&ThemeService::RemoveUnusedThemes, | 517 base::Bind(&ThemeService::RemoveUnusedThemes, |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 void ThemeService::OnInfobarDestroyed() { | 597 void ThemeService::OnInfobarDestroyed() { |
| 598 number_of_infobars_--; | 598 number_of_infobars_--; |
| 599 | 599 |
| 600 if (number_of_infobars_ == 0) | 600 if (number_of_infobars_ == 0) |
| 601 RemoveUnusedThemes(false); | 601 RemoveUnusedThemes(false); |
| 602 } | 602 } |
| 603 | 603 |
| 604 ThemeSyncableService* ThemeService::GetThemeSyncableService() const { | 604 ThemeSyncableService* ThemeService::GetThemeSyncableService() const { |
| 605 return theme_syncable_service_.get(); | 605 return theme_syncable_service_.get(); |
| 606 } | 606 } |
| OLD | NEW |