Chromium Code Reviews| 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/ui/tabs/tab_strip_model_utils.h" | 5 #include "chrome/browser/ui/tabs/tab_strip_model_utils.h" |
| 6 | 6 |
| 7 #include "chrome/browser/history/top_sites.h" | |
| 7 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 8 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 9 #include "content/public/browser/web_contents.h" | |
| 8 | 10 |
| 9 namespace chrome { | 11 namespace chrome { |
| 10 | 12 |
| 11 int IndexOfFirstBlockedTab(const TabStripModel* model) { | 13 int IndexOfFirstBlockedTab(const TabStripModel* model) { |
| 12 DCHECK(model); | 14 DCHECK(model); |
| 13 for (int i = 0; i < model->count(); ++i) { | 15 for (int i = 0; i < model->count(); ++i) { |
| 14 if (model->IsTabBlocked(i)) | 16 if (model->IsTabBlocked(i)) |
| 15 return i; | 17 return i; |
| 16 } | 18 } |
| 17 // No blocked tabs. | 19 // No blocked tabs. |
| 18 return model->count(); | 20 return model->count(); |
| 19 } | 21 } |
| 20 | 22 |
| 23 // Creates a set containing the canonical URLs of the currently open tabs. | |
|
Alexei Svitkine (slow)
2013/07/24 18:37:36
No need for a comment here, given that you already
annark1
2013/07/24 20:43:31
Done.
| |
| 24 void GetOpenUrls(const TabStripModel& tabs, | |
| 25 const history::TopSites& top_sites, | |
| 26 std::set<std::string>* urls) { | |
| 27 for (int i = 0; i < tabs.count(); ++i) { | |
| 28 content::WebContents* web_contents = tabs.GetWebContentsAt(i); | |
| 29 if (web_contents) | |
| 30 urls->insert(top_sites.GetCanonicalURLString(web_contents->GetURL())); | |
| 31 } | |
| 32 } | |
| 33 | |
| 21 } // namespace chrome | 34 } // namespace chrome |
| OLD | NEW |