Index: chrome/test/live_sync/live_sync_extension_helper.cc |
diff --git a/chrome/test/live_sync/live_sync_extension_helper.cc b/chrome/test/live_sync/live_sync_extension_helper.cc |
index dc260adee85c1b8a4bc97746b3f49397f2f7850a..839a60bb4f97246f0d2748b994e53bdde1b0e41a 100644 |
--- a/chrome/test/live_sync/live_sync_extension_helper.cc |
+++ b/chrome/test/live_sync/live_sync_extension_helper.cc |
@@ -20,6 +20,12 @@ LiveSyncExtensionHelper::LiveSyncExtensionHelper() {} |
LiveSyncExtensionHelper::~LiveSyncExtensionHelper() {} |
+bool LiveSyncExtensionHelper::ExtensionState::operator==( |
+ const LiveSyncExtensionHelper::ExtensionState &other) const { |
+ return ((enabled_state == other.enabled_state) && |
+ (incognito_enabled == other.incognito_enabled)); |
+} |
+ |
// static |
std::string LiveSyncExtensionHelper::NameToId(const std::string& name) { |
std::string id; |
@@ -48,6 +54,26 @@ void LiveSyncExtensionHelper::UninstallExtension( |
NameToId(name)); |
} |
+void LiveSyncExtensionHelper::EnableExtension(Profile* profile, |
+ const std::string& name) { |
+ profile->GetExtensionService()->EnableExtension(NameToId(name)); |
+} |
+ |
+void LiveSyncExtensionHelper::DisableExtension(Profile* profile, |
+ const std::string& name) { |
+ profile->GetExtensionService()->DisableExtension(NameToId(name)); |
+} |
+ |
+void LiveSyncExtensionHelper::IncognitoEnableExtension( |
+ Profile* profile, const std::string& name) { |
+ profile->GetExtensionService()->SetIsIncognitoEnabled(NameToId(name), true); |
+} |
+ |
+void LiveSyncExtensionHelper::IncognitoDisableExtension( |
+ Profile* profile, const std::string& name) { |
+ profile->GetExtensionService()->SetIsIncognitoEnabled(NameToId(name), false); |
+} |
+ |
bool LiveSyncExtensionHelper::IsExtensionPendingInstallForSync( |
Profile* profile, const std::string& id) const { |
const PendingExtensionManager* pending_extension_manager = |
@@ -100,7 +126,14 @@ LiveSyncExtensionHelper::ExtensionStateMap |
const ExtensionList* extensions = extension_service->extensions(); |
for (ExtensionList::const_iterator it = extensions->begin(); |
it != extensions->end(); ++it) { |
- extension_state_map[(*it)->id()] = ENABLED; |
+ extension_state_map[(*it)->id()].enabled_state = ExtensionState::ENABLED; |
+ if (extension_service->IsIncognitoEnabled((*it)->id())) { |
akalin
2011/06/09 20:35:37
lotta duplicated code. Perhaps decomp into a sepa
braffert
2011/06/09 23:09:35
I'm not sure if this is a good idea as such a func
|
+ extension_state_map[(*it)->id()].incognito_enabled = true; |
akalin
2011/06/09 20:35:37
simpler to do
extension_state_map[...].incognito_
braffert
2011/06/09 23:09:35
Done.
|
+ VLOG(2) << "incognito enabled..."; |
+ } else { |
+ extension_state_map[(*it)->id()].incognito_enabled = false; |
+ VLOG(2) << "incognito disabled..."; |
+ } |
VLOG(2) << "Extension " << (*it)->id() << " in profile " |
<< profile_debug_name << " is enabled"; |
} |
@@ -109,7 +142,14 @@ LiveSyncExtensionHelper::ExtensionStateMap |
extension_service->disabled_extensions(); |
for (ExtensionList::const_iterator it = disabled_extensions->begin(); |
it != disabled_extensions->end(); ++it) { |
- extension_state_map[(*it)->id()] = DISABLED; |
+ extension_state_map[(*it)->id()].enabled_state = ExtensionState::DISABLED; |
+ if (extension_service->IsIncognitoEnabled((*it)->id())) { |
+ extension_state_map[(*it)->id()].incognito_enabled = true; |
+ VLOG(2) << "incognito enabled..."; |
+ } else { |
+ extension_state_map[(*it)->id()].incognito_enabled = false; |
+ VLOG(2) << "incognito disabled..."; |
+ } |
VLOG(2) << "Extension " << (*it)->id() << " in profile " |
<< profile_debug_name << " is disabled"; |
} |
@@ -119,7 +159,14 @@ LiveSyncExtensionHelper::ExtensionStateMap |
PendingExtensionManager::const_iterator it; |
for (it = pending_extension_manager->begin(); |
it != pending_extension_manager->end(); ++it) { |
- extension_state_map[it->first] = PENDING; |
+ extension_state_map[it->first].enabled_state = ExtensionState::PENDING; |
+ if (extension_service->IsIncognitoEnabled(it->first)) { |
+ extension_state_map[it->first].incognito_enabled = true; |
+ VLOG(2) << "incognito enabled..."; |
+ } else { |
+ extension_state_map[it->first].incognito_enabled = false; |
+ VLOG(2) << "incognito disabled..."; |
+ } |
VLOG(2) << "Extension " << it->first << " in profile " |
<< profile_debug_name << " is pending"; |
} |