| 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/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/tab_contents/retargeting_details.h" | 10 #include "chrome/browser/tab_contents/retargeting_details.h" |
| 11 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 11 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 12 #include "chrome/common/chrome_notification_types.h" | 12 #include "chrome/common/chrome_notification_types.h" |
| 13 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
| 14 #include "content/public/browser/navigation_details.h" | 14 #include "content/public/browser/navigation_details.h" |
| 15 #include "content/public/browser/notification_observer.h" | 15 #include "content/public/browser/notification_observer.h" |
| 16 #include "content/public/browser/notification_registrar.h" | 16 #include "content/public/browser/notification_registrar.h" |
| 17 #include "content/public/browser/notification_service.h" | 17 #include "content/public/browser/notification_service.h" |
| 18 #include "content/public/browser/notification_types.h" | 18 #include "content/public/browser/notification_types.h" |
| 19 #include "content/public/browser/render_process_host.h" | 19 #include "content/public/browser/render_process_host.h" |
| 20 #include "content/public/browser/render_view_host.h" | 20 #include "content/public/browser/render_view_host.h" |
| 21 #include "content/public/browser/web_contents.h" | 21 #include "content/public/browser/web_contents.h" |
| 22 | 22 |
| 23 using content::BrowserThread; | 23 using content::BrowserThread; |
| 24 using content::RenderViewHost; |
| 24 using content::WebContents; | 25 using content::WebContents; |
| 25 | 26 |
| 26 // | 27 // |
| 27 // ExtensionTabIdMap::TabObserver | 28 // ExtensionTabIdMap::TabObserver |
| 28 // | 29 // |
| 29 | 30 |
| 30 // This class listens for notifications about new and closed tabs on the UI | 31 // This class listens for notifications about new and closed tabs on the UI |
| 31 // thread, and notifies the ExtensionTabIdMap on the IO thread. It should only | 32 // thread, and notifies the ExtensionTabIdMap on the IO thread. It should only |
| 32 // ever be accessed on the UI thread. | 33 // ever be accessed on the UI thread. |
| 33 class ExtensionTabIdMap::TabObserver : public content::NotificationObserver { | 34 class ExtensionTabIdMap::TabObserver : public content::NotificationObserver { |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 175 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 175 RenderId render_id(render_process_host_id, routing_id); | 176 RenderId render_id(render_process_host_id, routing_id); |
| 176 TabAndWindowIdMap::iterator iter = map_.find(render_id); | 177 TabAndWindowIdMap::iterator iter = map_.find(render_id); |
| 177 if (iter != map_.end()) { | 178 if (iter != map_.end()) { |
| 178 *tab_id = iter->second.first; | 179 *tab_id = iter->second.first; |
| 179 *window_id = iter->second.second; | 180 *window_id = iter->second.second; |
| 180 return true; | 181 return true; |
| 181 } | 182 } |
| 182 return false; | 183 return false; |
| 183 } | 184 } |
| OLD | NEW |