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

Side by Side Diff: chrome/browser/ui/search/instant_page.cc

Issue 22043004: Check for null on Browser pointer to address crash report. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 4 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
« 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/search/instant_page.h" 5 #include "chrome/browser/ui/search/instant_page.h"
6 6
7 #include "apps/app_launcher.h" 7 #include "apps/app_launcher.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/chrome_notification_types.h" 9 #include "chrome/browser/chrome_notification_types.h"
10 #include "chrome/browser/history/most_visited_tiles_experiment.h" 10 #include "chrome/browser/history/most_visited_tiles_experiment.h"
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 } 293 }
294 294
295 void InstantPage::MaybeRemoveMostVisitedItems( 295 void InstantPage::MaybeRemoveMostVisitedItems(
296 std::vector<InstantMostVisitedItem>* items) { 296 std::vector<InstantMostVisitedItem>* items) {
297 // The code below uses APIs not available on Android and the experiment should 297 // The code below uses APIs not available on Android and the experiment should
298 // not run there. 298 // not run there.
299 #if !defined(OS_ANDROID) 299 #if !defined(OS_ANDROID)
300 if (!history::MostVisitedTilesExperiment::IsDontShowOpenURLsEnabled()) 300 if (!history::MostVisitedTilesExperiment::IsDontShowOpenURLsEnabled())
301 return; 301 return;
302 302
303 TabStripModel* tab_strip_model = chrome::FindBrowserWithProfile( 303 Browser* browser = chrome::FindBrowserWithProfile(profile_,
304 profile_, 304 chrome::GetActiveDesktop());
305 chrome::GetActiveDesktop())->tab_strip_model(); 305 if (!browser)
306 return;
307
308 TabStripModel* tab_strip_model = browser->tab_strip_model();
306 history::TopSites* top_sites = profile_->GetTopSites(); 309 history::TopSites* top_sites = profile_->GetTopSites();
307 if (!tab_strip_model || !top_sites) { 310 if (!tab_strip_model || !top_sites) {
308 NOTREACHED(); 311 NOTREACHED();
309 return; 312 return;
310 } 313 }
311 314
312 std::set<std::string> open_urls; 315 std::set<std::string> open_urls;
313 chrome::GetOpenUrls(*tab_strip_model, *top_sites, &open_urls); 316 chrome::GetOpenUrls(*tab_strip_model, *top_sites, &open_urls);
314 history::MostVisitedTilesExperiment::RemoveItemsMatchingOpenTabs( 317 history::MostVisitedTilesExperiment::RemoveItemsMatchingOpenTabs(
315 open_urls, items); 318 open_urls, items);
316 319
317 #endif 320 #endif
318 } 321 }
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