#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/fullscreen/fullscreen_controller.h"
-#include "components/browser_context_keyed_service/browser_context_dependency_manager.h"
+#include "components/keyed_service/content/browser_context_dependency_manager.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_observer.h"
#include "extensions/browser/event_router.h"
-#include "extensions/browser/extension_system.h"
#include "extensions/common/extension.h"
using content::BrowserThread;
TabCaptureRequest::~TabCaptureRequest() {
}
-TabCaptureRegistry::TabCaptureRegistry(Profile* profile)
- : profile_(profile) {
+TabCaptureRegistry::TabCaptureRegistry(content::BrowserContext* context)
+ : profile_(Profile::FromBrowserContext(context)) {
MediaCaptureDevicesDispatcher::GetInstance()->AddObserver(this);
registrar_.Add(this,
- chrome::NOTIFICATION_EXTENSION_UNLOADED,
+ chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED,
content::Source<Profile>(profile_));
registrar_.Add(this,
chrome::NOTIFICATION_FULLSCREEN_CHANGED,
}
// static
-TabCaptureRegistry* TabCaptureRegistry::Get(Profile* profile) {
- return ProfileKeyedAPIFactory<TabCaptureRegistry>::GetForProfile(profile);
+TabCaptureRegistry* TabCaptureRegistry::Get(content::BrowserContext* context) {
+ return BrowserContextKeyedAPIFactory<TabCaptureRegistry>::Get(context);
}
-static base::LazyInstance<ProfileKeyedAPIFactory<TabCaptureRegistry> >
+static base::LazyInstance<BrowserContextKeyedAPIFactory<TabCaptureRegistry> >
g_factory = LAZY_INSTANCE_INITIALIZER;
// static
-ProfileKeyedAPIFactory<TabCaptureRegistry>*
+BrowserContextKeyedAPIFactory<TabCaptureRegistry>*
TabCaptureRegistry::GetFactoryInstance() {
return g_factory.Pointer();
}
const TabCaptureRegistry::RegistryCaptureInfo
TabCaptureRegistry::GetCapturedTabs(const std::string& extension_id) const {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
RegistryCaptureInfo list;
for (ScopedVector<TabCaptureRequest>::const_iterator it = requests_.begin();
it != requests_.end(); ++it) {
void TabCaptureRegistry::Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
switch (type) {
- case chrome::NOTIFICATION_EXTENSION_UNLOADED: {
+ case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: {
// Cleanup all the requested media streams for this extension.
const std::string& extension_id =
content::Details<extensions::UnloadedExtensionInfo>(details)->
bool TabCaptureRegistry::VerifyRequest(int render_process_id,
int render_view_id) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
DVLOG(1) << "Verifying tabCapture request for "
<< render_process_id << ":" << render_view_id;
// TODO(justinlin): Verify extension too.
int render_view_id,
const content::MediaStreamDevice& device,
const content::MediaRequestState new_state) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (device.type != content::MEDIA_TAB_VIDEO_CAPTURE &&
device.type != content::MEDIA_TAB_AUDIO_CAPTURE) {
return;
void TabCaptureRegistry::DispatchStatusChangeEvent(
const TabCaptureRequest* request) const {
- EventRouter* router = profile_ ?
- extensions::ExtensionSystem::Get(profile_)->event_router() : NULL;
+ EventRouter* router = profile_ ? EventRouter::Get(profile_) : NULL;
if (!router)
return;