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

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

Issue 8964014: Include the information whether the tab is already in a tab strip with the retargeting details (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 9 years 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
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_webnavigation_api.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/tab_contents/retargeting_details.h"
10 #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"
11 #include "content/browser/renderer_host/render_view_host.h" 13 #include "content/browser/renderer_host/render_view_host.h"
12 #include "content/browser/tab_contents/navigation_details.h" 14 #include "content/browser/tab_contents/navigation_details.h"
13 #include "content/browser/tab_contents/tab_contents.h" 15 #include "content/browser/tab_contents/tab_contents.h"
14 #include "content/public/browser/browser_thread.h" 16 #include "content/public/browser/browser_thread.h"
15 #include "content/public/browser/notification_observer.h" 17 #include "content/public/browser/notification_observer.h"
16 #include "content/public/browser/notification_registrar.h" 18 #include "content/public/browser/notification_registrar.h"
17 #include "content/public/browser/notification_service.h" 19 #include "content/public/browser/notification_service.h"
18 #include "content/public/browser/notification_types.h" 20 #include "content/public/browser/notification_types.h"
19 21
20 using content::BrowserThread; 22 using content::BrowserThread;
(...skipping 20 matching lines...) Expand all
41 }; 43 };
42 44
43 ExtensionTabIdMap::TabObserver::TabObserver() { 45 ExtensionTabIdMap::TabObserver::TabObserver() {
44 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 46 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
45 registrar_.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB, 47 registrar_.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_CREATED_FOR_TAB,
46 content::NotificationService::AllBrowserContextsAndSources()); 48 content::NotificationService::AllBrowserContextsAndSources());
47 registrar_.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_DELETED, 49 registrar_.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_DELETED,
48 content::NotificationService::AllBrowserContextsAndSources()); 50 content::NotificationService::AllBrowserContextsAndSources());
49 registrar_.Add(this, content::NOTIFICATION_TAB_PARENTED, 51 registrar_.Add(this, content::NOTIFICATION_TAB_PARENTED,
50 content::NotificationService::AllBrowserContextsAndSources()); 52 content::NotificationService::AllBrowserContextsAndSources());
51 registrar_.Add(this, content::NOTIFICATION_RETARGETING, 53 registrar_.Add(this, chrome::NOTIFICATION_RETARGETING,
52 content::NotificationService::AllBrowserContextsAndSources()); 54 content::NotificationService::AllBrowserContextsAndSources());
53 } 55 }
54 56
55 ExtensionTabIdMap::TabObserver::~TabObserver() { 57 ExtensionTabIdMap::TabObserver::~TabObserver() {
56 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 58 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
57 } 59 }
58 60
59 void ExtensionTabIdMap::TabObserver::Observe( 61 void ExtensionTabIdMap::TabObserver::Observe(
60 int type, const content::NotificationSource& source, 62 int type, const content::NotificationSource& source,
61 const content::NotificationDetails& details) { 63 const content::NotificationDetails& details) {
(...skipping 24 matching lines...) Expand all
86 BrowserThread::PostTask( 88 BrowserThread::PostTask(
87 BrowserThread::IO, FROM_HERE, 89 BrowserThread::IO, FROM_HERE,
88 base::Bind( 90 base::Bind(
89 &ExtensionTabIdMap::SetTabAndWindowId, 91 &ExtensionTabIdMap::SetTabAndWindowId,
90 base::Unretained(ExtensionTabIdMap::GetInstance()), 92 base::Unretained(ExtensionTabIdMap::GetInstance()),
91 host->process()->GetID(), host->routing_id(), 93 host->process()->GetID(), host->routing_id(),
92 tab->restore_tab_helper()->session_id().id(), 94 tab->restore_tab_helper()->session_id().id(),
93 tab->restore_tab_helper()->window_id().id())); 95 tab->restore_tab_helper()->window_id().id()));
94 break; 96 break;
95 } 97 }
96 case content::NOTIFICATION_RETARGETING: { 98 case chrome::NOTIFICATION_RETARGETING: {
97 content::RetargetingDetails* retargeting_details = 99 RetargetingDetails* retargeting_details =
98 content::Details<content::RetargetingDetails>(details).ptr(); 100 content::Details<RetargetingDetails>(details).ptr();
99 TabContents* contents = retargeting_details->target_tab_contents; 101 TabContents* contents = retargeting_details->target_tab_contents;
100 TabContentsWrapper* tab = 102 TabContentsWrapper* tab =
101 TabContentsWrapper::GetCurrentWrapperForContents(contents); 103 TabContentsWrapper::GetCurrentWrapperForContents(contents);
102 if (!tab) 104 if (!tab)
103 break; 105 break;
104 RenderViewHost* host = tab->tab_contents()->render_view_host(); 106 RenderViewHost* host = tab->tab_contents()->render_view_host();
105 BrowserThread::PostTask( 107 BrowserThread::PostTask(
106 BrowserThread::IO, FROM_HERE, 108 BrowserThread::IO, FROM_HERE,
107 base::Bind( 109 base::Bind(
108 &ExtensionTabIdMap::SetTabAndWindowId, 110 &ExtensionTabIdMap::SetTabAndWindowId,
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 172 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
171 RenderId render_id(render_process_host_id, routing_id); 173 RenderId render_id(render_process_host_id, routing_id);
172 TabAndWindowIdMap::iterator iter = map_.find(render_id); 174 TabAndWindowIdMap::iterator iter = map_.find(render_id);
173 if (iter != map_.end()) { 175 if (iter != map_.end()) {
174 *tab_id = iter->second.first; 176 *tab_id = iter->second.first;
175 *window_id = iter->second.second; 177 *window_id = iter->second.second;
176 return true; 178 return true;
177 } 179 }
178 return false; 180 return false;
179 } 181 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_webnavigation_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698