| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_SESSIONS_RESTORE_TAB_HELPER_H_ | 5 #ifndef CHROME_BROWSER_SESSIONS_RESTORE_TAB_HELPER_H_ |
| 6 #define CHROME_BROWSER_SESSIONS_RESTORE_TAB_HELPER_H_ | 6 #define CHROME_BROWSER_SESSIONS_RESTORE_TAB_HELPER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "chrome/browser/sessions/session_id.h" | 10 #include "chrome/browser/sessions/session_id.h" |
| 11 #include "content/public/browser/web_contents_observer.h" | 11 #include "content/public/browser/web_contents_observer.h" |
| 12 | 12 |
| 13 // This class keeps the extension API's windowID up-to-date with the current | 13 // This class keeps the extension API's windowID up-to-date with the current |
| 14 // window of the tab. | 14 // window of the tab. |
| 15 class RestoreTabHelper : public content::WebContentsObserver { | 15 class RestoreTabHelper : public content::WebContentsObserver { |
| 16 public: | 16 public: |
| 17 explicit RestoreTabHelper(TabContents* contents); | 17 explicit RestoreTabHelper(content::WebContents* contents); |
| 18 virtual ~RestoreTabHelper(); | 18 virtual ~RestoreTabHelper(); |
| 19 | 19 |
| 20 // Returns the identifier used by session restore for this tab. | 20 // Returns the identifier used by session restore for this tab. |
| 21 const SessionID& session_id() const { return session_id_; } | 21 const SessionID& session_id() const { return session_id_; } |
| 22 | 22 |
| 23 // Identifier of the window the tab is in. | 23 // Identifier of the window the tab is in. |
| 24 void SetWindowID(const SessionID& id); | 24 void SetWindowID(const SessionID& id); |
| 25 const SessionID& window_id() const { return window_id_; } | 25 const SessionID& window_id() const { return window_id_; } |
| 26 | 26 |
| 27 // content::WebContentsObserver: | 27 // content::WebContentsObserver: |
| 28 virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE; | 28 virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE; |
| 29 | 29 |
| 30 private: | 30 private: |
| 31 TabContents* contents_; | |
| 32 | |
| 33 // Unique identifier of the tab for session restore. This id is only unique | 31 // Unique identifier of the tab for session restore. This id is only unique |
| 34 // within the current session, and is not guaranteed to be unique across | 32 // within the current session, and is not guaranteed to be unique across |
| 35 // sessions. | 33 // sessions. |
| 36 const SessionID session_id_; | 34 const SessionID session_id_; |
| 37 | 35 |
| 38 // Unique identifier of the window the tab is in. | 36 // Unique identifier of the window the tab is in. |
| 39 SessionID window_id_; | 37 SessionID window_id_; |
| 40 | 38 |
| 41 DISALLOW_COPY_AND_ASSIGN(RestoreTabHelper); | 39 DISALLOW_COPY_AND_ASSIGN(RestoreTabHelper); |
| 42 }; | 40 }; |
| 43 | 41 |
| 44 #endif // CHROME_BROWSER_SESSIONS_RESTORE_TAB_HELPER_H_ | 42 #endif // CHROME_BROWSER_SESSIONS_RESTORE_TAB_HELPER_H_ |
| OLD | NEW |