OLD | NEW |
1 // Copyright 2016 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 #include "chrome/browser/android/tab_android.h" | 5 #include "chrome/browser/android/tab_android.h" |
6 #include "chrome/browser/profiles/profile.h" | 6 #include "chrome/browser/profiles/profile.h" |
7 #include "chrome/browser/ui/android/tab_model/android_live_tab_context.h" | 7 #include "chrome/browser/ui/android/tab_model/android_live_tab_context.h" |
8 #include "chrome/browser/ui/android/tab_model/tab_model.h" | 8 #include "chrome/browser/ui/android/tab_model/tab_model.h" |
9 #include "chrome/browser/ui/android/tab_model/tab_model_list.h" | 9 #include "chrome/browser/ui/android/tab_model/tab_model_list.h" |
10 #include "components/sessions/content/content_live_tab.h" | 10 #include "components/sessions/content/content_live_tab.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 } | 25 } |
26 | 26 |
27 int AndroidLiveTabContext::GetTabCount() const { | 27 int AndroidLiveTabContext::GetTabCount() const { |
28 return tab_model_->GetTabCount(); | 28 return tab_model_->GetTabCount(); |
29 } | 29 } |
30 | 30 |
31 int AndroidLiveTabContext::GetSelectedIndex() const { | 31 int AndroidLiveTabContext::GetSelectedIndex() const { |
32 return tab_model_->GetActiveIndex(); | 32 return tab_model_->GetActiveIndex(); |
33 } | 33 } |
34 | 34 |
35 // Not supported by android. | |
36 std::string AndroidLiveTabContext::GetAppName() const { | 35 std::string AndroidLiveTabContext::GetAppName() const { |
| 36 // Not applicable to android. |
| 37 NOTREACHED(); |
37 return std::string(); | 38 return std::string(); |
38 } | 39 } |
39 | 40 |
40 sessions::LiveTab* AndroidLiveTabContext::GetLiveTabAt(int index) const { | 41 sessions::LiveTab* AndroidLiveTabContext::GetLiveTabAt(int index) const { |
41 TabAndroid* tab_android = tab_model_->GetTabAt(index); | 42 TabAndroid* tab_android = tab_model_->GetTabAt(index); |
42 if (!tab_android || !tab_android->web_contents()) | 43 if (!tab_android || !tab_android->web_contents()) |
43 return nullptr; | 44 return nullptr; |
44 | 45 |
45 return sessions::ContentLiveTab::GetForWebContents( | 46 return sessions::ContentLiveTab::GetForWebContents( |
46 tab_android->web_contents()); | 47 tab_android->web_contents()); |
47 } | 48 } |
48 | 49 |
49 sessions::LiveTab* AndroidLiveTabContext::GetActiveLiveTab() const { | 50 sessions::LiveTab* AndroidLiveTabContext::GetActiveLiveTab() const { |
50 content::WebContents* web_contents = tab_model_->GetActiveWebContents(); | 51 content::WebContents* web_contents = tab_model_->GetActiveWebContents(); |
51 if (!web_contents) | 52 if (!web_contents) |
52 return nullptr; | 53 return nullptr; |
53 | 54 |
54 return sessions::ContentLiveTab::GetForWebContents(web_contents); | 55 return sessions::ContentLiveTab::GetForWebContents(web_contents); |
55 } | 56 } |
56 | 57 |
57 // Not supported by android. | |
58 bool AndroidLiveTabContext::IsTabPinned(int index) const { | 58 bool AndroidLiveTabContext::IsTabPinned(int index) const { |
| 59 // Not applicable to android. |
| 60 NOTREACHED(); |
59 return false; | 61 return false; |
60 } | 62 } |
61 | 63 |
| 64 const gfx::Rect AndroidLiveTabContext::GetRestoredBounds() const { |
| 65 // Not applicable to android. |
| 66 NOTREACHED(); |
| 67 return gfx::Rect(); |
| 68 } |
| 69 |
| 70 ui::WindowShowState AndroidLiveTabContext::GetRestoredState() const { |
| 71 // Not applicable to android. |
| 72 NOTREACHED(); |
| 73 return ui::SHOW_STATE_NORMAL; |
| 74 } |
| 75 |
| 76 std::string AndroidLiveTabContext::GetWorkspace() const { |
| 77 // Not applicable to android. |
| 78 NOTREACHED(); |
| 79 return std::string(); |
| 80 } |
| 81 |
62 sessions::LiveTab* AndroidLiveTabContext::AddRestoredTab( | 82 sessions::LiveTab* AndroidLiveTabContext::AddRestoredTab( |
63 const std::vector<sessions::SerializedNavigationEntry>& navigations, | 83 const std::vector<sessions::SerializedNavigationEntry>& navigations, |
64 int tab_index, | 84 int tab_index, |
65 int selected_navigation, | 85 int selected_navigation, |
66 const std::string& extension_app_id, | 86 const std::string& extension_app_id, |
67 bool select, | 87 bool select, |
68 bool pin, | 88 bool pin, |
69 bool from_last_session, | 89 bool from_last_session, |
70 const sessions::PlatformSpecificTabData* tab_platform_data, | 90 const sessions::PlatformSpecificTabData* tab_platform_data, |
71 const std::string& user_agent_override) { | 91 const std::string& user_agent_override) { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 for (auto it = TabModelList::begin(); it != TabModelList::end(); ++it) { | 149 for (auto it = TabModelList::begin(); it != TabModelList::end(); ++it) { |
130 TabModel* model = *it; | 150 TabModel* model = *it; |
131 if (!model->IsOffTheRecord()) { | 151 if (!model->IsOffTheRecord()) { |
132 return model->GetLiveTabContext(); | 152 return model->GetLiveTabContext(); |
133 } | 153 } |
134 } | 154 } |
135 } | 155 } |
136 | 156 |
137 return tab_model ? tab_model->GetLiveTabContext() : nullptr; | 157 return tab_model ? tab_model->GetLiveTabContext() : nullptr; |
138 } | 158 } |
OLD | NEW |