forked from sanyaade-mobiledev/chromium.src
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Move ExtensionCache to //extensions"
This reverts commit 1056c8a. Reason for revert: Seems to have caused test flakiness with non-empty message loop. See https://crbug.com/422884. BUG=422884 TBR=rockot@chromium.org Review URL: https://codereview.chromium.org/653623002 Cr-Commit-Position: refs/heads/master@{#299294}
- Loading branch information
1 parent
02708e2
commit 98ff22a
Showing
28 changed files
with
129 additions
and
214 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
// Copyright 2014 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "chrome/browser/extensions/updater/extension_cache.h" | ||
|
||
#include "base/memory/singleton.h" | ||
|
||
#if defined(OS_CHROMEOS) | ||
#include "chrome/browser/extensions/updater/extension_cache_impl.h" | ||
#endif // OS_CHROMEOS | ||
|
||
namespace extensions { | ||
namespace { | ||
|
||
#if !defined(OS_CHROMEOS) | ||
|
||
// Implementation of ExtensionCache that doesn't cache anything. | ||
// Real cache is used only on Chrome OS other OSes use this null implementation. | ||
class ExtensionCacheNullImpl : public ExtensionCache { | ||
public: | ||
static ExtensionCacheNullImpl* GetInstance() { | ||
return Singleton<ExtensionCacheNullImpl>::get(); | ||
} | ||
|
||
// Implementation of ExtensionCache. | ||
virtual void Start(const base::Closure& callback) override { | ||
callback.Run(); | ||
} | ||
|
||
virtual void Shutdown(const base::Closure& callback) override { | ||
callback.Run(); | ||
} | ||
|
||
virtual void AllowCaching(const std::string& id) override { | ||
} | ||
|
||
virtual bool GetExtension(const std::string& id, | ||
base::FilePath* file_path, | ||
std::string* version) override { | ||
return false; | ||
} | ||
|
||
virtual void PutExtension(const std::string& id, | ||
const base::FilePath& file_path, | ||
const std::string& version, | ||
const PutExtensionCallback& callback) override { | ||
callback.Run(file_path, true); | ||
} | ||
|
||
private: | ||
friend struct DefaultSingletonTraits<ExtensionCacheNullImpl>; | ||
|
||
ExtensionCacheNullImpl() {} | ||
virtual ~ExtensionCacheNullImpl() {} | ||
}; | ||
|
||
#endif // !OS_CHROMEOS | ||
|
||
static ExtensionCache* g_extension_cache_override = NULL; | ||
|
||
} // namespace | ||
|
||
// static | ||
ExtensionCache* ExtensionCache::GetInstance() { | ||
if (g_extension_cache_override) { | ||
return g_extension_cache_override; | ||
} else { | ||
#if defined(OS_CHROMEOS) | ||
return ExtensionCacheImpl::GetInstance(); | ||
#else | ||
return ExtensionCacheNullImpl::GetInstance(); | ||
#endif | ||
} | ||
} | ||
|
||
// static | ||
ExtensionCache* ExtensionCache::SetForTesting(ExtensionCache* cache) { | ||
ExtensionCache* temp = g_extension_cache_override; | ||
g_extension_cache_override = cache; | ||
return temp; | ||
} | ||
|
||
} // namespace extensions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.