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

Side by Side Diff: chrome/browser/extensions/api/streams_private/streams_private_api.h

Issue 281513003: Implement chrome.streamsPrivate.abort() extensions function (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_EXTENSIONS_API_STREAMS_PRIVATE_STREAMS_PRIVATE_API_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_STREAMS_PRIVATE_STREAMS_PRIVATE_API_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_STREAMS_PRIVATE_STREAMS_PRIVATE_API_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_STREAMS_PRIVATE_STREAMS_PRIVATE_API_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
(...skipping 17 matching lines...) Expand all
28 static StreamsPrivateAPI* Get(content::BrowserContext* context); 28 static StreamsPrivateAPI* Get(content::BrowserContext* context);
29 29
30 explicit StreamsPrivateAPI(content::BrowserContext* context); 30 explicit StreamsPrivateAPI(content::BrowserContext* context);
31 virtual ~StreamsPrivateAPI(); 31 virtual ~StreamsPrivateAPI();
32 32
33 void ExecuteMimeTypeHandler(const std::string& extension_id, 33 void ExecuteMimeTypeHandler(const std::string& extension_id,
34 content::WebContents* web_contents, 34 content::WebContents* web_contents,
35 scoped_ptr<content::StreamHandle> stream, 35 scoped_ptr<content::StreamHandle> stream,
36 int64 expected_content_size); 36 int64 expected_content_size);
37 37
38 void AbortStream(const std::string& extension_id,
39 const GURL& stream_url,
40 const base::Closure& callback);
41
38 // BrowserContextKeyedAPI implementation. 42 // BrowserContextKeyedAPI implementation.
39 static BrowserContextKeyedAPIFactory<StreamsPrivateAPI>* GetFactoryInstance(); 43 static BrowserContextKeyedAPIFactory<StreamsPrivateAPI>* GetFactoryInstance();
40 44
41 private: 45 private:
42 friend class BrowserContextKeyedAPIFactory<StreamsPrivateAPI>; 46 friend class BrowserContextKeyedAPIFactory<StreamsPrivateAPI>;
43 typedef std::map<std::string, 47 typedef std::map<std::string,
44 std::map<GURL, 48 std::map<GURL,
45 linked_ptr<content::StreamHandle> > > StreamMap; 49 linked_ptr<content::StreamHandle> > > StreamMap;
46 50
47 // ExtensionRegistryObserver implementation. 51 // ExtensionRegistryObserver implementation.
(...skipping 11 matching lines...) Expand all
59 63
60 content::BrowserContext* const browser_context_; 64 content::BrowserContext* const browser_context_;
61 StreamMap streams_; 65 StreamMap streams_;
62 base::WeakPtrFactory<StreamsPrivateAPI> weak_ptr_factory_; 66 base::WeakPtrFactory<StreamsPrivateAPI> weak_ptr_factory_;
63 67
64 // Listen to extension unloaded notifications. 68 // Listen to extension unloaded notifications.
65 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> 69 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
66 extension_registry_observer_; 70 extension_registry_observer_;
67 }; 71 };
68 72
73 class StreamsPrivateAbortFunction : public UIThreadExtensionFunction {
74 public:
75 StreamsPrivateAbortFunction();
76 DECLARE_EXTENSION_FUNCTION("streamsPrivate.abort", STREAMSPRIVATE_ABORT)
77
78 protected:
79 virtual ~StreamsPrivateAbortFunction() {}
80
81 // ExtensionFunction:
82 virtual ExtensionFunction::ResponseAction Run() OVERRIDE;
83
84 private:
85 void OnClose();
86
87 std::string stream_url_;
88 };
89
69 } // namespace extensions 90 } // namespace extensions
70 91
71 #endif // CHROME_BROWSER_EXTENSIONS_API_STREAMS_PRIVATE_STREAMS_PRIVATE_API_H_ 92 #endif // CHROME_BROWSER_EXTENSIONS_API_STREAMS_PRIVATE_STREAMS_PRIVATE_API_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698