| OLD | NEW | 
|    1 // Copyright 2014 The Chromium Authors. All rights reserved. |    1 // Copyright 2014 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 <map> |    5 #include <map> | 
|    6 #include <set> |    6 #include <set> | 
|    7 #include <string> |    7 #include <string> | 
|    8  |    8  | 
|    9 #include "base/bind.h" |    9 #include "base/bind.h" | 
|   10 #include "base/callback.h" |   10 #include "base/callback.h" | 
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   49   // SupervisedUserWhitelistInstaller implementation: |   49   // SupervisedUserWhitelistInstaller implementation: | 
|   50   void RegisterWhitelist(const std::string& crx_id, |   50   void RegisterWhitelist(const std::string& crx_id, | 
|   51                          const std::string& name, |   51                          const std::string& name, | 
|   52                          bool new_installation, |   52                          bool new_installation, | 
|   53                          const WhitelistReadyCallback& callback) override { |   53                          const WhitelistReadyCallback& callback) override { | 
|   54     ASSERT_FALSE(WhitelistIsRegistered(crx_id)) << crx_id; |   54     ASSERT_FALSE(WhitelistIsRegistered(crx_id)) << crx_id; | 
|   55     registered_whitelists_.insert(crx_id); |   55     registered_whitelists_.insert(crx_id); | 
|   56     ready_callbacks_[crx_id] = callback; |   56     ready_callbacks_[crx_id] = callback; | 
|   57   } |   57   } | 
|   58  |   58  | 
|   59   void UnregisterWhitelist(const std::string& crx_id) override { |   59   void UninstallWhitelist(const std::string& crx_id) override { | 
|   60     EXPECT_TRUE(WhitelistIsRegistered(crx_id)) << crx_id; |   60     EXPECT_TRUE(WhitelistIsRegistered(crx_id)) << crx_id; | 
|   61     registered_whitelists_.erase(crx_id); |   61     registered_whitelists_.erase(crx_id); | 
|   62     // Don't remove the callback (see above). |   62     // Don't remove the ready callback (see above). | 
|   63   } |   63   } | 
|   64  |   64  | 
|   65  private: |   65  private: | 
|   66   bool WhitelistIsRegistered(const std::string& crx_id) { |   66   bool WhitelistIsRegistered(const std::string& crx_id) { | 
|   67     return registered_whitelists_.count(crx_id) > 0; |   67     return registered_whitelists_.count(crx_id) > 0; | 
|   68   } |   68   } | 
|   69  |   69  | 
|   70   std::set<std::string> registered_whitelists_; |   70   std::set<std::string> registered_whitelists_; | 
|   71   std::map<std::string, WhitelistReadyCallback> ready_callbacks_; |   71   std::map<std::string, WhitelistReadyCallback> ready_callbacks_; | 
|   72 }; |   72 }; | 
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  264       service_->GetAllSyncData(syncer::SUPERVISED_USER_WHITELISTS); |  264       service_->GetAllSyncData(syncer::SUPERVISED_USER_WHITELISTS); | 
|  265   ASSERT_EQ(2u, sync_data.size()); |  265   ASSERT_EQ(2u, sync_data.size()); | 
|  266   const sync_pb::ManagedUserWhitelistSpecifics* whitelist = |  266   const sync_pb::ManagedUserWhitelistSpecifics* whitelist = | 
|  267       FindWhitelist(sync_data, "aaaa"); |  267       FindWhitelist(sync_data, "aaaa"); | 
|  268   ASSERT_TRUE(whitelist); |  268   ASSERT_TRUE(whitelist); | 
|  269   EXPECT_EQ("Whitelist A", whitelist->name()); |  269   EXPECT_EQ("Whitelist A", whitelist->name()); | 
|  270   whitelist = FindWhitelist(sync_data, "bbbb"); |  270   whitelist = FindWhitelist(sync_data, "bbbb"); | 
|  271   ASSERT_TRUE(whitelist); |  271   ASSERT_TRUE(whitelist); | 
|  272   EXPECT_EQ("Whitelist B", whitelist->name()); |  272   EXPECT_EQ("Whitelist B", whitelist->name()); | 
|  273 } |  273 } | 
| OLD | NEW |