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

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

Issue 10779042: Move notifications only used in chrome/ to chrome/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix oops Created 8 years, 5 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 29 matching lines...) Expand all
40 // content::NotificationObserver interface. 40 // content::NotificationObserver interface.
41 virtual void Observe(int type, 41 virtual void Observe(int type,
42 const content::NotificationSource& source, 42 const content::NotificationSource& source,
43 const content::NotificationDetails& details); 43 const content::NotificationDetails& details);
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,
51 content::NOTIFICATION_WEB_CONTENTS_RENDER_VIEW_HOST_CREATED,
51 content::NotificationService::AllBrowserContextsAndSources()); 52 content::NotificationService::AllBrowserContextsAndSources());
52 registrar_.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_DELETED, 53 registrar_.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_DELETED,
53 content::NotificationService::AllBrowserContextsAndSources()); 54 content::NotificationService::AllBrowserContextsAndSources());
54 registrar_.Add(this, chrome::NOTIFICATION_TAB_PARENTED, 55 registrar_.Add(this, chrome::NOTIFICATION_TAB_PARENTED,
55 content::NotificationService::AllBrowserContextsAndSources()); 56 content::NotificationService::AllBrowserContextsAndSources());
56 registrar_.Add(this, chrome::NOTIFICATION_RETARGETING, 57 registrar_.Add(this, chrome::NOTIFICATION_RETARGETING,
57 content::NotificationService::AllBrowserContextsAndSources()); 58 content::NotificationService::AllBrowserContextsAndSources());
58 } 59 }
59 60
60 ExtensionTabIdMap::TabObserver::~TabObserver() { 61 ExtensionTabIdMap::TabObserver::~TabObserver() {
61 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 62 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
62 } 63 }
63 64
64 void ExtensionTabIdMap::TabObserver::Observe( 65 void ExtensionTabIdMap::TabObserver::Observe(
65 int type, const content::NotificationSource& source, 66 int type, const content::NotificationSource& source,
66 const content::NotificationDetails& details) { 67 const content::NotificationDetails& details) {
67 switch (type) { 68 switch (type) {
68 case content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB: { 69 case content::NOTIFICATION_WEB_CONTENTS_RENDER_VIEW_HOST_CREATED: {
69 WebContents* contents = content::Source<WebContents>(source).ptr(); 70 WebContents* contents = content::Source<WebContents>(source).ptr();
70 TabContents* tab = TabContents::FromWebContents(contents); 71 TabContents* tab = TabContents::FromWebContents(contents);
71 if (!tab) 72 if (!tab)
72 break; 73 break;
73 RenderViewHost* host = content::Details<RenderViewHost>(details).ptr(); 74 RenderViewHost* host = content::Details<RenderViewHost>(details).ptr();
74 // TODO(mpcmoplete): How can we tell if window_id is bogus? It may not 75 // TODO(mpcmoplete): How can we tell if window_id is bogus? It may not
75 // have been set yet. 76 // have been set yet.
76 BrowserThread::PostTask( 77 BrowserThread::PostTask(
77 BrowserThread::IO, FROM_HERE, 78 BrowserThread::IO, FROM_HERE,
78 base::Bind( 79 base::Bind(
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 174 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
174 RenderId render_id(render_process_host_id, routing_id); 175 RenderId render_id(render_process_host_id, routing_id);
175 TabAndWindowIdMap::iterator iter = map_.find(render_id); 176 TabAndWindowIdMap::iterator iter = map_.find(render_id);
176 if (iter != map_.end()) { 177 if (iter != map_.end()) {
177 *tab_id = iter->second.first; 178 *tab_id = iter->second.first;
178 *window_id = iter->second.second; 179 *window_id = iter->second.second;
179 return true; 180 return true;
180 } 181 }
181 return false; 182 return false;
182 } 183 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698