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

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

Issue 281513003: Implement chrome.streamsPrivate.abort() extensions function (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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.cc
diff --git a/chrome/browser/extensions/api/streams_private/streams_private_api.cc b/chrome/browser/extensions/api/streams_private/streams_private_api.cc
index 1a1445aa22925b168ad253beb2b155b391d3f27b..d04ca80e08c2347f46917b50f12177a2224aa373 100644
--- a/chrome/browser/extensions/api/streams_private/streams_private_api.cc
+++ b/chrome/browser/extensions/api/streams_private/streams_private_api.cc
@@ -88,6 +88,13 @@ void StreamsPrivateAPI::ExecuteMimeTypeHandler(
streams_[extension_id][url] = make_linked_ptr(stream.release());
}
+void StreamsPrivateAPI::AbortStream(const std::string& extension_id,
+ const GURL& stream_url) {
+ StreamMap::iterator it = streams_.find(extension_id);
+ if (it != streams_.end())
+ it->second.erase(stream_url);
+}
+
void StreamsPrivateAPI::OnExtensionUnloaded(
content::BrowserContext* browser_context,
const Extension* extension,
@@ -95,6 +102,20 @@ void StreamsPrivateAPI::OnExtensionUnloaded(
streams_.erase(extension->id());
}
+StreamsPrivateAbortFunction::StreamsPrivateAbortFunction() {
+}
+
+bool StreamsPrivateAbortFunction::Prepare() {
+ EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &stream_url_));
+ StreamsPrivateAPI::Get(browser_context())->AbortStream(extension_id(),
+ GURL(stream_url_));
+ return true;
+}
+
+bool StreamsPrivateAbortFunction::Respond() {
+ return true;
+}
+
static base::LazyInstance<BrowserContextKeyedAPIFactory<StreamsPrivateAPI> >
g_factory = LAZY_INSTANCE_INITIALIZER;

Powered by Google App Engine
This is Rietveld 408576698