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

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

Issue 2798143004: Fix for URL opening code (Closed)
Patch Set: Code style: disallow copy and assign. Created 3 years, 7 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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 return; 269 return;
270 270
271 default: 271 default:
272 NOTREACHED(); 272 NOTREACHED();
273 break; 273 break;
274 } 274 }
275 } 275 }
276 276
277 Profile* profile() { return profile_; } 277 Profile* profile() { return profile_; }
278 278
279 void AddURLsToOpen(const std::vector<GURL>& urls) {
280 urls_to_open_.insert(urls_to_open_.end(), urls.begin(), urls.end());
281 }
282
279 private: 283 private:
280 // Invoked when done with creating all the tabs/browsers. 284 // Invoked when done with creating all the tabs/browsers.
281 // 285 //
282 // |created_tabbed_browser| indicates whether a tabbed browser was created, 286 // |created_tabbed_browser| indicates whether a tabbed browser was created,
283 // or we used an existing tabbed browser. 287 // or we used an existing tabbed browser.
284 // 288 //
285 // If successful, this begins loading tabs and deletes itself when all tabs 289 // If successful, this begins loading tabs and deletes itself when all tabs
286 // have been loaded. 290 // have been loaded.
287 // 291 //
288 // Returns the Browser that was created, if any. 292 // Returns the Browser that was created, if any.
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
841 } 845 }
842 846
843 // static 847 // static
844 SessionRestore::CallbackSubscription 848 SessionRestore::CallbackSubscription
845 SessionRestore::RegisterOnSessionRestoredCallback( 849 SessionRestore::RegisterOnSessionRestoredCallback(
846 const base::Callback<void(int)>& callback) { 850 const base::Callback<void(int)>& callback) {
847 return on_session_restored_callbacks()->Add(callback); 851 return on_session_restored_callbacks()->Add(callback);
848 } 852 }
849 853
850 // static 854 // static
855 void SessionRestore::AddURLsToOpen(const Profile* profile,
856 const std::vector<GURL>& urls) {
857 for (std::set<SessionRestoreImpl*>::const_iterator it =
858 active_session_restorers->begin();
859 it != active_session_restorers->end(); ++it) {
Avi (use Gerrit) 2017/05/17 15:51:09 for (const auto* restorer : active_session_restore
860 if ((*it)->profile() == profile) {
861 (*it)->AddURLsToOpen(urls);
862 return;
863 }
864 }
865 NOTREACHED() << "Failed to add urls to open for session restore";
866 }
867
868 // static
851 base::CallbackList<void(int)>* 869 base::CallbackList<void(int)>*
852 SessionRestore::on_session_restored_callbacks_ = nullptr; 870 SessionRestore::on_session_restored_callbacks_ = nullptr;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698