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

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

Issue 2088443003: Shortcut ctrl+shift+T added on android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add incognito check in native code, based on code review feedback. Created 4 years, 5 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_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 <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "chrome/browser/ui/android/tab_model/android_live_tab_context.h"
11 #include "components/sessions/core/session_id.h" 12 #include "components/sessions/core/session_id.h"
12 #include "components/sync_sessions/synced_window_delegate.h" 13 #include "components/sync_sessions/synced_window_delegate.h"
13 #include "components/toolbar/toolbar_model.h" 14 #include "components/toolbar/toolbar_model.h"
14 #include "components/toolbar/toolbar_model_delegate.h" 15 #include "components/toolbar/toolbar_model_delegate.h"
15 #include "content/public/browser/notification_observer.h" 16 #include "content/public/browser/notification_observer.h"
16 #include "content/public/browser/notification_registrar.h" 17 #include "content/public/browser/notification_registrar.h"
17 18
18 namespace browser_sync { 19 namespace browser_sync {
19 class SyncedWindowDelegate; 20 class SyncedWindowDelegate;
20 class SyncedWindowDelegateAndroid; 21 class SyncedWindowDelegateAndroid;
21 } 22 }
22 23
23 namespace content { 24 namespace content {
24 class WebContents; 25 class WebContents;
25 } 26 }
26 27
28 namespace sessiosn {
29 class LiveTabContext;
30 }
31
27 class Profile; 32 class Profile;
28 class TabAndroid; 33 class TabAndroid;
29 34
30 // Abstract representation of a Tab Model for Android. Since Android does 35 // Abstract representation of a Tab Model for Android. Since Android does
31 // not use Browser/BrowserList, this is required to allow Chrome to interact 36 // not use Browser/BrowserList, this is required to allow Chrome to interact
32 // with Android's Tabs and Tab Model. 37 // with Android's Tabs and Tab Model.
33 class TabModel : public content::NotificationObserver { 38 class TabModel : public content::NotificationObserver {
34 public: 39 public:
35 virtual Profile* GetProfile() const; 40 virtual Profile* GetProfile() const;
36 virtual bool IsOffTheRecord() const; 41 virtual bool IsOffTheRecord() const;
37 virtual browser_sync::SyncedWindowDelegate* GetSyncedWindowDelegate() const; 42 virtual browser_sync::SyncedWindowDelegate* GetSyncedWindowDelegate() const;
38 virtual SessionID::id_type GetSessionId() const; 43 virtual SessionID::id_type GetSessionId() const;
44 virtual const SessionID& SessionId() const;
45 virtual sessions::LiveTabContext* GetLiveTabContext() const;
39 46
40 virtual int GetTabCount() const = 0; 47 virtual int GetTabCount() const = 0;
41 virtual int GetActiveIndex() const = 0; 48 virtual int GetActiveIndex() const = 0;
42 virtual content::WebContents* GetActiveWebContents() const; 49 virtual content::WebContents* GetActiveWebContents() const;
43 virtual content::WebContents* GetWebContentsAt(int index) const = 0; 50 virtual content::WebContents* GetWebContentsAt(int index) const = 0;
44 // This will return NULL if the tab has not yet been initialized. 51 // This will return NULL if the tab has not yet been initialized.
45 virtual TabAndroid* GetTabAt(int index) const = 0; 52 virtual TabAndroid* GetTabAt(int index) const = 0;
46 53
47 virtual void SetActiveIndex(int index) = 0; 54 virtual void SetActiveIndex(int index) = 0;
48 virtual void CloseTabAt(int index) = 0; 55 virtual void CloseTabAt(int index) = 0;
(...skipping 22 matching lines...) Expand all
71 78
72 private: 79 private:
73 // Determines how TabModel will interact with the profile. 80 // Determines how TabModel will interact with the profile.
74 void Observe(int type, 81 void Observe(int type,
75 const content::NotificationSource& source, 82 const content::NotificationSource& source,
76 const content::NotificationDetails& details) override; 83 const content::NotificationDetails& details) override;
77 84
78 // The profile associated with this TabModel. 85 // The profile associated with this TabModel.
79 Profile* profile_; 86 Profile* profile_;
80 87
88 // The LiveTabContext adapter associated with TabModel.
89 std::unique_ptr<AndroidLiveTabContext> live_tab_context_;
Theresa 2016/06/29 23:53:30 Let's explain what we're using the LiveTabContext
90
81 // Describes if this TabModel contains an off-the-record profile. 91 // Describes if this TabModel contains an off-the-record profile.
82 bool is_off_the_record_; 92 bool is_off_the_record_;
83 93
84 // The SyncedWindowDelegate associated with this TabModel. 94 // The SyncedWindowDelegate associated with this TabModel.
85 std::unique_ptr<browser_sync::SyncedWindowDelegateAndroid> 95 std::unique_ptr<browser_sync::SyncedWindowDelegateAndroid>
86 synced_window_delegate_; 96 synced_window_delegate_;
87 97
88 // Unique identifier of this TabModel for session restore. This id is only 98 // Unique identifier of this TabModel for session restore. This id is only
89 // unique within the current session, and is not guaranteed to be unique 99 // unique within the current session, and is not guaranteed to be unique
90 // across sessions. 100 // across sessions.
91 SessionID session_id_; 101 SessionID session_id_;
92 102
93 // The Registrar used to register TabModel for notifications. 103 // The Registrar used to register TabModel for notifications.
94 content::NotificationRegistrar registrar_; 104 content::NotificationRegistrar registrar_;
95 105
96 DISALLOW_COPY_AND_ASSIGN(TabModel); 106 DISALLOW_COPY_AND_ASSIGN(TabModel);
97 }; 107 };
98 108
99 #endif // CHROME_BROWSER_UI_ANDROID_TAB_MODEL_TAB_MODEL_H_ 109 #endif // CHROME_BROWSER_UI_ANDROID_TAB_MODEL_TAB_MODEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698