OLD | NEW |
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 Loading... |
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 | |
284 private: | 280 private: |
285 // Invoked when done with creating all the tabs/browsers. | 281 // Invoked when done with creating all the tabs/browsers. |
286 // | 282 // |
287 // |created_tabbed_browser| indicates whether a tabbed browser was created, | 283 // |created_tabbed_browser| indicates whether a tabbed browser was created, |
288 // or we used an existing tabbed browser. | 284 // or we used an existing tabbed browser. |
289 // | 285 // |
290 // If successful, this begins loading tabs and deletes itself when all tabs | 286 // If successful, this begins loading tabs and deletes itself when all tabs |
291 // have been loaded. | 287 // have been loaded. |
292 // | 288 // |
293 // Returns the Browser that was created, if any. | 289 // Returns the Browser that was created, if any. |
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
846 } | 842 } |
847 | 843 |
848 // static | 844 // static |
849 SessionRestore::CallbackSubscription | 845 SessionRestore::CallbackSubscription |
850 SessionRestore::RegisterOnSessionRestoredCallback( | 846 SessionRestore::RegisterOnSessionRestoredCallback( |
851 const base::Callback<void(int)>& callback) { | 847 const base::Callback<void(int)>& callback) { |
852 return on_session_restored_callbacks()->Add(callback); | 848 return on_session_restored_callbacks()->Add(callback); |
853 } | 849 } |
854 | 850 |
855 // static | 851 // static |
856 void SessionRestore::AddURLsToOpen(const Profile* profile, | |
857 const std::vector<GURL>& urls) { | |
858 for (auto* session_restorer : *active_session_restorers) { | |
859 if (session_restorer->profile() == profile) { | |
860 session_restorer->AddURLsToOpen(urls); | |
861 return; | |
862 } | |
863 } | |
864 NOTREACHED() << "Failed to add urls to open for session restore"; | |
865 } | |
866 | |
867 // static | |
868 base::CallbackList<void(int)>* | 852 base::CallbackList<void(int)>* |
869 SessionRestore::on_session_restored_callbacks_ = nullptr; | 853 SessionRestore::on_session_restored_callbacks_ = nullptr; |
OLD | NEW |