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

Unified Diff: chrome/browser/ui/tabs/tab_strip_model_utils.cc

Issue 17114002: Field trial removing tiles from NTP if URL is already open - for 1993 clients (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Consolidated GetOpenURLs and addressed comments Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/tabs/tab_strip_model_utils.cc
diff --git a/chrome/browser/ui/tabs/tab_strip_model_utils.cc b/chrome/browser/ui/tabs/tab_strip_model_utils.cc
index 2605dd7532e361f432d4f0e4eb20c5f57b37a003..8017059113c752bd843f9c9353c3d3c7c67bb933 100644
--- a/chrome/browser/ui/tabs/tab_strip_model_utils.cc
+++ b/chrome/browser/ui/tabs/tab_strip_model_utils.cc
@@ -4,7 +4,9 @@
#include "chrome/browser/ui/tabs/tab_strip_model_utils.h"
+#include "chrome/browser/history/top_sites.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
+#include "content/public/browser/web_contents.h"
namespace chrome {
@@ -18,4 +20,15 @@ int IndexOfFirstBlockedTab(const TabStripModel* model) {
return model->count();
}
+// 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.
+void GetOpenUrls(const TabStripModel& tabs,
+ const history::TopSites& top_sites,
+ std::set<std::string>* urls) {
+ for (int i = 0; i < tabs.count(); ++i) {
+ content::WebContents* web_contents = tabs.GetWebContentsAt(i);
+ if (web_contents)
+ urls->insert(top_sites.GetCanonicalURLString(web_contents->GetURL()));
+ }
+}
+
} // namespace chrome

Powered by Google App Engine
This is Rietveld 408576698