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 "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "chrome/browser/extensions/api/storage/settings_frontend.h" | 9 #include "chrome/browser/extensions/api/storage/settings_frontend.h" |
10 #include "chrome/browser/extensions/api/storage/settings_namespace.h" | 10 #include "chrome/browser/extensions/api/storage/settings_namespace.h" |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 CreateMessage(settings_namespace, normal_action, is_final_action)); | 189 CreateMessage(settings_namespace, normal_action, is_final_action)); |
190 listener_incognito.Reply( | 190 listener_incognito.Reply( |
191 CreateMessage(settings_namespace, incognito_action, is_final_action)); | 191 CreateMessage(settings_namespace, incognito_action, is_final_action)); |
192 return extension; | 192 return extension; |
193 } | 193 } |
194 | 194 |
195 std::string CreateMessage( | 195 std::string CreateMessage( |
196 Namespace settings_namespace, | 196 Namespace settings_namespace, |
197 const std::string& action, | 197 const std::string& action, |
198 bool is_final_action) { | 198 bool is_final_action) { |
199 scoped_ptr<DictionaryValue> message(new DictionaryValue()); | 199 scoped_ptr<base::DictionaryValue> message(new base::DictionaryValue()); |
200 message->SetString("namespace", ToString(settings_namespace)); | 200 message->SetString("namespace", ToString(settings_namespace)); |
201 message->SetString("action", action); | 201 message->SetString("action", action); |
202 message->SetBoolean("isFinalAction", is_final_action); | 202 message->SetBoolean("isFinalAction", is_final_action); |
203 std::string message_json; | 203 std::string message_json; |
204 base::JSONWriter::Write(message.get(), &message_json); | 204 base::JSONWriter::Write(message.get(), &message_json); |
205 return message_json; | 205 return message_json; |
206 } | 206 } |
207 | 207 |
208 void InitSyncWithSyncableService( | 208 void InitSyncWithSyncableService( |
209 syncer::SyncChangeProcessor* sync_processor, | 209 syncer::SyncChangeProcessor* sync_processor, |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 SettingsFrontend* frontend = | 547 SettingsFrontend* frontend = |
548 browser()->profile()->GetExtensionService()->settings_frontend(); | 548 browser()->profile()->GetExtensionService()->settings_frontend(); |
549 frontend->DisableStorageForTesting(MANAGED); | 549 frontend->DisableStorageForTesting(MANAGED); |
550 EXPECT_FALSE(frontend->IsStorageEnabled(MANAGED)); | 550 EXPECT_FALSE(frontend->IsStorageEnabled(MANAGED)); |
551 // Now run the extension. | 551 // Now run the extension. |
552 ASSERT_TRUE(RunExtensionTest("settings/managed_storage_disabled")) | 552 ASSERT_TRUE(RunExtensionTest("settings/managed_storage_disabled")) |
553 << message_; | 553 << message_; |
554 } | 554 } |
555 | 555 |
556 } // namespace extensions | 556 } // namespace extensions |
OLD | NEW |