Chromium Code Reviews| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/json/json_writer.h" | 6 #include "base/json/json_writer.h" |
| 7 #include "chrome/browser/extensions/api/storage/settings_frontend.h" | 7 #include "chrome/browser/extensions/api/storage/settings_frontend.h" |
| 8 #include "chrome/browser/extensions/api/storage/settings_namespace.h" | 8 #include "chrome/browser/extensions/api/storage/settings_namespace.h" |
| 9 #include "chrome/browser/extensions/api/storage/settings_sync_util.h" | 9 #include "chrome/browser/extensions/api/storage/settings_sync_util.h" |
| 10 #include "chrome/browser/extensions/extension_apitest.h" | 10 #include "chrome/browser/extensions/extension_apitest.h" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 122 | 122 |
| 123 void FinalReplyWhenSatisfied( | 123 void FinalReplyWhenSatisfied( |
| 124 Namespace settings_namespace, | 124 Namespace settings_namespace, |
| 125 const std::string& normal_action, | 125 const std::string& normal_action, |
| 126 const std::string& incognito_action) { | 126 const std::string& incognito_action) { |
| 127 MaybeLoadAndReplyWhenSatisfied( | 127 MaybeLoadAndReplyWhenSatisfied( |
| 128 settings_namespace, normal_action, incognito_action, NULL, true); | 128 settings_namespace, normal_action, incognito_action, NULL, true); |
| 129 } | 129 } |
| 130 | 130 |
| 131 void InitSync(syncer::SyncChangeProcessor* sync_processor) { | 131 void InitSync(syncer::SyncChangeProcessor* sync_processor) { |
| 132 MessageLoop::current()->RunUntilIdle(); | 132 base::MessageLoop::current()->RunUntilIdle(); |
| 133 InitSyncWithSyncableService( | 133 InitSyncWithSyncableService( |
| 134 sync_processor, | 134 sync_processor, |
| 135 browser()->profile()->GetExtensionService()->settings_frontend()-> | 135 browser()->profile()->GetExtensionService()->settings_frontend() |
| 136 GetBackendForSync(kModelType)); | 136 ->GetBackendForSync(kModelType)); |
|
brettw
2013/04/28 04:26:27
Either way is fine, so I wouldn't change this. Sam
| |
| 137 } | 137 } |
| 138 | 138 |
| 139 void SendChanges(const syncer::SyncChangeList& change_list) { | 139 void SendChanges(const syncer::SyncChangeList& change_list) { |
| 140 MessageLoop::current()->RunUntilIdle(); | 140 base::MessageLoop::current()->RunUntilIdle(); |
| 141 SendChangesToSyncableService( | 141 SendChangesToSyncableService( |
| 142 change_list, | 142 change_list, |
| 143 browser()->profile()->GetExtensionService()->settings_frontend()-> | 143 browser()->profile()->GetExtensionService()->settings_frontend() |
| 144 GetBackendForSync(kModelType)); | 144 ->GetBackendForSync(kModelType)); |
| 145 } | 145 } |
| 146 | 146 |
| 147 #if defined(ENABLE_CONFIGURATION_POLICY) | 147 #if defined(ENABLE_CONFIGURATION_POLICY) |
| 148 void SetPolicies(const base::DictionaryValue& policies) { | 148 void SetPolicies(const base::DictionaryValue& policies) { |
| 149 scoped_ptr<policy::PolicyBundle> bundle(new policy::PolicyBundle()); | 149 scoped_ptr<policy::PolicyBundle> bundle(new policy::PolicyBundle()); |
| 150 policy::PolicyMap& policy_map = bundle->Get(policy::PolicyNamespace( | 150 policy::PolicyMap& policy_map = bundle->Get(policy::PolicyNamespace( |
| 151 policy::POLICY_DOMAIN_EXTENSIONS, kManagedStorageExtensionId)); | 151 policy::POLICY_DOMAIN_EXTENSIONS, kManagedStorageExtensionId)); |
| 152 policy_map.LoadFrom( | 152 policy_map.LoadFrom( |
| 153 &policies, policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER); | 153 &policies, policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER); |
| 154 policy_provider_.UpdatePolicy(bundle.Pass()); | 154 policy_provider_.UpdatePolicy(bundle.Pass()); |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 517 SettingsFrontend* frontend = | 517 SettingsFrontend* frontend = |
| 518 browser()->profile()->GetExtensionService()->settings_frontend(); | 518 browser()->profile()->GetExtensionService()->settings_frontend(); |
| 519 frontend->DisableStorageForTesting(MANAGED); | 519 frontend->DisableStorageForTesting(MANAGED); |
| 520 EXPECT_FALSE(frontend->IsStorageEnabled(MANAGED)); | 520 EXPECT_FALSE(frontend->IsStorageEnabled(MANAGED)); |
| 521 // Now run the extension. | 521 // Now run the extension. |
| 522 ASSERT_TRUE(RunExtensionTest("settings/managed_storage_disabled")) | 522 ASSERT_TRUE(RunExtensionTest("settings/managed_storage_disabled")) |
| 523 << message_; | 523 << message_; |
| 524 } | 524 } |
| 525 | 525 |
| 526 } // namespace extensions | 526 } // namespace extensions |
| OLD | NEW |