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

Side by Side Diff: chrome/browser/ui/sync/tab_contents_synced_tab_delegate.cc

Issue 1422393002: Fix crash when following a link opening a new tab/window. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | 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) 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/ui/sync/tab_contents_synced_tab_delegate.h" 5 #include "chrome/browser/ui/sync/tab_contents_synced_tab_delegate.h"
6 6
7 #include "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/sessions/session_tab_helper.h" 9 #include "chrome/browser/sessions/session_tab_helper.h"
10 #include "components/sessions/content/content_serialized_navigation_builder.h" 10 #include "components/sessions/content/content_serialized_navigation_builder.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 int TabContentsSyncedTabDelegate::GetCurrentEntryIndex() const { 78 int TabContentsSyncedTabDelegate::GetCurrentEntryIndex() const {
79 return web_contents_->GetController().GetCurrentEntryIndex(); 79 return web_contents_->GetController().GetCurrentEntryIndex();
80 } 80 }
81 81
82 int TabContentsSyncedTabDelegate::GetEntryCount() const { 82 int TabContentsSyncedTabDelegate::GetEntryCount() const {
83 return web_contents_->GetController().GetEntryCount(); 83 return web_contents_->GetController().GetEntryCount();
84 } 84 }
85 85
86 GURL TabContentsSyncedTabDelegate::GetVirtualURLAtIndex(int i) const { 86 GURL TabContentsSyncedTabDelegate::GetVirtualURLAtIndex(int i) const {
87 NavigationEntry* entry = GetPossiblyPendingEntryAtIndex(web_contents_, i); 87 NavigationEntry* entry = GetPossiblyPendingEntryAtIndex(web_contents_, i);
88 return entry->GetVirtualURL(); 88 return entry ? entry->GetVirtualURL() : GURL();
89 } 89 }
90 90
91 GURL TabContentsSyncedTabDelegate::GetFaviconURLAtIndex(int i) const { 91 GURL TabContentsSyncedTabDelegate::GetFaviconURLAtIndex(int i) const {
92 NavigationEntry* entry = GetPossiblyPendingEntryAtIndex(web_contents_, i); 92 NavigationEntry* entry = GetPossiblyPendingEntryAtIndex(web_contents_, i);
93 return (entry->GetFavicon().valid ? entry->GetFavicon().url : GURL()); 93 return (entry->GetFavicon().valid ? entry->GetFavicon().url : GURL());
94 } 94 }
95 95
96 ui::PageTransition TabContentsSyncedTabDelegate::GetTransitionAtIndex( 96 ui::PageTransition TabContentsSyncedTabDelegate::GetTransitionAtIndex(
97 int i) const { 97 int i) const {
98 NavigationEntry* entry = GetPossiblyPendingEntryAtIndex(web_contents_, i); 98 NavigationEntry* entry = GetPossiblyPendingEntryAtIndex(web_contents_, i);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 for (int i = 0; i < entry_count; ++i) { 155 for (int i = 0; i < entry_count; ++i) {
156 const GURL& virtual_url = GetVirtualURLAtIndex(i); 156 const GURL& virtual_url = GetVirtualURLAtIndex(i);
157 if (!virtual_url.is_valid()) 157 if (!virtual_url.is_valid())
158 continue; 158 continue;
159 159
160 if (sessions_client->ShouldSyncURL(virtual_url)) 160 if (sessions_client->ShouldSyncURL(virtual_url))
161 return true; 161 return true;
162 } 162 }
163 return false; 163 return false;
164 } 164 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698