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

Side by Side Diff: chrome/browser/extensions/api/sessions/sessions_api.cc

Issue 1260033003: Partially componentize //chrome/browser/search/search.{h,cc} (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compilation on iOS Created 5 years, 4 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 unified diff | Download patch
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « chrome/browser/chrome_content_browser_client.cc ('k') | chrome/browser/extensions/extension_url_rewrite_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698