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

Side by Side Diff: chrome/browser/task_management/providers/web_contents/web_contents_task_provider.cc

Issue 2086423005: Using WebContents::UpdateTitleForEntry() instead of NavigationEntry::SetTitle() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Improving comment and removing the NOTREACHED. Created 4 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/task_management/providers/web_contents/web_contents_tas k_provider.h" 5 #include "chrome/browser/task_management/providers/web_contents/web_contents_tas k_provider.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "chrome/browser/task_management/providers/web_contents/subframe_task.h" 10 #include "chrome/browser/task_management/providers/web_contents/subframe_task.h"
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 DCHECK_EQ(render_widget_host->GetProcess(), 170 DCHECK_EQ(render_widget_host->GetProcess(),
171 web_contents()->GetMainFrame()->GetProcess()); 171 web_contents()->GetMainFrame()->GetProcess());
172 172
173 provider_->NotifyObserverTaskUnresponsive(itr->second); 173 provider_->NotifyObserverTaskUnresponsive(itr->second);
174 } 174 }
175 175
176 void WebContentsEntry::DidNavigateMainFrame( 176 void WebContentsEntry::DidNavigateMainFrame(
177 const content::LoadCommittedDetails& details, 177 const content::LoadCommittedDetails& details,
178 const content::FrameNavigateParams& params) { 178 const content::FrameNavigateParams& params) {
179 auto itr = tasks_by_frames_.find(web_contents()->GetMainFrame()); 179 auto itr = tasks_by_frames_.find(web_contents()->GetMainFrame());
180 if (itr == tasks_by_frames_.end()) { 180 if (itr == tasks_by_frames_.end())
181 // TODO(afakhry): Validate whether this actually happens in practice.
182 NOTREACHED();
afakhry 2016/07/14 00:01:53 Note the removal of these NOTREACHED()s had to be
183 return; 181 return;
184 }
185 182
186 // Listening to WebContentsObserver::TitleWasSet() only is not enough in 183 // Listening to WebContentsObserver::TitleWasSet() only is not enough in
187 // some cases when the the webpage doesn't have a title. That's why we update 184 // some cases when the the webpage doesn't have a title. That's why we update
188 // the title here as well. 185 // the title here as well.
189 itr->second->UpdateTitle(); 186 itr->second->UpdateTitle();
190 187
191 // Call RendererTask::UpdateFavicon() to set the current favicon to the 188 // Call RendererTask::UpdateFavicon() to set the current favicon to the
192 // default favicon. If the page has a non-default favicon, 189 // default favicon. If the page has a non-default favicon,
193 // RendererTask::OnFaviconUpdated() will update the current favicon once 190 // RendererTask::OnFaviconUpdated() will update the current favicon once
194 // FaviconDriver figures out the correct favicon for the page. 191 // FaviconDriver figures out the correct favicon for the page.
195 itr->second->UpdateFavicon(); 192 itr->second->UpdateFavicon();
196 itr->second->UpdateRapporSampleName(); 193 itr->second->UpdateRapporSampleName();
197 } 194 }
198 195
199 void WebContentsEntry::TitleWasSet(content::NavigationEntry* entry, 196 void WebContentsEntry::TitleWasSet(content::NavigationEntry* entry,
200 bool explicit_set) { 197 bool explicit_set) {
201 auto itr = tasks_by_frames_.find(web_contents()->GetMainFrame()); 198 auto itr = tasks_by_frames_.find(web_contents()->GetMainFrame());
202 if (itr == tasks_by_frames_.end()) { 199 if (itr == tasks_by_frames_.end())
203 // TODO(afakhry): Validate whether this actually happens in practice.
204 NOTREACHED();
205 return; 200 return;
206 }
207 201
208 itr->second->UpdateTitle(); 202 itr->second->UpdateTitle();
209 } 203 }
210 204
211 void WebContentsEntry::CreateTaskForFrame(RenderFrameHost* render_frame_host) { 205 void WebContentsEntry::CreateTaskForFrame(RenderFrameHost* render_frame_host) {
212 DCHECK(!ContainsKey(tasks_by_frames_, render_frame_host)); 206 DCHECK(!ContainsKey(tasks_by_frames_, render_frame_host));
213 207
214 content::SiteInstance* site_instance = render_frame_host->GetSiteInstance(); 208 content::SiteInstance* site_instance = render_frame_host->GetSiteInstance();
215 if (!site_instance->GetProcess()->HasConnection()) 209 if (!site_instance->GetProcess()->HasConnection())
216 return; 210 return;
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 388
395 WebContentsEntry* entry = itr->second; 389 WebContentsEntry* entry = itr->second;
396 entries_map_.erase(itr); 390 entries_map_.erase(itr);
397 391
398 // The entry we're about to delete is our caller, however its' still fine to 392 // The entry we're about to delete is our caller, however its' still fine to
399 // delete it. 393 // delete it.
400 delete entry; 394 delete entry;
401 } 395 }
402 396
403 } // namespace task_management 397 } // namespace task_management
OLDNEW
« no previous file with comments | « chrome/browser/media/tab_desktop_media_list_unittest.cc ('k') | chrome/browser/ui/browser_commands.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698