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

Side by Side Diff: chrome/browser/ui/android/tab_model/tab_model.h

Issue 270883002: Upstream base implementations of TabModel, TabModelSelector, and TabModelObserver. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 6 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) 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_window_delegate.h" 10 #include "chrome/browser/sync/glue/synced_window_delegate.h"
(...skipping 12 matching lines...) Expand all
23 } 23 }
24 24
25 class Profile; 25 class Profile;
26 class TabAndroid; 26 class TabAndroid;
27 27
28 // Abstract representation of a Tab Model for Android. Since Android does 28 // Abstract representation of a Tab Model for Android. Since Android does
29 // 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
30 // with Android's Tabs and Tab Model. 30 // with Android's Tabs and Tab Model.
31 class TabModel : public content::NotificationObserver { 31 class TabModel : public content::NotificationObserver {
32 public: 32 public:
33 explicit TabModel(Profile* profile);
34 virtual ~TabModel();
35
36 virtual Profile* GetProfile() const; 33 virtual Profile* GetProfile() const;
37 virtual bool IsOffTheRecord() const; 34 virtual bool IsOffTheRecord() const;
38 virtual browser_sync::SyncedWindowDelegate* GetSyncedWindowDelegate() const; 35 virtual browser_sync::SyncedWindowDelegate* GetSyncedWindowDelegate() const;
39 virtual SessionID::id_type GetSessionId() const; 36 virtual SessionID::id_type GetSessionId() const;
40 37
41 virtual int GetTabCount() const = 0; 38 virtual int GetTabCount() const = 0;
42 virtual int GetActiveIndex() const = 0; 39 virtual int GetActiveIndex() const = 0;
43 virtual content::WebContents* GetWebContentsAt(int index) const = 0; 40 virtual content::WebContents* GetWebContentsAt(int index) const = 0;
44 virtual TabAndroid* GetTabAt(int index) const = 0; 41 virtual TabAndroid* GetTabAt(int index) const = 0;
45 42
46 virtual void SetActiveIndex(int index) = 0; 43 virtual void SetActiveIndex(int index) = 0;
47 virtual void CloseTabAt(int index) = 0; 44 virtual void CloseTabAt(int index) = 0;
48 45
49 // Used for restoring tabs from synced foreign sessions. 46 // Used for restoring tabs from synced foreign sessions.
50 virtual void CreateTab(content::WebContents* web_contents, 47 virtual void CreateTab(content::WebContents* web_contents,
51 int parent_tab_id) = 0; 48 int parent_tab_id) = 0;
52 49
53 // Used by Developer Tools to create a new tab with a given URL. 50 // Used by Developer Tools to create a new tab with a given URL.
54 // Replaces CreateTabForTesting. 51 // Replaces CreateTabForTesting.
55 virtual content::WebContents* CreateNewTabForDevTools(const GURL& url) = 0; 52 virtual content::WebContents* CreateNewTabForDevTools(const GURL& url) = 0;
56 53
57 // Return true if we are currently restoring sessions asynchronously. 54 // Return true if we are currently restoring sessions asynchronously.
58 virtual bool IsSessionRestoreInProgress() const = 0; 55 virtual bool IsSessionRestoreInProgress() const = 0;
59 56
60 virtual void OpenClearBrowsingData() const = 0; 57 virtual void OpenClearBrowsingData() const = 0;
61 58
62 protected: 59 protected:
60 explicit TabModel(Profile* profile);
61 virtual ~TabModel();
62
63 // Instructs the TabModel to broadcast a notification that all tabs are now 63 // Instructs the TabModel to broadcast a notification that all tabs are now
64 // loaded from storage. 64 // loaded from storage.
65 void BroadcastSessionRestoreComplete(); 65 void BroadcastSessionRestoreComplete();
66 66
67 ToolbarModel* GetToolbarModel(); 67 ToolbarModel* GetToolbarModel();
68 68
69 private: 69 private:
70 // Determines how TabModel will interact with the profile. 70 // Determines how TabModel will interact with the profile.
71 virtual void Observe(int type, 71 virtual void Observe(int type,
72 const content::NotificationSource& source, 72 const content::NotificationSource& source,
(...skipping 13 matching lines...) Expand all
86 // across sessions. 86 // across sessions.
87 SessionID session_id_; 87 SessionID session_id_;
88 88
89 // The Registrar used to register TabModel for notifications. 89 // The Registrar used to register TabModel for notifications.
90 content::NotificationRegistrar registrar_; 90 content::NotificationRegistrar registrar_;
91 91
92 DISALLOW_COPY_AND_ASSIGN(TabModel); 92 DISALLOW_COPY_AND_ASSIGN(TabModel);
93 }; 93 };
94 94
95 #endif // CHROME_BROWSER_UI_ANDROID_TAB_MODEL_TAB_MODEL_H_ 95 #endif // CHROME_BROWSER_UI_ANDROID_TAB_MODEL_TAB_MODEL_H_
OLDNEW
« no previous file with comments | « chrome/browser/android/chrome_jni_registrar.cc ('k') | chrome/browser/ui/android/tab_model/tab_model_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698