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

Side by Side Diff: chrome/browser/android/tab_android.cc

Issue 774183004: Upstream historical tab logic (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@upstreaming_2
Patch Set: Created 6 years 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
« no previous file with comments | « chrome/browser/android/tab_android.h ('k') | chrome/browser/android/tab_state.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "chrome/browser/android/tab_android.h" 5 #include "chrome/browser/android/tab_android.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_array.h" 8 #include "base/android/jni_array.h"
9 #include "base/android/jni_string.h" 9 #include "base/android/jni_string.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
11 #include "chrome/browser/android/chrome_web_contents_delegate_android.h" 11 #include "chrome/browser/android/chrome_web_contents_delegate_android.h"
12 #include "chrome/browser/browser_about_handler.h" 12 #include "chrome/browser/browser_about_handler.h"
13 #include "chrome/browser/chrome_notification_types.h" 13 #include "chrome/browser/chrome_notification_types.h"
14 #include "chrome/browser/content_settings/tab_specific_content_settings.h" 14 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
15 #include "chrome/browser/favicon/favicon_tab_helper.h" 15 #include "chrome/browser/favicon/favicon_tab_helper.h"
16 #include "chrome/browser/google/google_url_tracker_factory.h" 16 #include "chrome/browser/google/google_url_tracker_factory.h"
17 #include "chrome/browser/infobars/infobar_service.h" 17 #include "chrome/browser/infobars/infobar_service.h"
18 #include "chrome/browser/prerender/prerender_contents.h" 18 #include "chrome/browser/prerender/prerender_contents.h"
19 #include "chrome/browser/prerender/prerender_manager.h" 19 #include "chrome/browser/prerender/prerender_manager.h"
20 #include "chrome/browser/prerender/prerender_manager_factory.h" 20 #include "chrome/browser/prerender/prerender_manager_factory.h"
21 #include "chrome/browser/printing/print_view_manager_basic.h" 21 #include "chrome/browser/printing/print_view_manager_basic.h"
22 #include "chrome/browser/profiles/profile.h" 22 #include "chrome/browser/profiles/profile.h"
23 #include "chrome/browser/profiles/profile_android.h" 23 #include "chrome/browser/profiles/profile_android.h"
24 #include "chrome/browser/search/instant_service.h" 24 #include "chrome/browser/search/instant_service.h"
25 #include "chrome/browser/search/instant_service_factory.h" 25 #include "chrome/browser/search/instant_service_factory.h"
26 #include "chrome/browser/search/search.h" 26 #include "chrome/browser/search/search.h"
27 #include "chrome/browser/sessions/session_tab_helper.h" 27 #include "chrome/browser/sessions/session_tab_helper.h"
28 #include "chrome/browser/sessions/tab_restore_service.h"
29 #include "chrome/browser/sessions/tab_restore_service_factory.h"
28 #include "chrome/browser/sync/glue/synced_tab_delegate_android.h" 30 #include "chrome/browser/sync/glue/synced_tab_delegate_android.h"
29 #include "chrome/browser/tab_contents/tab_util.h" 31 #include "chrome/browser/tab_contents/tab_util.h"
30 #include "chrome/browser/ui/android/content_settings/popup_blocked_infobar_deleg ate.h" 32 #include "chrome/browser/ui/android/content_settings/popup_blocked_infobar_deleg ate.h"
31 #include "chrome/browser/ui/android/context_menu_helper.h" 33 #include "chrome/browser/ui/android/context_menu_helper.h"
32 #include "chrome/browser/ui/android/infobars/infobar_container_android.h" 34 #include "chrome/browser/ui/android/infobars/infobar_container_android.h"
33 #include "chrome/browser/ui/android/tab_model/tab_model.h" 35 #include "chrome/browser/ui/android/tab_model/tab_model.h"
34 #include "chrome/browser/ui/android/tab_model/tab_model_list.h" 36 #include "chrome/browser/ui/android/tab_model/tab_model_list.h"
35 #include "chrome/browser/ui/android/window_android_helper.h" 37 #include "chrome/browser/ui/android/window_android_helper.h"
36 #include "chrome/browser/ui/blocked_content/popup_blocker_tab_helper.h" 38 #include "chrome/browser/ui/blocked_content/popup_blocker_tab_helper.h"
37 #include "chrome/browser/ui/search/instant_search_prerenderer.h" 39 #include "chrome/browser/ui/search/instant_search_prerenderer.h"
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 return bitmap; 674 return bitmap;
673 } 675 }
674 676
675 prerender::PrerenderManager* TabAndroid::GetPrerenderManager() const { 677 prerender::PrerenderManager* TabAndroid::GetPrerenderManager() const {
676 Profile* profile = GetProfile(); 678 Profile* profile = GetProfile();
677 if (!profile) 679 if (!profile)
678 return NULL; 680 return NULL;
679 return prerender::PrerenderManagerFactory::GetForProfile(profile); 681 return prerender::PrerenderManagerFactory::GetForProfile(profile);
680 } 682 }
681 683
684 void TabAndroid::CreateHistoricalTabFromContents(WebContents* web_contents) {
David Trainor- moved to gerrit 2014/12/04 07:45:27 Put "// static" above this? Might as well do same
gone 2014/12/04 18:19:51 Done.
685 DCHECK(web_contents);
686
687 TabRestoreService* service =
688 TabRestoreServiceFactory::GetForProfile(
689 Profile::FromBrowserContext(web_contents->GetBrowserContext()));
690 if (!service)
691 return;
692
693 // Exclude internal pages from being marked as recent when they are closed.
694 const GURL& tab_url = web_contents->GetURL();
695 if (tab_url.SchemeIs(content::kChromeUIScheme) ||
696 tab_url.SchemeIs(chrome::kChromeNativeScheme) ||
697 tab_url.SchemeIs(url::kAboutScheme)) {
698 return;
699 }
700
701 // TODO(jcivelli): is the index important?
702 service->CreateHistoricalTab(web_contents, -1);
703 }
704
705 void TabAndroid::CreateHistoricalTab(JNIEnv* env, jobject obj) {
706 TabAndroid::CreateHistoricalTabFromContents(web_contents());
707 }
708
682 static void Init(JNIEnv* env, jobject obj) { 709 static void Init(JNIEnv* env, jobject obj) {
683 TRACE_EVENT0("native", "TabAndroid::Init"); 710 TRACE_EVENT0("native", "TabAndroid::Init");
684 // This will automatically bind to the Java object and pass ownership there. 711 // This will automatically bind to the Java object and pass ownership there.
685 new TabAndroid(env, obj); 712 new TabAndroid(env, obj);
686 } 713 }
687 714
688 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) { 715 bool TabAndroid::RegisterTabAndroid(JNIEnv* env) {
689 return RegisterNativesImpl(env); 716 return RegisterNativesImpl(env);
690 } 717 }
OLDNEW
« no previous file with comments | « chrome/browser/android/tab_android.h ('k') | chrome/browser/android/tab_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698