Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10636)

Unified Diff: chrome/browser/extensions/external_extension_provider_interface.h

Issue 5742008: Clean up threading model of external extension providers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: final rebase Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/external_extension_provider_interface.h
diff --git a/chrome/browser/extensions/external_extension_provider.h b/chrome/browser/extensions/external_extension_provider_interface.h
similarity index 58%
rename from chrome/browser/extensions/external_extension_provider.h
rename to chrome/browser/extensions/external_extension_provider_interface.h
index 5bcce1d5f4d7d150d3b50304038a204900330f5c..7f9d3c49996618771db8d6d19dd59eb7492a073a 100644
--- a/chrome/browser/extensions/external_extension_provider.h
+++ b/chrome/browser/extensions/external_extension_provider_interface.h
@@ -1,11 +1,14 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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 CHROME_BROWSER_EXTENSIONS_EXTERNAL_EXTENSION_PROVIDER_H_
-#define CHROME_BROWSER_EXTENSIONS_EXTERNAL_EXTENSION_PROVIDER_H_
+#ifndef CHROME_BROWSER_EXTENSIONS_EXTERNAL_EXTENSION_PROVIDER_INTERFACE_H_
+#define CHROME_BROWSER_EXTENSIONS_EXTERNAL_EXTENSION_PROVIDER_INTERFACE_H_
#pragma once
+#include <vector>
+
+#include "base/linked_ptr.h"
#include "chrome/common/extensions/extension.h"
class FilePath;
@@ -13,13 +16,13 @@ class Version;
// This class is an abstract class for implementing external extensions
// providers.
-class ExternalExtensionProvider {
+class ExternalExtensionProviderInterface {
public:
// ExternalExtensionProvider uses this interface to communicate back to the
// caller what extensions are registered, and which |id|, |version| and |path|
// they have. See also VisitRegisteredExtension below. Ownership of |version|
// is not transferred to the visitor.
- class Visitor {
+ class VisitorInterface {
public:
virtual void OnExternalExtensionFileFound(
const std::string& id,
@@ -32,16 +35,23 @@ class ExternalExtensionProvider {
const GURL& update_url,
Extension::Location location) = 0;
+ // Called after all the external extensions have been reported through
+ // the above two methods.
+ virtual void OnExternalProviderReady() = 0;
+
protected:
- virtual ~Visitor() {}
+ virtual ~VisitorInterface() {}
};
- virtual ~ExternalExtensionProvider() {}
+ virtual ~ExternalExtensionProviderInterface() {}
+
+ // The visitor (ExtensionsService) calls this function before it goes away.
+ virtual void ServiceShutdown() = 0;
- // Enumerate registered extension, calling OnExternalExtensionFound on
- // the |visitor| object for each registered extension found. |ids_to_ignore|
- // contains a list of extension ids that should not result in a call back.
- virtual void VisitRegisteredExtension(Visitor* visitor) const = 0;
+ // Enumerate registered extensions, calling
+ // OnExternalExtension(File|UpdateUrl)Found on the |visitor| object for each
+ // registered extension found.
+ virtual void VisitRegisteredExtension() const = 0;
// Test if this provider has an extension with id |id| registered.
virtual bool HasExtension(const std::string& id) const = 0;
@@ -53,6 +63,13 @@ class ExternalExtensionProvider {
virtual bool GetExtensionDetails(const std::string& id,
Extension::Location* location,
scoped_ptr<Version>* version) const = 0;
+
+ // Determines if this provider had loaded the list of external extensions
+ // from its source.
+ virtual bool IsReady() = 0;
};
-#endif // CHROME_BROWSER_EXTENSIONS_EXTERNAL_EXTENSION_PROVIDER_H_
+typedef std::vector<linked_ptr<ExternalExtensionProviderInterface> >
+ ProviderCollection;
+
+#endif // CHROME_BROWSER_EXTENSIONS_EXTERNAL_EXTENSION_PROVIDER_INTERFACE_H_

Powered by Google App Engine
This is Rietveld 408576698