OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_BROWSER_LIVE_TAB_CONTEXT_H_ | 5 #ifndef CHROME_BROWSER_UI_ANDROID_TAB_MODEL_ANDROID_LIVE_TAB_CONTEXT_H_ |
6 #define CHROME_BROWSER_UI_BROWSER_LIVE_TAB_CONTEXT_H_ | 6 #define CHROME_BROWSER_UI_ANDROID_TAB_MODEL_ANDROID_LIVE_TAB_CONTEXT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "components/sessions/core/live_tab_context.h" | 13 #include "components/sessions/core/live_tab_context.h" |
14 | 14 |
15 class Browser; | |
16 class Profile; | |
17 | |
18 namespace content { | 15 namespace content { |
19 class WebContents; | 16 class WebContents; |
20 } | 17 } |
21 | 18 |
22 // Implementation of LiveTabContext which uses an instance of | 19 class TabModel; |
23 // Browser in order to fulfil its duties. | 20 |
24 class BrowserLiveTabContext : public sessions::LiveTabContext { | 21 // Implementation of LiveTabContext which used by android. |
Theresa
2016/06/30 20:50:25
nit: is used by Android.
xingliu
2016/07/01 00:30:39
Done.
| |
22 // Serve as adapter to LiveTabContext. | |
Theresa
2016/06/30 20:50:25
nit: I think this line can be removed.
xingliu
2016/07/01 00:30:39
Done.
| |
23 class AndroidLiveTabContext : public sessions::LiveTabContext { | |
25 public: | 24 public: |
26 explicit BrowserLiveTabContext(Browser* browser) : browser_(browser) {} | 25 explicit AndroidLiveTabContext(TabModel* tab_model); |
27 ~BrowserLiveTabContext() override {} | 26 ~AndroidLiveTabContext() override {} |
28 | 27 |
29 // Overridden from LiveTabContext: | 28 // Overridden from LiveTabContext: |
30 void ShowBrowserWindow() override; | 29 void ShowBrowserWindow() override; |
31 const SessionID& GetSessionID() const override; | 30 const SessionID& GetSessionID() const override; |
32 int GetTabCount() const override; | 31 int GetTabCount() const override; |
33 int GetSelectedIndex() const override; | 32 int GetSelectedIndex() const override; |
34 std::string GetAppName() const override; | 33 std::string GetAppName() const override; |
35 sessions::LiveTab* GetLiveTabAt(int index) const override; | 34 sessions::LiveTab* GetLiveTabAt(int index) const override; |
36 sessions::LiveTab* GetActiveLiveTab() const override; | 35 sessions::LiveTab* GetActiveLiveTab() const override; |
37 bool IsTabPinned(int index) const override; | 36 bool IsTabPinned(int index) const override; |
38 sessions::LiveTab* AddRestoredTab( | 37 sessions::LiveTab* AddRestoredTab( |
39 const std::vector<sessions::SerializedNavigationEntry>& navigations, | 38 const std::vector<sessions::SerializedNavigationEntry>& navigations, |
40 int tab_index, | 39 int tab_index, |
41 int selected_navigation, | 40 int selected_navigation, |
42 const std::string& extension_app_id, | 41 const std::string& extension_app_id, |
43 bool select, | 42 bool select, |
44 bool pin, | 43 bool pin, |
45 bool from_last_session, | 44 bool from_last_session, |
46 const sessions::PlatformSpecificTabData* storage_namespace, | 45 const sessions::PlatformSpecificTabData* storage_namespace, |
47 const std::string& user_agent_override) override; | 46 const std::string& user_agent_override) override; |
48 sessions::LiveTab* ReplaceRestoredTab( | 47 sessions::LiveTab* ReplaceRestoredTab( |
49 const std::vector<sessions::SerializedNavigationEntry>& navigations, | 48 const std::vector<sessions::SerializedNavigationEntry>& navigations, |
50 int selected_navigation, | 49 int selected_navigation, |
51 bool from_last_session, | 50 bool from_last_session, |
52 const std::string& extension_app_id, | 51 const std::string& extension_app_id, |
53 const sessions::PlatformSpecificTabData* tab_platform_data, | 52 const sessions::PlatformSpecificTabData* tab_platform_data, |
54 const std::string& user_agent_override) override; | 53 const std::string& user_agent_override) override; |
55 void CloseTab() override; | 54 void CloseTab() override; |
56 | 55 |
57 // see Browser::Create | 56 static LiveTabContext* FindContextForWebContents(const |
Theresa
2016/06/30 20:50:25
nit: put const on next line with content::WebConte
xingliu
2016/07/01 00:30:39
Done.
| |
58 static sessions::LiveTabContext* Create( | 57 content::WebContents* contents); |
59 Profile* profile, | |
60 const std::string& app_name); | |
61 | |
62 // see browser::FindBrowserForWebContents | |
63 static sessions::LiveTabContext* FindContextForWebContents( | |
64 const content::WebContents* contents); | |
65 | |
66 // see chrome::FindBrowserWithID | |
67 // Returns the LiveTabContext of the Browser with |desired_id| if | |
68 // such a Browser exists. | |
69 static sessions::LiveTabContext* FindContextWithID( | |
70 SessionID::id_type desired_id); | |
71 | 58 |
72 private: | 59 private: |
73 Browser* browser_; | 60 TabModel* tab_model_; |
74 | 61 DISALLOW_COPY_AND_ASSIGN(AndroidLiveTabContext); |
75 DISALLOW_COPY_AND_ASSIGN(BrowserLiveTabContext); | |
76 }; | 62 }; |
77 | 63 |
78 #endif // CHROME_BROWSER_UI_BROWSER_LIVE_TAB_CONTEXT_H_ | 64 |
65 #endif // CHROME_BROWSER_UI_ANDROID_TAB_MODEL_ANDROID_LIVE_TAB_CONTEXT_H_ | |
OLD | NEW |