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_syncable_service.h" | 5 #include "chrome/browser/themes/theme_syncable_service.h" |
6 | 6 |
7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
8 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/themes/theme_service.h" | 10 #include "chrome/browser/themes/theme_service.h" |
11 #include "chrome/common/extensions/manifest_url_handler.h" | 11 #include "chrome/common/extensions/manifest_url_handler.h" |
12 #include "chrome/common/extensions/sync_helper.h" | 12 #include "chrome/common/extensions/sync_helper.h" |
| 13 #include "extensions/browser/extension_prefs.h" |
13 #include "extensions/browser/extension_system.h" | 14 #include "extensions/browser/extension_system.h" |
14 #include "extensions/common/extension.h" | 15 #include "extensions/common/extension.h" |
15 #include "sync/protocol/sync.pb.h" | 16 #include "sync/protocol/sync.pb.h" |
16 #include "sync/protocol/theme_specifics.pb.h" | 17 #include "sync/protocol/theme_specifics.pb.h" |
17 | 18 |
18 using std::string; | 19 using std::string; |
19 | 20 |
20 namespace { | 21 namespace { |
21 | 22 |
22 bool IsTheme(const extensions::Extension* extension) { | 23 bool IsTheme(const extensions::Extension* extension) { |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 extensions::ExtensionSystem::Get(profile_)->extension_service(); | 213 extensions::ExtensionSystem::Get(profile_)->extension_service(); |
213 CHECK(extensions_service); | 214 CHECK(extensions_service); |
214 const extensions::Extension* extension = | 215 const extensions::Extension* extension = |
215 extensions_service->GetExtensionById(id, true); | 216 extensions_service->GetExtensionById(id, true); |
216 if (extension) { | 217 if (extension) { |
217 if (!extension->is_theme()) { | 218 if (!extension->is_theme()) { |
218 DVLOG(1) << "Extension " << id << " is not a theme; aborting"; | 219 DVLOG(1) << "Extension " << id << " is not a theme; aborting"; |
219 return; | 220 return; |
220 } | 221 } |
221 int disabled_reasons = | 222 int disabled_reasons = |
222 extensions_service->extension_prefs()->GetDisableReasons(id); | 223 extensions::ExtensionPrefs::Get(profile_)->GetDisableReasons(id); |
223 if (!extensions_service->IsExtensionEnabled(id) && | 224 if (!extensions_service->IsExtensionEnabled(id) && |
224 disabled_reasons != extensions::Extension::DISABLE_USER_ACTION) { | 225 disabled_reasons != extensions::Extension::DISABLE_USER_ACTION) { |
225 DVLOG(1) << "Theme " << id << " is disabled with reason " | 226 DVLOG(1) << "Theme " << id << " is disabled with reason " |
226 << disabled_reasons << "; aborting"; | 227 << disabled_reasons << "; aborting"; |
227 return; | 228 return; |
228 } | 229 } |
229 // An enabled theme extension with the given id was found, so | 230 // An enabled theme extension with the given id was found, so |
230 // just set the current theme to it. | 231 // just set the current theme to it. |
231 theme_service_->SetTheme(extension); | 232 theme_service_->SetTheme(extension); |
232 } else { | 233 } else { |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 syncer::SyncChange(FROM_HERE, change_type, | 335 syncer::SyncChange(FROM_HERE, change_type, |
335 syncer::SyncData::CreateLocalData( | 336 syncer::SyncData::CreateLocalData( |
336 kCurrentThemeClientTag, kCurrentThemeNodeTitle, | 337 kCurrentThemeClientTag, kCurrentThemeNodeTitle, |
337 entity_specifics))); | 338 entity_specifics))); |
338 | 339 |
339 DVLOG(1) << "Update theme specifics from current theme: " | 340 DVLOG(1) << "Update theme specifics from current theme: " |
340 << changes.back().ToString(); | 341 << changes.back().ToString(); |
341 | 342 |
342 return sync_processor_->ProcessSyncChanges(FROM_HERE, changes); | 343 return sync_processor_->ProcessSyncChanges(FROM_HERE, changes); |
343 } | 344 } |
OLD | NEW |