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