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/visitedlink/visitedlink_event_listener.h" | 5 #include "chrome/browser/visitedlink/visitedlink_event_listener.h" |
6 | 6 |
7 #include "base/shared_memory.h" | 7 #include "base/shared_memory.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/visitedlink/visitedlink_master_factory.h" | 9 #include "chrome/browser/visitedlink/visitedlink_master_factory.h" |
10 #include "chrome/common/render_messages.h" | 10 #include "chrome/common/render_messages.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
109 }; | 109 }; |
110 | 110 |
111 VisitedLinkEventListener::VisitedLinkEventListener(Profile* profile) | 111 VisitedLinkEventListener::VisitedLinkEventListener(Profile* profile) |
112 : profile_(profile) { | 112 : profile_(profile) { |
113 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CREATED, | 113 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CREATED, |
114 content::NotificationService::AllBrowserContextsAndSources()); | 114 content::NotificationService::AllBrowserContextsAndSources()); |
115 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, | 115 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, |
116 content::NotificationService::AllBrowserContextsAndSources()); | 116 content::NotificationService::AllBrowserContextsAndSources()); |
117 registrar_.Add(this, content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED, | 117 registrar_.Add(this, content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED, |
118 content::NotificationService::AllBrowserContextsAndSources()); | 118 content::NotificationService::AllBrowserContextsAndSources()); |
119 for (content::RenderProcessHost::iterator i( | |
120 content::RenderProcessHost::AllHostsIterator()); | |
121 !i.IsAtEnd(); i.Advance()) { | |
122 content::RenderProcessHost* process = i.GetCurrentValue(); | |
123 Profile* rph_profile = | |
124 Profile::FromBrowserContext(process->GetBrowserContext()); | |
125 if (!profile_->IsSameProfile(rph_profile)) | |
126 continue; | |
127 updaters_[process->GetID()] = | |
brettw
2013/02/13 21:57:24
Below in the NOTIFICATION_RENDERER_PROCESS_CREATED
Cait (Slow)
2013/02/14 16:58:13
We do need to send the table here. This was a mist
| |
128 make_linked_ptr(new VisitedLinkUpdater(process->GetID())); | |
129 } | |
119 } | 130 } |
120 | 131 |
121 VisitedLinkEventListener::~VisitedLinkEventListener() { | 132 VisitedLinkEventListener::~VisitedLinkEventListener() { |
122 if (!pending_visited_links_.empty()) | 133 if (!pending_visited_links_.empty()) |
123 pending_visited_links_.clear(); | 134 pending_visited_links_.clear(); |
124 } | 135 } |
125 | 136 |
126 void VisitedLinkEventListener::NewTable(base::SharedMemory* table_memory) { | 137 void VisitedLinkEventListener::NewTable(base::SharedMemory* table_memory) { |
127 if (!table_memory) | 138 if (!table_memory) |
128 return; | 139 return; |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
213 int child_id = widget->GetProcess()->GetID(); | 224 int child_id = widget->GetProcess()->GetID(); |
214 if (updaters_.count(child_id)) | 225 if (updaters_.count(child_id)) |
215 updaters_[child_id]->Update(); | 226 updaters_[child_id]->Update(); |
216 break; | 227 break; |
217 } | 228 } |
218 default: | 229 default: |
219 NOTREACHED(); | 230 NOTREACHED(); |
220 break; | 231 break; |
221 } | 232 } |
222 } | 233 } |
OLD | NEW |