Chromium Code Reviews| 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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 Loading... | |
| 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) { | |
| 860 if ((*it)->profile() == profile) { | |
| 861 (*it)->AddURLsToOpen(urls); | |
| 862 return; | |
| 863 } | |
| 864 } | |
| 865 DCHECK(0) << "Failed to add urls to open for session restore"; | |
|
sky
2017/04/28 17:34:58
NOTREACHED
eugenebng
2017/05/03 16:05:30
Done.
| |
| 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; |
| OLD | NEW |