diff options
author | kustermann <kustermann@google.com> | 2014-10-13 06:39:05 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-10-13 13:39:21 +0000 |
commit | 98ff22abeecf0c949bfcbab1a85dcba93f8d2285 (patch) | |
tree | e06ce937757e365c9ddc3b00e6c5cf62247d3d43 /extensions | |
parent | 02708e2dd0522cdf46f6c370b0a4bd332f9ceabf (diff) | |
download | chromium_src-98ff22abeecf0c949bfcbab1a85dcba93f8d2285.zip chromium_src-98ff22abeecf0c949bfcbab1a85dcba93f8d2285.tar.gz chromium_src-98ff22abeecf0c949bfcbab1a85dcba93f8d2285.tar.bz2 |
Revert "Move ExtensionCache to //extensions"
This reverts commit 1056c8a4ddb699dec826e75358f554c0e4790ae2.
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}
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/browser/BUILD.gn | 3 | ||||
-rw-r--r-- | extensions/browser/extensions_browser_client.h | 4 | ||||
-rw-r--r-- | extensions/browser/test_extensions_browser_client.cc | 8 | ||||
-rw-r--r-- | extensions/browser/test_extensions_browser_client.h | 7 | ||||
-rw-r--r-- | extensions/browser/updater/extension_cache.h | 63 | ||||
-rw-r--r-- | extensions/browser/updater/null_extension_cache.cc | 41 | ||||
-rw-r--r-- | extensions/browser/updater/null_extension_cache.h | 36 | ||||
-rw-r--r-- | extensions/extensions.gyp | 3 | ||||
-rw-r--r-- | extensions/shell/browser/shell_extensions_browser_client.cc | 9 | ||||
-rw-r--r-- | extensions/shell/browser/shell_extensions_browser_client.h | 4 |
10 files changed, 2 insertions, 176 deletions
diff --git a/extensions/browser/BUILD.gn b/extensions/browser/BUILD.gn index d69225e..3358c6a 100644 --- a/extensions/browser/BUILD.gn +++ b/extensions/browser/BUILD.gn @@ -426,11 +426,8 @@ source_set("browser") { "suggest_permission_util.h", "uninstall_reason.h", "update_observer.h", - "updater/extension_cache.h", "updater/manifest_fetch_data.cc", "updater/manifest_fetch_data.h", - "updater/null_extension_cache.cc", - "updater/null_extension_cache.h", "updater/safe_manifest_parser.cc", "updater/safe_manifest_parser.h", "url_request_util.cc", diff --git a/extensions/browser/extensions_browser_client.h b/extensions/browser/extensions_browser_client.h index 5b3b1d2..5ef97ff 100644 --- a/extensions/browser/extensions_browser_client.h +++ b/extensions/browser/extensions_browser_client.h @@ -38,7 +38,6 @@ class ApiActivityMonitor; class AppSorting; class ComponentExtensionResourceManager; class Extension; -class ExtensionCache; class ExtensionHostDelegate; class ExtensionPrefsObserver; class ExtensionSystem; @@ -188,9 +187,6 @@ class ExtensionsBrowserClient { // Returns the embedder's net::NetLog. virtual net::NetLog* GetNetLog() = 0; - // Gets the single ExtensionCache instance shared across the browser process. - virtual ExtensionCache* GetExtensionCache() = 0; - // Returns the single instance of |this|. static ExtensionsBrowserClient* Get(); diff --git a/extensions/browser/test_extensions_browser_client.cc b/extensions/browser/test_extensions_browser_client.cc index 409469b..33b42e0 100644 --- a/extensions/browser/test_extensions_browser_client.cc +++ b/extensions/browser/test_extensions_browser_client.cc @@ -8,7 +8,6 @@ #include "extensions/browser/app_sorting.h" #include "extensions/browser/extension_host_delegate.h" #include "extensions/browser/test_runtime_api_delegate.h" -#include "extensions/browser/updater/null_extension_cache.h" using content::BrowserContext; @@ -19,8 +18,7 @@ TestExtensionsBrowserClient::TestExtensionsBrowserClient( : main_context_(main_context), incognito_context_(NULL), process_manager_delegate_(NULL), - extension_system_factory_(NULL), - extension_cache_(new NullExtensionCache) { + extension_system_factory_(NULL) { DCHECK(main_context_); DCHECK(!main_context_->IsOffTheRecord()); } @@ -173,8 +171,4 @@ net::NetLog* TestExtensionsBrowserClient::GetNetLog() { return NULL; } -ExtensionCache* TestExtensionsBrowserClient::GetExtensionCache() { - return extension_cache_.get(); -} - } // namespace extensions diff --git a/extensions/browser/test_extensions_browser_client.h b/extensions/browser/test_extensions_browser_client.h index 632ed93..b3c517e 100644 --- a/extensions/browser/test_extensions_browser_client.h +++ b/extensions/browser/test_extensions_browser_client.h @@ -7,7 +7,6 @@ #include "base/compiler_specific.h" #include "extensions/browser/extensions_browser_client.h" -#include "extensions/browser/updater/extension_cache.h" namespace extensions { @@ -26,9 +25,6 @@ class TestExtensionsBrowserClient : public ExtensionsBrowserClient { void set_extension_system_factory(ExtensionSystemProvider* factory) { extension_system_factory_ = factory; } - void set_extension_cache(scoped_ptr<ExtensionCache> extension_cache) { - extension_cache_ = extension_cache.Pass(); - } // Associates an incognito context with |main_context_|. void SetIncognitoContext(content::BrowserContext* incognito_context); @@ -89,7 +85,6 @@ class TestExtensionsBrowserClient : public ExtensionsBrowserClient { const std::string& event_name, scoped_ptr<base::ListValue> args) override; virtual net::NetLog* GetNetLog() override; - virtual ExtensionCache* GetExtensionCache() override; private: content::BrowserContext* main_context_; // Not owned. @@ -101,8 +96,6 @@ class TestExtensionsBrowserClient : public ExtensionsBrowserClient { // Not owned, defaults to NULL. ExtensionSystemProvider* extension_system_factory_; - scoped_ptr<ExtensionCache> extension_cache_; - DISALLOW_COPY_AND_ASSIGN(TestExtensionsBrowserClient); }; diff --git a/extensions/browser/updater/extension_cache.h b/extensions/browser/updater/extension_cache.h deleted file mode 100644 index f6bdb02..0000000 --- a/extensions/browser/updater/extension_cache.h +++ /dev/null @@ -1,63 +0,0 @@ -// 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. - -#ifndef EXTENSIONS_BROWSER_UPDATER_EXTENSION_CACHE_H_ -#define EXTENSIONS_BROWSER_UPDATER_EXTENSION_CACHE_H_ - -#include <string> - -#include "base/callback_forward.h" -#include "base/files/file_path.h" - -namespace extensions { - -// ExtensionCache interface that caches extensions .crx files to share them -// between multiple users and profiles on the machine. -class ExtensionCache { - public: - // Callback that is invoked when the file placed when PutExtension done. - typedef base::Callback<void(const base::FilePath& file_path, - bool file_ownership_passed)> PutExtensionCallback; - - ExtensionCache() {} - virtual ~ExtensionCache() {} - - // Initialize cache in background. The |callback| is called when cache ready. - // Can be called multiple times. The |callback| can be called immediately if - // cache is ready. - virtual void Start(const base::Closure& callback) = 0; - - // Shut down the cache. Must be called at most once on browser shutdown. - virtual void Shutdown(const base::Closure& callback) = 0; - - // Allow caching for the extension with given |id|. User specific extensions - // should not be cached for privacy reasons. But default apps including policy - // configured can be cached. Can be called before Init. - virtual void AllowCaching(const std::string& id) = 0; - - // If extension with |id| exists in the cache, returns |true|, |file_path| and - // |version| for the extension. Extension will be marked as used with current - // timestamp. - virtual bool GetExtension(const std::string& id, - base::FilePath* file_path, - std::string* version) = 0; - - // Put extension with |id| and |version| into local cache. Older version in - // the cache will removed be on next run so it can be safely used. Extension - // will be marked as used with current timestamp. The file will be available - // via GetExtension when |callback| is called. Original |file_path| won't be - // deleted from the disk. There is no guarantee that |callback| will be - // called. - virtual void PutExtension(const std::string& id, - const base::FilePath& file_path, - const std::string& version, - const PutExtensionCallback& callback) = 0; - - private: - DISALLOW_COPY_AND_ASSIGN(ExtensionCache); -}; - -} // namespace extensions - -#endif // EXTENSIONS_BROWSER_UPDATER_EXTENSION_CACHE_H_ diff --git a/extensions/browser/updater/null_extension_cache.cc b/extensions/browser/updater/null_extension_cache.cc deleted file mode 100644 index 3241d20..0000000 --- a/extensions/browser/updater/null_extension_cache.cc +++ /dev/null @@ -1,41 +0,0 @@ -// 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 "extensions/browser/updater/null_extension_cache.h" - -#include "base/callback.h" - -namespace extensions { - -NullExtensionCache::NullExtensionCache() { -} - -NullExtensionCache::~NullExtensionCache() { -} - -void NullExtensionCache::Start(const base::Closure& callback) { - callback.Run(); -} - -void NullExtensionCache::Shutdown(const base::Closure& callback) { - callback.Run(); -} - -void NullExtensionCache::AllowCaching(const std::string& id) { -} - -bool NullExtensionCache::GetExtension(const std::string& id, - base::FilePath* file_path, - std::string* version) { - return false; -} - -void NullExtensionCache::PutExtension(const std::string& id, - const base::FilePath& file_path, - const std::string& version, - const PutExtensionCallback& callback) { - callback.Run(file_path, true); -} - -} // namespace extensions diff --git a/extensions/browser/updater/null_extension_cache.h b/extensions/browser/updater/null_extension_cache.h deleted file mode 100644 index c4c9a1b..0000000 --- a/extensions/browser/updater/null_extension_cache.h +++ /dev/null @@ -1,36 +0,0 @@ -// 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. - -#ifndef EXTENSIONS_BROWSER_UPDATER_NULL_EXTENSION_CACHE_H_ -#define EXTENSIONS_BROWSER_UPDATER_NULL_EXTENSION_CACHE_H_ - -#include "extensions/browser/updater/extension_cache.h" - -namespace extensions { - -// Implements a pass-thru (i.e. do-nothing) ExtensionCache. -class NullExtensionCache : public ExtensionCache { - public: - NullExtensionCache(); - virtual ~NullExtensionCache(); - - // ExtensionCache implementation. - virtual void Start(const base::Closure& callback) override; - virtual void Shutdown(const base::Closure& callback) override; - virtual void AllowCaching(const std::string& id) override; - virtual bool GetExtension(const std::string& id, - base::FilePath* file_path, - std::string* version) override; - virtual void PutExtension(const std::string& id, - const base::FilePath& file_path, - const std::string& version, - const PutExtensionCallback& callback) override; - - private: - DISALLOW_COPY_AND_ASSIGN(NullExtensionCache); -}; - -} // namespace extensions - -#endif // EXTENSIONS_BROWSER_UPDATER_NULL_EXTENSION_CACHE_H_ diff --git a/extensions/extensions.gyp b/extensions/extensions.gyp index ac7919d..166937f 100644 --- a/extensions/extensions.gyp +++ b/extensions/extensions.gyp @@ -714,11 +714,8 @@ 'browser/suggest_permission_util.h', 'browser/uninstall_reason.h', 'browser/update_observer.h', - 'browser/updater/extension_cache.h', 'browser/updater/manifest_fetch_data.cc', 'browser/updater/manifest_fetch_data.h', - 'browser/updater/null_extension_cache.cc', - 'browser/updater/null_extension_cache.h', 'browser/updater/safe_manifest_parser.cc', 'browser/updater/safe_manifest_parser.h', 'browser/url_request_util.cc', diff --git a/extensions/shell/browser/shell_extensions_browser_client.cc b/extensions/shell/browser/shell_extensions_browser_client.cc index 68c3448..a4aee60 100644 --- a/extensions/shell/browser/shell_extensions_browser_client.cc +++ b/extensions/shell/browser/shell_extensions_browser_client.cc @@ -17,7 +17,6 @@ #include "extensions/browser/extension_function_registry.h" #include "extensions/browser/extension_prefs.h" #include "extensions/browser/null_app_sorting.h" -#include "extensions/browser/updater/null_extension_cache.h" #include "extensions/browser/url_request_util.h" #include "extensions/shell/browser/shell_extension_host_delegate.h" #include "extensions/shell/browser/shell_extension_system_factory.h" @@ -38,9 +37,7 @@ void RegisterPrefs(user_prefs::PrefRegistrySyncable* registry) { ShellExtensionsBrowserClient::ShellExtensionsBrowserClient( BrowserContext* context) - : browser_context_(context), - api_client_(new ExtensionsAPIClient), - extension_cache_(new NullExtensionCache()) { + : browser_context_(context), api_client_(new ExtensionsAPIClient) { // Set up the preferences service. base::PrefServiceFactory factory; factory.set_user_prefs(new TestingPrefStore); @@ -222,8 +219,4 @@ net::NetLog* ShellExtensionsBrowserClient::GetNetLog() { return NULL; } -ExtensionCache* ShellExtensionsBrowserClient::GetExtensionCache() { - return extension_cache_.get(); -} - } // namespace extensions diff --git a/extensions/shell/browser/shell_extensions_browser_client.h b/extensions/shell/browser/shell_extensions_browser_client.h index 23ede3e..e5e985c 100644 --- a/extensions/shell/browser/shell_extensions_browser_client.h +++ b/extensions/shell/browser/shell_extensions_browser_client.h @@ -78,7 +78,6 @@ class ShellExtensionsBrowserClient : public ExtensionsBrowserClient { const std::string& event_name, scoped_ptr<base::ListValue> args) override; virtual net::NetLog* GetNetLog() override; - virtual ExtensionCache* GetExtensionCache() override; private: // The single BrowserContext for app_shell. Not owned. @@ -90,9 +89,6 @@ class ShellExtensionsBrowserClient : public ExtensionsBrowserClient { // The PrefService for |browser_context_|. scoped_ptr<PrefService> prefs_; - // The extension cache used for download and installation. - scoped_ptr<ExtensionCache> extension_cache_; - DISALLOW_COPY_AND_ASSIGN(ShellExtensionsBrowserClient); }; |