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/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
10 #include "chrome/browser/sessions/session_tab_helper.h" | 10 #include "chrome/browser/sessions/session_tab_helper.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 // | 32 // |
33 | 33 |
34 class ExtensionRendererState::RenderViewHostObserver | 34 class ExtensionRendererState::RenderViewHostObserver |
35 : public content::WebContentsObserver { | 35 : public content::WebContentsObserver { |
36 public: | 36 public: |
37 RenderViewHostObserver(RenderViewHost* host, WebContents* web_contents) | 37 RenderViewHostObserver(RenderViewHost* host, WebContents* web_contents) |
38 : content::WebContentsObserver(web_contents), | 38 : content::WebContentsObserver(web_contents), |
39 render_view_host_(host) { | 39 render_view_host_(host) { |
40 } | 40 } |
41 | 41 |
42 virtual void RenderViewDeleted(content::RenderViewHost* host) OVERRIDE { | 42 virtual void RenderViewDeleted(content::RenderViewHost* host) override { |
43 if (host != render_view_host_) | 43 if (host != render_view_host_) |
44 return; | 44 return; |
45 BrowserThread::PostTask( | 45 BrowserThread::PostTask( |
46 BrowserThread::IO, FROM_HERE, | 46 BrowserThread::IO, FROM_HERE, |
47 base::Bind( | 47 base::Bind( |
48 &ExtensionRendererState::ClearTabAndWindowId, | 48 &ExtensionRendererState::ClearTabAndWindowId, |
49 base::Unretained(ExtensionRendererState::GetInstance()), | 49 base::Unretained(ExtensionRendererState::GetInstance()), |
50 host->GetProcess()->GetID(), host->GetRoutingID())); | 50 host->GetProcess()->GetID(), host->GetRoutingID())); |
51 | 51 |
52 delete this; | 52 delete this; |
(...skipping 15 matching lines...) Expand all Loading... |
68 class ExtensionRendererState::TabObserver | 68 class ExtensionRendererState::TabObserver |
69 : public content::NotificationObserver { | 69 : public content::NotificationObserver { |
70 public: | 70 public: |
71 TabObserver(); | 71 TabObserver(); |
72 virtual ~TabObserver(); | 72 virtual ~TabObserver(); |
73 | 73 |
74 private: | 74 private: |
75 // content::NotificationObserver interface. | 75 // content::NotificationObserver interface. |
76 virtual void Observe(int type, | 76 virtual void Observe(int type, |
77 const content::NotificationSource& source, | 77 const content::NotificationSource& source, |
78 const content::NotificationDetails& details) OVERRIDE; | 78 const content::NotificationDetails& details) override; |
79 | 79 |
80 content::NotificationRegistrar registrar_; | 80 content::NotificationRegistrar registrar_; |
81 }; | 81 }; |
82 | 82 |
83 ExtensionRendererState::TabObserver::TabObserver() { | 83 ExtensionRendererState::TabObserver::TabObserver() { |
84 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 84 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
85 registrar_.Add(this, | 85 registrar_.Add(this, |
86 content::NOTIFICATION_WEB_CONTENTS_RENDER_VIEW_HOST_CREATED, | 86 content::NOTIFICATION_WEB_CONTENTS_RENDER_VIEW_HOST_CREATED, |
87 content::NotificationService::AllBrowserContextsAndSources()); | 87 content::NotificationService::AllBrowserContextsAndSources()); |
88 registrar_.Add(this, chrome::NOTIFICATION_TAB_PARENTED, | 88 registrar_.Add(this, chrome::NOTIFICATION_TAB_PARENTED, |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 int render_view_id = info->GetRouteID(); | 213 int render_view_id = info->GetRouteID(); |
214 RenderId render_id(render_process_id, render_view_id); | 214 RenderId render_id(render_process_id, render_view_id); |
215 TabAndWindowIdMap::iterator iter = map_.find(render_id); | 215 TabAndWindowIdMap::iterator iter = map_.find(render_id); |
216 if (iter != map_.end()) { | 216 if (iter != map_.end()) { |
217 *tab_id = iter->second.first; | 217 *tab_id = iter->second.first; |
218 *window_id = iter->second.second; | 218 *window_id = iter->second.second; |
219 return true; | 219 return true; |
220 } | 220 } |
221 return false; | 221 return false; |
222 } | 222 } |
OLD | NEW |