Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Side by Side Diff: chrome/browser/sessions/session_tab_helper.h

Issue 15499005: Add a new SyncedTabDelegate for Android. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix nit. Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_SESSION_TAB_HELPER_H_ 5 #ifndef CHROME_BROWSER_SESSIONS_SESSION_TAB_HELPER_H_
6 #define CHROME_BROWSER_SESSIONS_SESSION_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 #include "content/public/browser/web_contents_user_data.h" 11 #include "content/public/browser/web_contents_user_data.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 SessionTabHelper : public content::WebContentsObserver, 15 class SessionTabHelper : public content::WebContentsObserver,
16 public content::WebContentsUserData<SessionTabHelper> { 16 public content::WebContentsUserData<SessionTabHelper> {
17 public: 17 public:
18 virtual ~SessionTabHelper(); 18 virtual ~SessionTabHelper();
19 19
20 // Create for WebContents with identifier |id|.
21 static void CreateForWebContentsWithId(content::WebContents* contents,
Nicolas Zea 2013/05/22 20:36:37 nit: contents can be modified, and is therefore an
shashi 2013/05/22 21:18:59 In this case contents will not be modified, if the
Nicolas Zea 2013/05/22 22:06:06 By modified, I include any mutable methods, which
shashi 2013/05/22 22:30:47 Ah, I misunderstood, makes sense. Done.
22 const SessionID& id);
23
20 // Returns the identifier used by session restore for this tab. 24 // Returns the identifier used by session restore for this tab.
21 const SessionID& session_id() const { return session_id_; } 25 const SessionID& session_id() const { return session_id_; }
22 26
23 // Identifier of the window the tab is in. 27 // Identifier of the window the tab is in.
24 void SetWindowID(const SessionID& id); 28 void SetWindowID(const SessionID& id);
25 const SessionID& window_id() const { return window_id_; } 29 const SessionID& window_id() const { return window_id_; }
26 30
27 // content::WebContentsObserver: 31 // content::WebContentsObserver:
28 virtual void RenderViewCreated( 32 virtual void RenderViewCreated(
29 content::RenderViewHost* render_view_host) OVERRIDE; 33 content::RenderViewHost* render_view_host) OVERRIDE;
30 virtual void UserAgentOverrideSet(const std::string& user_agent) OVERRIDE; 34 virtual void UserAgentOverrideSet(const std::string& user_agent) OVERRIDE;
31 35
32 private: 36 private:
33 explicit SessionTabHelper(content::WebContents* contents); 37 explicit SessionTabHelper(content::WebContents* contents);
38 explicit SessionTabHelper(content::WebContents* contents,
39 const SessionID& id);
34 friend class content::WebContentsUserData<SessionTabHelper>; 40 friend class content::WebContentsUserData<SessionTabHelper>;
35 41
36 // Unique identifier of the tab for session restore. This id is only unique 42 // Unique identifier of the tab for session restore. This id is only unique
37 // within the current session, and is not guaranteed to be unique across 43 // within the current session, and is not guaranteed to be unique across
38 // sessions. 44 // sessions.
39 const SessionID session_id_; 45 const SessionID session_id_;
40 46
41 // Unique identifier of the window the tab is in. 47 // Unique identifier of the window the tab is in.
42 SessionID window_id_; 48 SessionID window_id_;
43 49
44 DISALLOW_COPY_AND_ASSIGN(SessionTabHelper); 50 DISALLOW_COPY_AND_ASSIGN(SessionTabHelper);
45 }; 51 };
46 52
47 #endif // CHROME_BROWSER_SESSIONS_SESSION_TAB_HELPER_H_ 53 #endif // CHROME_BROWSER_SESSIONS_SESSION_TAB_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698