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

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

Issue 1321713005: Abstract WebContents/NavigationController from core TabRestore code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Response to review Created 5 years, 3 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 #ifndef CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_DELEGATE_H_ 5 #ifndef CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_DELEGATE_H_
6 #define CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_DELEGATE_H_ 6 #define CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_DELEGATE_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "components/sessions/session_id.h" 11 #include "components/sessions/session_id.h"
12 12
13 namespace content { 13 namespace sessions {
14 class NavigationController; 14 class LiveTab;
15 class WebContents;
16 } 15 }
17 16
18 namespace sessions { 17 namespace sessions {
19 class SerializedNavigationEntry; 18 class SerializedNavigationEntry;
20 class TabClientData; 19 class TabClientData;
21 } 20 }
22 21
23 // Objects implement this interface to provide necessary functionality for 22 // Objects implement this interface to provide necessary functionality for
24 // TabRestoreService to operate. These methods are mostly copies of existing 23 // TabRestoreService to operate. These methods are mostly copies of existing
25 // Browser methods. 24 // Browser methods.
26 class TabRestoreServiceDelegate { 25 class TabRestoreServiceDelegate {
27 public: 26 public:
28 // see BrowserWindow::Show() 27 // see BrowserWindow::Show()
29 virtual void ShowBrowserWindow() = 0; 28 virtual void ShowBrowserWindow() = 0;
30 29
31 // see Browser::session_id() 30 // see Browser::session_id()
32 virtual const SessionID& GetSessionID() const = 0; 31 virtual const SessionID& GetSessionID() const = 0;
33 32
34 // see Browser::tab_count() 33 // see Browser::tab_count()
35 virtual int GetTabCount() const = 0; 34 virtual int GetTabCount() const = 0;
36 35
37 // see Browser::active_index() 36 // see Browser::active_index()
38 virtual int GetSelectedIndex() const = 0; 37 virtual int GetSelectedIndex() const = 0;
39 38
40 // see Browser::app_name() 39 // see Browser::app_name()
41 virtual std::string GetAppName() const = 0; 40 virtual std::string GetAppName() const = 0;
42 41
43 // see Browser methods with the same names 42 virtual sessions::LiveTab* GetLiveTabAt(int index) const = 0;
44 virtual content::WebContents* GetWebContentsAt(int index) const = 0; 43 virtual sessions::LiveTab* GetActiveLiveTab() const = 0;
45 virtual content::WebContents* GetActiveWebContents() const = 0;
46 virtual bool IsTabPinned(int index) const = 0; 44 virtual bool IsTabPinned(int index) const = 0;
47 45
48 // Note: |tab_client_data| may be null (e.g., if |from_last_session| is true, 46 // Note: |tab_client_data| may be null (e.g., if |from_last_session| is true,
49 // as the tab client data is not persisted, or if the embedder did not supply 47 // as the tab client data is not persisted, or if the embedder did not supply
50 // client data for the tab in question). 48 // client data for the tab in question).
51 virtual content::WebContents* AddRestoredTab( 49 virtual sessions::LiveTab* AddRestoredTab(
52 const std::vector<sessions::SerializedNavigationEntry>& navigations, 50 const std::vector<sessions::SerializedNavigationEntry>& navigations,
53 int tab_index, 51 int tab_index,
54 int selected_navigation, 52 int selected_navigation,
55 const std::string& extension_app_id, 53 const std::string& extension_app_id,
56 bool select, 54 bool select,
57 bool pin, 55 bool pin,
58 bool from_last_session, 56 bool from_last_session,
59 const sessions::TabClientData* tab_client_data, 57 const sessions::TabClientData* tab_client_data,
60 const std::string& user_agent_override) = 0; 58 const std::string& user_agent_override) = 0;
61 59
62 // Note: |tab_client_data| may be null (e.g., if |from_last_session| is true, 60 // Note: |tab_client_data| may be null (e.g., if |from_last_session| is true,
63 // as the tab client data is not persisted, or if the embedder did not supply 61 // as the tab client data is not persisted, or if the embedder did not supply
64 virtual content::WebContents* ReplaceRestoredTab( 62 virtual sessions::LiveTab* ReplaceRestoredTab(
65 const std::vector<sessions::SerializedNavigationEntry>& navigations, 63 const std::vector<sessions::SerializedNavigationEntry>& navigations,
66 int selected_navigation, 64 int selected_navigation,
67 bool from_last_session, 65 bool from_last_session,
68 const std::string& extension_app_id, 66 const std::string& extension_app_id,
69 const sessions::TabClientData* tab_client_data, 67 const sessions::TabClientData* tab_client_data,
70 const std::string& user_agent_override) = 0; 68 const std::string& user_agent_override) = 0;
71 virtual void CloseTab() = 0; 69 virtual void CloseTab() = 0;
72 70
73 protected: 71 protected:
74 virtual ~TabRestoreServiceDelegate() {} 72 virtual ~TabRestoreServiceDelegate() {}
75 }; 73 };
76 74
77 #endif // CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_DELEGATE_H_ 75 #endif // CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_DELEGATE_H_
OLDNEW
« no previous file with comments | « chrome/browser/sessions/tab_restore_service.h ('k') | chrome/browser/sessions/tab_restore_service_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698