| 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/extensions/api/sessions/sessions_api.h" | 5 #include "chrome/browser/extensions/api/sessions/sessions_api.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 | 260 |
| 261 // Prune tabs that are not syncable or are NewTabPage. Then, sort the tabs | 261 // Prune tabs that are not syncable or are NewTabPage. Then, sort the tabs |
| 262 // from most recent to least recent. | 262 // from most recent to least recent. |
| 263 std::vector<const sessions::SessionTab*> tabs_in_window; | 263 std::vector<const sessions::SessionTab*> tabs_in_window; |
| 264 for (size_t i = 0; i < window.tabs.size(); ++i) { | 264 for (size_t i = 0; i < window.tabs.size(); ++i) { |
| 265 const sessions::SessionTab* tab = window.tabs[i]; | 265 const sessions::SessionTab* tab = window.tabs[i]; |
| 266 if (tab->navigations.empty()) | 266 if (tab->navigations.empty()) |
| 267 continue; | 267 continue; |
| 268 const sessions::SerializedNavigationEntry& current_navigation = | 268 const sessions::SerializedNavigationEntry& current_navigation = |
| 269 tab->navigations.at(tab->normalized_navigation_index()); | 269 tab->navigations.at(tab->normalized_navigation_index()); |
| 270 if (chrome::IsNTPURL(current_navigation.virtual_url(), GetProfile())) { | 270 if (search::IsNTPURL(current_navigation.virtual_url(), GetProfile())) { |
| 271 continue; | 271 continue; |
| 272 } | 272 } |
| 273 tabs_in_window.push_back(tab); | 273 tabs_in_window.push_back(tab); |
| 274 } | 274 } |
| 275 if (tabs_in_window.empty()) | 275 if (tabs_in_window.empty()) |
| 276 return scoped_ptr<windows::Window>(); | 276 return scoped_ptr<windows::Window>(); |
| 277 std::sort(tabs_in_window.begin(), tabs_in_window.end(), SortTabsByRecency); | 277 std::sort(tabs_in_window.begin(), tabs_in_window.end(), SortTabsByRecency); |
| 278 | 278 |
| 279 scoped_ptr<std::vector<linked_ptr<tabs::Tab> > > tabs( | 279 scoped_ptr<std::vector<linked_ptr<tabs::Tab> > > tabs( |
| 280 new std::vector<linked_ptr<tabs::Tab> >); | 280 new std::vector<linked_ptr<tabs::Tab> >); |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 650 return g_factory.Pointer(); | 650 return g_factory.Pointer(); |
| 651 } | 651 } |
| 652 | 652 |
| 653 void SessionsAPI::OnListenerAdded(const EventListenerInfo& details) { | 653 void SessionsAPI::OnListenerAdded(const EventListenerInfo& details) { |
| 654 sessions_event_router_.reset( | 654 sessions_event_router_.reset( |
| 655 new SessionsEventRouter(Profile::FromBrowserContext(browser_context_))); | 655 new SessionsEventRouter(Profile::FromBrowserContext(browser_context_))); |
| 656 EventRouter::Get(browser_context_)->UnregisterObserver(this); | 656 EventRouter::Get(browser_context_)->UnregisterObserver(this); |
| 657 } | 657 } |
| 658 | 658 |
| 659 } // namespace extensions | 659 } // namespace extensions |
| OLD | NEW |