OLD | NEW |
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 Loading... |
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 } |
OLD | NEW |