| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/recently_closed_tabs_bridge.h" | 5 #include "chrome/browser/android/recently_closed_tabs_bridge.h" |
| 6 | 6 |
| 7 #include "base/android/jni_string.h" | 7 #include "base/android/jni_string.h" |
| 8 #include "chrome/browser/android/tab_android.h" | 8 #include "chrome/browser/android/tab_android.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/profiles/profile_android.h" | 10 #include "chrome/browser/profiles/profile_android.h" |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 // TabRestoreServiceFactory::GetForProfile() can return NULL (e.g. in | 150 // TabRestoreServiceFactory::GetForProfile() can return NULL (e.g. in |
| 151 // incognito mode). | 151 // incognito mode). |
| 152 if (tab_restore_service_) { | 152 if (tab_restore_service_) { |
| 153 // This does nothing if the tabs have already been loaded or they | 153 // This does nothing if the tabs have already been loaded or they |
| 154 // shouldn't be loaded. | 154 // shouldn't be loaded. |
| 155 tab_restore_service_->LoadTabsFromLastSession(); | 155 tab_restore_service_->LoadTabsFromLastSession(); |
| 156 tab_restore_service_->AddObserver(this); | 156 tab_restore_service_->AddObserver(this); |
| 157 } | 157 } |
| 158 } | 158 } |
| 159 | 159 |
| 160 static jlong Init(JNIEnv* env, jobject obj, jobject jprofile) { | 160 static jlong Init(JNIEnv* env, |
| 161 const JavaParamRef<jobject>& obj, |
| 162 const JavaParamRef<jobject>& jprofile) { |
| 161 RecentlyClosedTabsBridge* bridge = new RecentlyClosedTabsBridge( | 163 RecentlyClosedTabsBridge* bridge = new RecentlyClosedTabsBridge( |
| 162 ProfileAndroid::FromProfileAndroid(jprofile)); | 164 ProfileAndroid::FromProfileAndroid(jprofile)); |
| 163 return reinterpret_cast<intptr_t>(bridge); | 165 return reinterpret_cast<intptr_t>(bridge); |
| 164 } | 166 } |
| 165 | 167 |
| 166 // static | 168 // static |
| 167 bool RecentlyClosedTabsBridge::Register(JNIEnv* env) { | 169 bool RecentlyClosedTabsBridge::Register(JNIEnv* env) { |
| 168 return RegisterNativesImpl(env); | 170 return RegisterNativesImpl(env); |
| 169 } | 171 } |
| OLD | NEW |