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

Unified Diff: chrome/browser/ui/android/tab_model/android_live_tab_context.cc

Issue 2088443003: Shortcut ctrl+shift+T added on android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove commented code, my bad. Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/android/tab_model/android_live_tab_context.cc
diff --git a/chrome/browser/ui/android/tab_model/android_live_tab_context.cc b/chrome/browser/ui/android/tab_model/android_live_tab_context.cc
new file mode 100644
index 0000000000000000000000000000000000000000..5aa69b363e09324274c2f42287188532c71c2662
--- /dev/null
+++ b/chrome/browser/ui/android/tab_model/android_live_tab_context.cc
@@ -0,0 +1,98 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/android/tab_android.h"
+#include "chrome/browser/ui/android/tab_model/android_live_tab_context.h"
+#include "chrome/browser/ui/android/tab_model/tab_model.h"
+#include "chrome/browser/ui/android/tab_model/tab_model_list.h"
+#include "components/sessions/content/content_live_tab.h"
+
+AndroidLiveTabContext::AndroidLiveTabContext(TabModel* tab_model)
+ : tab_model_(tab_model) {}
+
+// Not supported by android.
+void AndroidLiveTabContext::ShowBrowserWindow() {
+}
+
+const SessionID& AndroidLiveTabContext::GetSessionID() const {
+ return tab_model_->SessionId();
+}
+
+int AndroidLiveTabContext::GetTabCount() const {
+ return tab_model_->GetTabCount();
+}
+
+int AndroidLiveTabContext::GetSelectedIndex() const {
+ return tab_model_->GetActiveIndex();
+}
+
+// Not supported by android.
+std::string AndroidLiveTabContext::GetAppName() const {
+ return std::string();
+}
+
+sessions::LiveTab* AndroidLiveTabContext::GetLiveTabAt(int index) const {
+ TabAndroid* tab_android = tab_model_->GetTabAt(index);
+ if (!tab_android || !tab_android->web_contents())
+ return nullptr;
+
+ return sessions::ContentLiveTab::GetForWebContents(
+ tab_android->web_contents());
+}
+
+sessions::LiveTab* AndroidLiveTabContext::GetActiveLiveTab() const {
+ content::WebContents* web_contents = tab_model_->GetActiveWebContents();
+ if (!web_contents)
+ return nullptr;
+
+ return sessions::ContentLiveTab::GetForWebContents(web_contents);
+}
+
+// Not supported by android.
+bool AndroidLiveTabContext::IsTabPinned(int index) const {
+ return false;
+}
+
+// Currently do nothing.
+sessions::LiveTab* AndroidLiveTabContext::AddRestoredTab(
+ const std::vector<sessions::SerializedNavigationEntry>& navigations,
+ int tab_index,
+ int selected_navigation,
+ const std::string& extension_app_id,
+ bool select,
+ bool pin,
+ bool from_last_session,
+ const sessions::PlatformSpecificTabData* tab_platform_data,
+ const std::string& user_agent_override) {
+ NOTIMPLEMENTED();
+ return nullptr;
Theresa 2016/07/02 01:00:37 This would also need to be implemented. It would b
+}
+
+// Currently do nothing.
+sessions::LiveTab* AndroidLiveTabContext::ReplaceRestoredTab(
+ const std::vector<sessions::SerializedNavigationEntry>& navigations,
+ int selected_navigation,
+ bool from_last_session,
+ const std::string& extension_app_id,
+ const sessions::PlatformSpecificTabData* tab_platform_data,
+ const std::string& user_agent_override) {
+ NOTIMPLEMENTED();
+ return nullptr;
+}
+
+// Currently do nothing.
+void AndroidLiveTabContext::CloseTab() {
+ NOTIMPLEMENTED();
+}
+
+// static.
+sessions::LiveTabContext* AndroidLiveTabContext::FindContextForWebContents(
+ const content::WebContents* contents) {
+ TabAndroid* tab_android = TabAndroid::FromWebContents(contents);
+ TabModel* model = TabModelList::FindTabModelWithId(
+ tab_android->window_id().id());
+
+ return model ? model->GetLiveTabContext() : nullptr;
+}
+
Theresa 2016/07/02 01:00:37 We would need a new method here, sessions::LiveTab
xingliu 2016/07/05 19:46:38 Updated the CL, refactor the code to use RestoreMo

Powered by Google App Engine
This is Rietveld 408576698