OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_tab_id_map.h" | 5 #include "chrome/browser/extensions/extension_tab_id_map.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/restore_tab_helper.h" | 9 #include "chrome/browser/sessions/restore_tab_helper.h" |
10 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 10 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
11 #include "content/browser/renderer_host/render_process_host.h" | 11 #include "content/browser/renderer_host/render_process_host.h" |
12 #include "content/browser/renderer_host/render_view_host.h" | 12 #include "content/browser/renderer_host/render_view_host.h" |
13 #include "content/browser/tab_contents/navigation_details.h" | 13 #include "content/browser/tab_contents/navigation_details.h" |
14 #include "content/browser/tab_contents/tab_contents.h" | 14 #include "content/browser/tab_contents/tab_contents.h" |
15 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
16 #include "content/public/browser/notification_observer.h" | 16 #include "content/public/browser/notification_observer.h" |
17 #include "content/public/browser/notification_registrar.h" | 17 #include "content/public/browser/notification_registrar.h" |
18 #include "content/public/browser/notification_service.h" | 18 #include "content/public/browser/notification_service.h" |
19 #include "content/public/browser/notification_types.h" | 19 #include "content/public/browser/notification_types.h" |
20 | 20 |
| 21 using content::BrowserThread; |
| 22 |
21 // | 23 // |
22 // ExtensionTabIdMap::TabObserver | 24 // ExtensionTabIdMap::TabObserver |
23 // | 25 // |
24 | 26 |
25 // This class listens for notifications about new and closed tabs on the UI | 27 // This class listens for notifications about new and closed tabs on the UI |
26 // thread, and notifies the ExtensionTabIdMap on the IO thread. It should only | 28 // thread, and notifies the ExtensionTabIdMap on the IO thread. It should only |
27 // ever be accessed on the UI thread. | 29 // ever be accessed on the UI thread. |
28 class ExtensionTabIdMap::TabObserver : public content::NotificationObserver { | 30 class ExtensionTabIdMap::TabObserver : public content::NotificationObserver { |
29 public: | 31 public: |
30 TabObserver(); | 32 TabObserver(); |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 171 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
170 RenderId render_id(render_process_host_id, routing_id); | 172 RenderId render_id(render_process_host_id, routing_id); |
171 TabAndWindowIdMap::iterator iter = map_.find(render_id); | 173 TabAndWindowIdMap::iterator iter = map_.find(render_id); |
172 if (iter != map_.end()) { | 174 if (iter != map_.end()) { |
173 *tab_id = iter->second.first; | 175 *tab_id = iter->second.first; |
174 *window_id = iter->second.second; | 176 *window_id = iter->second.second; |
175 return true; | 177 return true; |
176 } | 178 } |
177 return false; | 179 return false; |
178 } | 180 } |
OLD | NEW |