Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / ui / tabs / tab_strip_model_utils.cc
blobed09b85658dde0e6e330b97716d7913342d35246
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
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/tabs/tab_strip_model_utils.h"
7 #include "chrome/browser/history/top_sites.h"
8 #include "chrome/browser/ui/tabs/tab_strip_model.h"
9 #include "content/public/browser/web_contents.h"
11 namespace chrome {
13 int IndexOfFirstBlockedTab(const TabStripModel* model) {
14 DCHECK(model);
15 for (int i = 0; i < model->count(); ++i) {
16 if (model->IsTabBlocked(i))
17 return i;
19 // No blocked tabs.
20 return model->count();
23 void GetOpenUrls(const TabStripModel& tabs,
24 const history::TopSites& top_sites,
25 std::set<std::string>* urls) {
26 for (int i = 0; i < tabs.count(); ++i) {
27 content::WebContents* web_contents = tabs.GetWebContentsAt(i);
28 if (web_contents)
29 urls->insert(top_sites.GetCanonicalURLString(web_contents->GetURL()));
33 } // namespace chrome