| 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 "chrome/browser/extensions/updater/extension_cache.h" | 5 #include "chrome/browser/extensions/updater/extension_cache.h" | 
| 6 | 6 | 
| 7 #include "base/memory/singleton.h" | 7 #include "base/memory/singleton.h" | 
| 8 | 8 | 
| 9 #if defined(OS_CHROMEOS) | 9 #if defined(OS_CHROMEOS) | 
| 10 #include "chrome/browser/extensions/updater/extension_cache_impl.h" | 10 #include "chrome/browser/extensions/updater/extension_cache_impl.h" | 
| 11 #endif  // OS_CHROMEOS | 11 #endif  // OS_CHROMEOS | 
| 12 | 12 | 
| 13 namespace extensions { | 13 namespace extensions { | 
| 14 namespace { | 14 namespace { | 
| 15 | 15 | 
| 16 #if !defined(OS_CHROMEOS) | 16 #if !defined(OS_CHROMEOS) | 
| 17 | 17 | 
| 18 // Implementation of ExtensionCache that doesn't cache anything. | 18 // Implementation of ExtensionCache that doesn't cache anything. | 
| 19 // Real cache is used only on Chrome OS other OSes use this null implementation. | 19 // Real cache is used only on Chrome OS other OSes use this null implementation. | 
| 20 class ExtensionCacheNullImpl : public ExtensionCache { | 20 class ExtensionCacheNullImpl : public ExtensionCache { | 
| 21  public: | 21  public: | 
| 22   static ExtensionCacheNullImpl* GetInstance() { | 22   static ExtensionCacheNullImpl* GetInstance() { | 
| 23     return Singleton<ExtensionCacheNullImpl>::get(); | 23     return Singleton<ExtensionCacheNullImpl>::get(); | 
| 24   } | 24   } | 
| 25 | 25 | 
| 26   // Implementation of ExtensionCache. | 26   // Implementation of ExtensionCache. | 
| 27   virtual void Start(const base::Closure& callback) OVERRIDE { | 27   virtual void Start(const base::Closure& callback) override { | 
| 28     callback.Run(); | 28     callback.Run(); | 
| 29   } | 29   } | 
| 30 | 30 | 
| 31   virtual void Shutdown(const base::Closure& callback) OVERRIDE { | 31   virtual void Shutdown(const base::Closure& callback) override { | 
| 32     callback.Run(); | 32     callback.Run(); | 
| 33   } | 33   } | 
| 34 | 34 | 
| 35   virtual void AllowCaching(const std::string& id) OVERRIDE { | 35   virtual void AllowCaching(const std::string& id) override { | 
| 36   } | 36   } | 
| 37 | 37 | 
| 38   virtual bool GetExtension(const std::string& id, | 38   virtual bool GetExtension(const std::string& id, | 
| 39                             base::FilePath* file_path, | 39                             base::FilePath* file_path, | 
| 40                             std::string* version) OVERRIDE { | 40                             std::string* version) override { | 
| 41     return false; | 41     return false; | 
| 42   } | 42   } | 
| 43 | 43 | 
| 44   virtual void PutExtension(const std::string& id, | 44   virtual void PutExtension(const std::string& id, | 
| 45                             const base::FilePath& file_path, | 45                             const base::FilePath& file_path, | 
| 46                             const std::string& version, | 46                             const std::string& version, | 
| 47                             const PutExtensionCallback& callback) OVERRIDE { | 47                             const PutExtensionCallback& callback) override { | 
| 48     callback.Run(file_path, true); | 48     callback.Run(file_path, true); | 
| 49   } | 49   } | 
| 50 | 50 | 
| 51  private: | 51  private: | 
| 52   friend struct DefaultSingletonTraits<ExtensionCacheNullImpl>; | 52   friend struct DefaultSingletonTraits<ExtensionCacheNullImpl>; | 
| 53 | 53 | 
| 54   ExtensionCacheNullImpl() {} | 54   ExtensionCacheNullImpl() {} | 
| 55   virtual ~ExtensionCacheNullImpl() {} | 55   virtual ~ExtensionCacheNullImpl() {} | 
| 56 }; | 56 }; | 
| 57 | 57 | 
| (...skipping 17 matching lines...) Expand all  Loading... | 
| 75 } | 75 } | 
| 76 | 76 | 
| 77 // static | 77 // static | 
| 78 ExtensionCache* ExtensionCache::SetForTesting(ExtensionCache* cache) { | 78 ExtensionCache* ExtensionCache::SetForTesting(ExtensionCache* cache) { | 
| 79   ExtensionCache* temp = g_extension_cache_override; | 79   ExtensionCache* temp = g_extension_cache_override; | 
| 80   g_extension_cache_override = cache; | 80   g_extension_cache_override = cache; | 
| 81   return temp; | 81   return temp; | 
| 82 } | 82 } | 
| 83 | 83 | 
| 84 }  // namespace extensions | 84 }  // namespace extensions | 
| OLD | NEW | 
|---|