OLD | NEW |
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 #include "chrome/browser/extensions/api/streams_private/streams_private_api.h" | 5 #include "chrome/browser/extensions/api/streams_private/streams_private_api.h" |
6 | 6 |
7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chrome/browser/extensions/extension_tab_util.h" | 9 #include "chrome/browser/extensions/extension_tab_util.h" |
10 #include "chrome/common/extensions/api/streams_private.h" | 10 #include "chrome/common/extensions/api/streams_private.h" |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 content::BrowserContext* browser_context, | 145 content::BrowserContext* browser_context, |
146 const Extension* extension, | 146 const Extension* extension, |
147 UnloadedExtensionInfo::Reason reason) { | 147 UnloadedExtensionInfo::Reason reason) { |
148 streams_.erase(extension->id()); | 148 streams_.erase(extension->id()); |
149 } | 149 } |
150 | 150 |
151 StreamsPrivateAbortFunction::StreamsPrivateAbortFunction() { | 151 StreamsPrivateAbortFunction::StreamsPrivateAbortFunction() { |
152 } | 152 } |
153 | 153 |
154 ExtensionFunction::ResponseAction StreamsPrivateAbortFunction::Run() { | 154 ExtensionFunction::ResponseAction StreamsPrivateAbortFunction::Run() { |
155 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 155 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
156 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &stream_url_)); | 156 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &stream_url_)); |
157 StreamsPrivateAPI::Get(browser_context())->AbortStream( | 157 StreamsPrivateAPI::Get(browser_context())->AbortStream( |
158 extension_id(), GURL(stream_url_), base::Bind( | 158 extension_id(), GURL(stream_url_), base::Bind( |
159 &StreamsPrivateAbortFunction::OnClose, this)); | 159 &StreamsPrivateAbortFunction::OnClose, this)); |
160 return RespondLater(); | 160 return RespondLater(); |
161 } | 161 } |
162 | 162 |
163 void StreamsPrivateAbortFunction::OnClose() { | 163 void StreamsPrivateAbortFunction::OnClose() { |
164 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 164 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
165 Respond(NoArguments()); | 165 Respond(NoArguments()); |
166 } | 166 } |
167 | 167 |
168 static base::LazyInstance<BrowserContextKeyedAPIFactory<StreamsPrivateAPI> > | 168 static base::LazyInstance<BrowserContextKeyedAPIFactory<StreamsPrivateAPI> > |
169 g_factory = LAZY_INSTANCE_INITIALIZER; | 169 g_factory = LAZY_INSTANCE_INITIALIZER; |
170 | 170 |
171 // static | 171 // static |
172 BrowserContextKeyedAPIFactory<StreamsPrivateAPI>* | 172 BrowserContextKeyedAPIFactory<StreamsPrivateAPI>* |
173 StreamsPrivateAPI::GetFactoryInstance() { | 173 StreamsPrivateAPI::GetFactoryInstance() { |
174 return g_factory.Pointer(); | 174 return g_factory.Pointer(); |
175 } | 175 } |
176 | 176 |
177 } // namespace extensions | 177 } // namespace extensions |
OLD | NEW |