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

Side by Side Diff: chrome/browser/sessions/session_restore.cc

Issue 2798143004: Fix for URL opening code (Closed)
Patch Set: Added new files for added tests. Created 3 years, 6 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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/sessions/session_restore.h" 5 #include "chrome/browser/sessions/session_restore.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <list> 10 #include <list>
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 return; 270 return;
271 271
272 default: 272 default:
273 NOTREACHED(); 273 NOTREACHED();
274 break; 274 break;
275 } 275 }
276 } 276 }
277 277
278 Profile* profile() { return profile_; } 278 Profile* profile() { return profile_; }
279 279
280 void AddURLsToOpen(const std::vector<GURL>& urls) {
281 urls_to_open_.insert(urls_to_open_.end(), urls.begin(), urls.end());
282 }
283
280 private: 284 private:
281 // Invoked when done with creating all the tabs/browsers. 285 // Invoked when done with creating all the tabs/browsers.
282 // 286 //
283 // |created_tabbed_browser| indicates whether a tabbed browser was created, 287 // |created_tabbed_browser| indicates whether a tabbed browser was created,
284 // or we used an existing tabbed browser. 288 // or we used an existing tabbed browser.
285 // 289 //
286 // If successful, this begins loading tabs and deletes itself when all tabs 290 // If successful, this begins loading tabs and deletes itself when all tabs
287 // have been loaded. 291 // have been loaded.
288 // 292 //
289 // Returns the Browser that was created, if any. 293 // Returns the Browser that was created, if any.
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
842 } 846 }
843 847
844 // static 848 // static
845 SessionRestore::CallbackSubscription 849 SessionRestore::CallbackSubscription
846 SessionRestore::RegisterOnSessionRestoredCallback( 850 SessionRestore::RegisterOnSessionRestoredCallback(
847 const base::Callback<void(int)>& callback) { 851 const base::Callback<void(int)>& callback) {
848 return on_session_restored_callbacks()->Add(callback); 852 return on_session_restored_callbacks()->Add(callback);
849 } 853 }
850 854
851 // static 855 // static
856 void SessionRestore::AddURLsToOpen(const Profile* profile,
857 const std::vector<GURL>& urls) {
858 for (std::set<SessionRestoreImpl*>::const_iterator it =
Avi (use Gerrit) 2017/06/01 19:54:31 at least use for (auto it =, perhaps switch to for
eugenebng 2017/06/07 10:42:12 Done.
859 active_session_restorers->begin();
860 it != active_session_restorers->end(); ++it) {
861 if ((*it)->profile() == profile) {
862 (*it)->AddURLsToOpen(urls);
863 return;
864 }
865 }
866 NOTREACHED() << "Failed to add urls to open for session restore";
867 }
868
869 // static
852 base::CallbackList<void(int)>* 870 base::CallbackList<void(int)>*
853 SessionRestore::on_session_restored_callbacks_ = nullptr; 871 SessionRestore::on_session_restored_callbacks_ = nullptr;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698