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

Unified Diff: chrome/browser/extensions/api/streams_private/streams_private_api.h

Issue 12645004: Add Resource Handler for creating Streams to forward to extensions (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Make sure things are called on the right thread. Created 7 years, 9 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/api/streams_private/streams_private_api.h
diff --git a/chrome/browser/extensions/api/streams_private/streams_private_api.h b/chrome/browser/extensions/api/streams_private/streams_private_api.h
index 36f560d1b9475a1d6be61283930e7ae396c88276..fbacbff6fe27386089933bbed194da7f53d39ea4 100644
--- a/chrome/browser/extensions/api/streams_private/streams_private_api.h
+++ b/chrome/browser/extensions/api/streams_private/streams_private_api.h
@@ -19,18 +19,41 @@
class Profile;
+namespace content {
+class StreamHandle;
+}
+
namespace extensions {
-class StreamsPrivateAPI : public ProfileKeyedAPI {
+class StreamsPrivateAPI : public ProfileKeyedAPI,
+ public content::NotificationObserver {
public:
+ // Convenience method to get the StreamsPrivateAPI for a profile.
+ static StreamsPrivateAPI* Get(Profile* profile);
+
explicit StreamsPrivateAPI(Profile* profile);
virtual ~StreamsPrivateAPI();
+ void ExecuteMimeTypeHandler(const std::string& extension_id,
+ scoped_ptr<content::StreamHandle> stream,
+ const std::string& mime_type,
+ const GURL& original_url);
+
// ProfileKeyedAPI implementation.
static ProfileKeyedAPIFactory<StreamsPrivateAPI>* GetFactoryInstance();
+ // content::NotificationObserver implementation.
+ virtual void Observe(int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) OVERRIDE;
+
private:
friend class ProfileKeyedAPIFactory<StreamsPrivateAPI>;
+ typedef std::map<std::string,
+ std::map<GURL,
+ linked_ptr<content::StreamHandle> > > StreamMap;
+
+ void OnStreamClosed(const std::string& extension_id, const GURL& url);
// ProfileKeyedAPI implementation.
static const char* service_name() {
@@ -39,6 +62,9 @@ class StreamsPrivateAPI : public ProfileKeyedAPI {
static const bool kServiceIsNULLWhileTesting = true;
Profile* const profile_;
+ content::NotificationRegistrar registrar_;
+ StreamMap streams_;
+ base::WeakPtrFactory<StreamsPrivateAPI> weak_ptr_factory_;
};
} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698