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/webui/ntp/suggestions_combiner.h" | 5 #include "chrome/browser/ui/webui/ntp/suggestions_combiner.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/browser/extensions/api/discovery/suggested_links_registry.h" | 10 #include "chrome/browser/extensions/api/discovery/suggested_links_registry.h" |
11 #include "chrome/browser/extensions/api/discovery/suggested_links_registry_facto
ry.h" | 11 #include "chrome/browser/extensions/api/discovery/suggested_links_registry_facto
ry.h" |
12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
14 #include "chrome/browser/ui/browser_list.h" | 14 #include "chrome/browser/ui/browser_list.h" |
| 15 #include "chrome/browser/ui/browser_tabstrip.h" |
15 #include "chrome/browser/ui/webui/ntp/suggestions_page_handler.h" | 16 #include "chrome/browser/ui/webui/ntp/suggestions_page_handler.h" |
16 #include "chrome/browser/ui/webui/ntp/suggestions_source.h" | 17 #include "chrome/browser/ui/webui/ntp/suggestions_source.h" |
17 #include "chrome/browser/ui/webui/ntp/suggestions_source_discovery.h" | 18 #include "chrome/browser/ui/webui/ntp/suggestions_source_discovery.h" |
18 #include "chrome/browser/ui/webui/ntp/suggestions_source_top_sites.h" | 19 #include "chrome/browser/ui/webui/ntp/suggestions_source_top_sites.h" |
19 #include "content/public/browser/web_contents.h" | 20 #include "content/public/browser/web_contents.h" |
20 | 21 |
21 namespace { | 22 namespace { |
22 | 23 |
23 static const size_t kSuggestionsCount = 8; | 24 static const size_t kSuggestionsCount = 8; |
24 | 25 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 | 156 |
156 bool SuggestionsCombiner::IsURLAlreadyOpen(const GURL &url) { | 157 bool SuggestionsCombiner::IsURLAlreadyOpen(const GURL &url) { |
157 for (BrowserList::const_iterator it = BrowserList::begin(); | 158 for (BrowserList::const_iterator it = BrowserList::begin(); |
158 it != BrowserList::end(); ++it) { | 159 it != BrowserList::end(); ++it) { |
159 const Browser* browser = *it; | 160 const Browser* browser = *it; |
160 if (browser->profile()->IsOffTheRecord() || | 161 if (browser->profile()->IsOffTheRecord() || |
161 !browser->profile()->IsSameProfile(profile_)) | 162 !browser->profile()->IsSameProfile(profile_)) |
162 continue; | 163 continue; |
163 | 164 |
164 for (int i = 0; i < browser->tab_count(); i++) { | 165 for (int i = 0; i < browser->tab_count(); i++) { |
165 const content::WebContents* tab = browser->GetWebContentsAt(i); | 166 const content::WebContents* tab = chrome::GetWebContentsAt(browser, i); |
166 if (tab->GetURL() == url) | 167 if (tab->GetURL() == url) |
167 return true; | 168 return true; |
168 } | 169 } |
169 } | 170 } |
170 return false; | 171 return false; |
171 } | 172 } |
OLD | NEW |