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

Side by Side Diff: chrome/browser/extensions/extension_tab_id_map.cc

Issue 10079023: Move notifications used only in chrome/ out of content/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: six! Created 8 years, 8 months 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/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"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 44
45 content::NotificationRegistrar registrar_; 45 content::NotificationRegistrar registrar_;
46 }; 46 };
47 47
48 ExtensionTabIdMap::TabObserver::TabObserver() { 48 ExtensionTabIdMap::TabObserver::TabObserver() {
49 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 49 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
50 registrar_.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB, 50 registrar_.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB,
51 content::NotificationService::AllBrowserContextsAndSources()); 51 content::NotificationService::AllBrowserContextsAndSources());
52 registrar_.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_DELETED, 52 registrar_.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_DELETED,
53 content::NotificationService::AllBrowserContextsAndSources()); 53 content::NotificationService::AllBrowserContextsAndSources());
54 registrar_.Add(this, content::NOTIFICATION_TAB_PARENTED, 54 registrar_.Add(this, chrome::NOTIFICATION_TAB_PARENTED,
55 content::NotificationService::AllBrowserContextsAndSources()); 55 content::NotificationService::AllBrowserContextsAndSources());
56 registrar_.Add(this, chrome::NOTIFICATION_RETARGETING, 56 registrar_.Add(this, chrome::NOTIFICATION_RETARGETING,
57 content::NotificationService::AllBrowserContextsAndSources()); 57 content::NotificationService::AllBrowserContextsAndSources());
58 } 58 }
59 59
60 ExtensionTabIdMap::TabObserver::~TabObserver() { 60 ExtensionTabIdMap::TabObserver::~TabObserver() {
61 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 61 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
62 } 62 }
63 63
64 void ExtensionTabIdMap::TabObserver::Observe( 64 void ExtensionTabIdMap::TabObserver::Observe(
(...skipping 12 matching lines...) Expand all
77 BrowserThread::PostTask( 77 BrowserThread::PostTask(
78 BrowserThread::IO, FROM_HERE, 78 BrowserThread::IO, FROM_HERE,
79 base::Bind( 79 base::Bind(
80 &ExtensionTabIdMap::SetTabAndWindowId, 80 &ExtensionTabIdMap::SetTabAndWindowId,
81 base::Unretained(ExtensionTabIdMap::GetInstance()), 81 base::Unretained(ExtensionTabIdMap::GetInstance()),
82 host->GetProcess()->GetID(), host->GetRoutingID(), 82 host->GetProcess()->GetID(), host->GetRoutingID(),
83 tab->restore_tab_helper()->session_id().id(), 83 tab->restore_tab_helper()->session_id().id(),
84 tab->restore_tab_helper()->window_id().id())); 84 tab->restore_tab_helper()->window_id().id()));
85 break; 85 break;
86 } 86 }
87 case content::NOTIFICATION_TAB_PARENTED: { 87 case chrome::NOTIFICATION_TAB_PARENTED: {
88 TabContentsWrapper* tab = 88 TabContentsWrapper* tab =
89 content::Source<TabContentsWrapper>(source).ptr(); 89 content::Source<TabContentsWrapper>(source).ptr();
90 RenderViewHost* host = tab->web_contents()->GetRenderViewHost(); 90 RenderViewHost* host = tab->web_contents()->GetRenderViewHost();
91 BrowserThread::PostTask( 91 BrowserThread::PostTask(
92 BrowserThread::IO, FROM_HERE, 92 BrowserThread::IO, FROM_HERE,
93 base::Bind( 93 base::Bind(
94 &ExtensionTabIdMap::SetTabAndWindowId, 94 &ExtensionTabIdMap::SetTabAndWindowId,
95 base::Unretained(ExtensionTabIdMap::GetInstance()), 95 base::Unretained(ExtensionTabIdMap::GetInstance()),
96 host->GetProcess()->GetID(), host->GetRoutingID(), 96 host->GetProcess()->GetID(), host->GetRoutingID(),
97 tab->restore_tab_helper()->session_id().id(), 97 tab->restore_tab_helper()->session_id().id(),
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 175 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
176 RenderId render_id(render_process_host_id, routing_id); 176 RenderId render_id(render_process_host_id, routing_id);
177 TabAndWindowIdMap::iterator iter = map_.find(render_id); 177 TabAndWindowIdMap::iterator iter = map_.find(render_id);
178 if (iter != map_.end()) { 178 if (iter != map_.end()) {
179 *tab_id = iter->second.first; 179 *tab_id = iter->second.first;
180 *window_id = iter->second.second; 180 *window_id = iter->second.second;
181 return true; 181 return true;
182 } 182 }
183 return false; 183 return false;
184 } 184 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698