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

Side by Side Diff: chrome/browser/extensions/api/tab_capture/tab_capture_registry.cc

Issue 11232066: Remove GetExtensionEventRouter from Profile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rerebase Created 8 years, 1 month 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 #include "chrome/browser/extensions/api/tab_capture/tab_capture_registry.h" 5 #include "chrome/browser/extensions/api/tab_capture/tab_capture_registry.h"
6 6
7 #include "content/public/browser/browser_thread.h" 7 #include "content/public/browser/browser_thread.h"
8 #include "chrome/browser/extensions/event_names.h" 8 #include "chrome/browser/extensions/event_names.h"
9 #include "chrome/browser/extensions/event_router.h" 9 #include "chrome/browser/extensions/event_router.h"
10 #include "chrome/browser/extensions/extension_system.h"
10 #include "chrome/browser/media/media_internals.h" 11 #include "chrome/browser/media/media_internals.h"
11 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/profiles/profile_dependency_manager.h" 13 #include "chrome/browser/profiles/profile_dependency_manager.h"
13 #include "chrome/common/chrome_notification_types.h" 14 #include "chrome/common/chrome_notification_types.h"
14 #include "chrome/common/extensions/extension.h" 15 #include "chrome/common/extensions/extension.h"
15 #include "content/public/browser/notification_details.h" 16 #include "content/public/browser/notification_details.h"
16 #include "content/public/browser/notification_source.h" 17 #include "content/public/browser/notification_source.h"
17 18
18 namespace events = extensions::event_names; 19 namespace events = extensions::event_names;
19 using content::BrowserThread; 20 using content::BrowserThread;
20 21
21 namespace extensions { 22 namespace extensions {
22 23
23 TabCaptureRegistry::TabCaptureRegistry(Profile* profile) 24 TabCaptureRegistry::TabCaptureRegistry(Profile* profile)
24 : proxy_(new MediaObserverProxy()), profile_(profile) { 25 : proxy_(new MediaObserverProxy()), profile_(profile) {
25 proxy_->Attach(this); 26 proxy_->Attach(this);
26 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, 27 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED,
27 content::Source<Profile>(profile_)); 28 content::Source<Profile>(profile_));
28 } 29 }
29 30
30 TabCaptureRegistry::~TabCaptureRegistry() { 31 TabCaptureRegistry::~TabCaptureRegistry() {
31 proxy_->Detach(); 32 proxy_->Detach();
32 } 33 }
33 34
34 void TabCaptureRegistry::HandleRequestUpdateOnUIThread( 35 void TabCaptureRegistry::HandleRequestUpdateOnUIThread(
35 const content::MediaStreamDevice& device, 36 const content::MediaStreamDevice& device,
36 const content::MediaRequestState new_state) { 37 const content::MediaRequestState new_state) {
37 EventRouter* router = profile_ ? profile_->GetExtensionEventRouter() : NULL; 38 EventRouter* router = profile_ ?
39 extensions::ExtensionSystem::Get(profile_)->event_router() : NULL;
38 if (!router) 40 if (!router)
39 return; 41 return;
40 42
41 if (requests_.find(device.device_id) == requests_.end()) 43 if (requests_.find(device.device_id) == requests_.end())
42 return; 44 return;
43 45
44 tab_capture::TabCaptureState state = 46 tab_capture::TabCaptureState state =
45 tab_capture::TAB_CAPTURE_TAB_CAPTURE_STATE_NONE; 47 tab_capture::TAB_CAPTURE_TAB_CAPTURE_STATE_NONE;
46 switch (new_state) { 48 switch (new_state) {
47 case content::MEDIA_REQUEST_STATE_REQUESTED: 49 case content::MEDIA_REQUEST_STATE_REQUESTED:
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 } 182 }
181 183
182 void TabCaptureRegistry::MediaObserverProxy::UpdateOnUIThread( 184 void TabCaptureRegistry::MediaObserverProxy::UpdateOnUIThread(
183 const content::MediaStreamDevice& device, 185 const content::MediaStreamDevice& device,
184 const content::MediaRequestState new_state) { 186 const content::MediaRequestState new_state) {
185 if (handler_) 187 if (handler_)
186 handler_->HandleRequestUpdateOnUIThread(device, new_state); 188 handler_->HandleRequestUpdateOnUIThread(device, new_state);
187 } 189 }
188 190
189 } // namespace extensions 191 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698