OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/extension_renderer_state.h" | 5 #include "chrome/browser/extensions/extension_renderer_state.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "chrome/browser/sessions/session_tab_helper.h" | 9 #include "chrome/browser/sessions/session_tab_helper.h" |
10 #include "chrome/browser/tab_contents/retargeting_details.h" | 10 #include "chrome/browser/tab_contents/retargeting_details.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 // ExtensionRendererState::TabObserver | 28 // ExtensionRendererState::TabObserver |
29 // | 29 // |
30 | 30 |
31 // This class listens for notifications about changes in renderer state on the | 31 // This class listens for notifications about changes in renderer state on the |
32 // UI thread, and notifies the ExtensionRendererState on the IO thread. It | 32 // UI thread, and notifies the ExtensionRendererState on the IO thread. It |
33 // should only ever be accessed on the UI thread. | 33 // should only ever be accessed on the UI thread. |
34 class ExtensionRendererState::TabObserver | 34 class ExtensionRendererState::TabObserver |
35 : public content::NotificationObserver { | 35 : public content::NotificationObserver { |
36 public: | 36 public: |
37 TabObserver(); | 37 TabObserver(); |
38 ~TabObserver(); | 38 virtual ~TabObserver(); |
39 | 39 |
40 private: | 40 private: |
41 // content::NotificationObserver interface. | 41 // content::NotificationObserver interface. |
42 virtual void Observe(int type, | 42 virtual void Observe(int type, |
43 const content::NotificationSource& source, | 43 const content::NotificationSource& source, |
44 const content::NotificationDetails& details); | 44 const content::NotificationDetails& details) OVERRIDE; |
45 | 45 |
46 content::NotificationRegistrar registrar_; | 46 content::NotificationRegistrar registrar_; |
47 }; | 47 }; |
48 | 48 |
49 ExtensionRendererState::TabObserver::TabObserver() { | 49 ExtensionRendererState::TabObserver::TabObserver() { |
50 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 50 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
51 registrar_.Add(this, | 51 registrar_.Add(this, |
52 content::NOTIFICATION_WEB_CONTENTS_RENDER_VIEW_HOST_CREATED, | 52 content::NOTIFICATION_WEB_CONTENTS_RENDER_VIEW_HOST_CREATED, |
53 content::NotificationService::AllBrowserContextsAndSources()); | 53 content::NotificationService::AllBrowserContextsAndSources()); |
54 registrar_.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_DELETED, | 54 registrar_.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_DELETED, |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 | 231 |
232 void ExtensionRendererState::RemoveGuestProcess(int render_process_host_id) { | 232 void ExtensionRendererState::RemoveGuestProcess(int render_process_host_id) { |
233 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 233 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
234 guest_set_.erase(render_process_host_id); | 234 guest_set_.erase(render_process_host_id); |
235 } | 235 } |
236 | 236 |
237 bool ExtensionRendererState::IsGuestProcess(int render_process_host_id) { | 237 bool ExtensionRendererState::IsGuestProcess(int render_process_host_id) { |
238 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 238 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
239 return guest_set_.count(render_process_host_id) > 0; | 239 return guest_set_.count(render_process_host_id) > 0; |
240 } | 240 } |
OLD | NEW |