Chromium Code Reviews| Index: chrome/browser/sessions/session_restore.h |
| diff --git a/chrome/browser/sessions/session_restore.h b/chrome/browser/sessions/session_restore.h |
| index 17090a514c97928dc4fa5ebbe29d7e4b60d7986a..3e5229198e19e32aa38925e2e3c8adef4106b8c4 100644 |
| --- a/chrome/browser/sessions/session_restore.h |
| +++ b/chrome/browser/sessions/session_restore.h |
| @@ -17,6 +17,7 @@ |
| #include "chrome/browser/sessions/session_restore_observer.h" |
| #include "components/history/core/browser/history_service.h" |
| #include "components/sessions/core/session_types.h" |
| +#include "content/public/browser/web_contents_user_data.h" |
| #include "ui/base/window_open_disposition.h" |
| class Browser; |
| @@ -27,6 +28,28 @@ namespace content { |
| class WebContents; |
| } |
| +// Indicate the origin of the restoration of web contents (e.g., session |
| +// restore, reopening closed tab, and restore foreign tab). A tab |
| +// holds a valid instance of this class only when the tab is loading during |
| +// session restore. |
| +class RestoreOrigin : public content::WebContentsUserData<RestoreOrigin> { |
|
sky
2017/07/25 16:48:00
I think the enum makes sense if it's going to be a
chrisha
2017/07/25 19:00:50
+1 to this idea.
|
| + public: |
| + enum class Type { SESSION_RESTORE }; |
| + |
| + static void CreateForWebContents(content::WebContents* contents, |
| + RestoreOrigin::Type type); |
| + static void RemoveFromWebContents(content::WebContents* contents); |
| + ~RestoreOrigin() override; |
| + |
| + Type type() const { return type_; } |
| + |
| + private: |
| + friend class content::WebContentsUserData<RestoreOrigin>; |
| + explicit RestoreOrigin(Type type); |
| + |
| + Type type_; |
| +}; |
| + |
| // SessionRestore handles restoring either the last or saved session. Session |
| // restore come in two variants, asynchronous or synchronous. The synchronous |
| // variety is meant for startup and blocks until restore is complete. |