OLD | NEW |
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_UI_ANDROID_TAB_MODEL_TAB_MODEL_H_ | 5 #ifndef CHROME_BROWSER_UI_ANDROID_TAB_MODEL_TAB_MODEL_H_ |
6 #define CHROME_BROWSER_UI_ANDROID_TAB_MODEL_TAB_MODEL_H_ | 6 #define CHROME_BROWSER_UI_ANDROID_TAB_MODEL_TAB_MODEL_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "chrome/browser/sessions/session_id.h" | 9 #include "chrome/browser/sessions/session_id.h" |
| 10 #include "chrome/browser/sync/glue/synced_tab_delegate.h" |
10 #include "chrome/browser/ui/toolbar/toolbar_model.h" | 11 #include "chrome/browser/ui/toolbar/toolbar_model.h" |
11 #include "chrome/browser/ui/toolbar/toolbar_model_delegate.h" | 12 #include "chrome/browser/ui/toolbar/toolbar_model_delegate.h" |
12 #include "content/public/browser/notification_observer.h" | 13 #include "content/public/browser/notification_observer.h" |
13 #include "content/public/browser/notification_registrar.h" | 14 #include "content/public/browser/notification_registrar.h" |
14 | 15 |
15 namespace browser_sync { | 16 namespace browser_sync { |
16 class SyncedWindowDelegate; | 17 class SyncedWindowDelegate; |
17 class SyncedWindowDelegateAndroid; | 18 class SyncedWindowDelegateAndroid; |
| 19 class SyncedTabDelegate; |
18 } | 20 } |
19 | 21 |
20 namespace content { | 22 namespace content { |
21 class WebContents; | 23 class WebContents; |
22 } | 24 } |
23 | 25 |
24 class Profile; | 26 class Profile; |
25 | 27 |
26 // Abstract representation of a Tab Model for Android. Since Android does | 28 // Abstract representation of a Tab Model for Android. Since Android does |
27 // not use Browser/BrowserList, this is required to allow Chrome to interact | 29 // not use Browser/BrowserList, this is required to allow Chrome to interact |
28 // with Android's Tabs and Tab Model. | 30 // with Android's Tabs and Tab Model. |
29 class TabModel : public content::NotificationObserver, | 31 class TabModel : public content::NotificationObserver, |
30 public ToolbarModelDelegate { | 32 public ToolbarModelDelegate { |
31 public: | 33 public: |
32 explicit TabModel(Profile* profile); | 34 explicit TabModel(Profile* profile); |
33 // Deprecated: This constructor is deprecated and should be removed once | 35 // Deprecated: This constructor is deprecated and should be removed once |
34 // downstream Android uses new constructor. See crbug.com/159704. | 36 // downstream Android uses new constructor. See crbug.com/159704. |
35 TabModel(); | 37 TabModel(); |
36 virtual ~TabModel(); | 38 virtual ~TabModel(); |
37 | 39 |
38 // Implementation of ToolbarDelegate | 40 // Implementation of ToolbarDelegate |
39 virtual content::WebContents* GetActiveWebContents() const OVERRIDE; | 41 virtual content::WebContents* GetActiveWebContents() const OVERRIDE; |
40 | 42 |
41 virtual Profile* GetProfile() const; | 43 virtual Profile* GetProfile() const; |
42 virtual bool IsOffTheRecord() const; | 44 virtual bool IsOffTheRecord() const; |
43 virtual browser_sync::SyncedWindowDelegate* GetSyncedWindowDelegate() const; | 45 virtual browser_sync::SyncedWindowDelegate* GetSyncedWindowDelegate() const; |
44 virtual SessionID::id_type GetSessionId() const; | 46 virtual SessionID::id_type GetSessionId() const; |
45 | |
46 virtual int GetTabCount() const = 0; | 47 virtual int GetTabCount() const = 0; |
47 virtual int GetActiveIndex() const = 0; | 48 virtual int GetActiveIndex() const = 0; |
48 virtual content::WebContents* GetWebContentsAt(int index) const = 0; | 49 virtual content::WebContents* GetWebContentsAt(int index) const = 0; |
49 virtual SessionID::id_type GetTabIdAt(int index) const = 0; | 50 virtual browser_sync::SyncedTabDelegate* GetTabAt(int index) const = 0; |
50 | 51 |
51 // Used for restoring tabs from synced foreign sessions. | 52 // Used for restoring tabs from synced foreign sessions. |
52 virtual void CreateTab(content::WebContents* web_contents) = 0; | 53 virtual void CreateTab(content::WebContents* web_contents) = 0; |
53 | 54 |
54 // Return true if we are currently restoring sessions asynchronously. | 55 // Return true if we are currently restoring sessions asynchronously. |
55 virtual bool IsSessionRestoreInProgress() const = 0; | 56 virtual bool IsSessionRestoreInProgress() const = 0; |
56 | 57 |
57 virtual void OpenClearBrowsingData() const = 0; | 58 virtual void OpenClearBrowsingData() const = 0; |
58 | 59 |
59 ToolbarModel::SecurityLevel GetSecurityLevelForCurrentTab(); | 60 ToolbarModel::SecurityLevel GetSecurityLevelForCurrentTab(); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 // across sessions. | 98 // across sessions. |
98 SessionID session_id_; | 99 SessionID session_id_; |
99 | 100 |
100 // The Registrar used to register TabModel for notifications. | 101 // The Registrar used to register TabModel for notifications. |
101 content::NotificationRegistrar registrar_; | 102 content::NotificationRegistrar registrar_; |
102 | 103 |
103 DISALLOW_COPY_AND_ASSIGN(TabModel); | 104 DISALLOW_COPY_AND_ASSIGN(TabModel); |
104 }; | 105 }; |
105 | 106 |
106 #endif // CHROME_BROWSER_UI_ANDROID_TAB_MODEL_TAB_MODEL_H_ | 107 #endif // CHROME_BROWSER_UI_ANDROID_TAB_MODEL_TAB_MODEL_H_ |
OLD | NEW |