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

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

Issue 2237943002: Remove now-unnecessary .obj() in Java method calls. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@switch-context
Patch Set: Rebase *again* :( Created 4 years, 4 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 unified diff | Download patch
OLDNEW
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 13 matching lines...) Expand all
24 24
25 namespace { 25 namespace {
26 26
27 void AddTabToList(JNIEnv* env, 27 void AddTabToList(JNIEnv* env,
28 const sessions::TabRestoreService::Tab& tab, 28 const sessions::TabRestoreService::Tab& tab,
29 jobject jtabs_list) { 29 jobject jtabs_list) {
30 const sessions::SerializedNavigationEntry& current_navigation = 30 const sessions::SerializedNavigationEntry& current_navigation =
31 tab.navigations.at(tab.current_navigation_index); 31 tab.navigations.at(tab.current_navigation_index);
32 Java_RecentlyClosedBridge_pushTab( 32 Java_RecentlyClosedBridge_pushTab(
33 env, jtabs_list, tab.id, 33 env, jtabs_list, tab.id,
34 ConvertUTF16ToJavaString(env, current_navigation.title()).obj(), 34 ConvertUTF16ToJavaString(env, current_navigation.title()),
35 ConvertUTF8ToJavaString(env, current_navigation.virtual_url().spec()) 35 ConvertUTF8ToJavaString(env, current_navigation.virtual_url().spec()));
36 .obj());
37 } 36 }
38 37
39 void AddTabsToList(JNIEnv* env, 38 void AddTabsToList(JNIEnv* env,
40 const sessions::TabRestoreService::Entries& entries, 39 const sessions::TabRestoreService::Entries& entries,
41 jobject jtabs_list, 40 jobject jtabs_list,
42 int max_tab_count) { 41 int max_tab_count) {
43 int added_count = 0; 42 int added_count = 0;
44 for (const auto& entry : entries) { 43 for (const auto& entry : entries) {
45 DCHECK_EQ(entry->type, sessions::TabRestoreService::TAB); 44 DCHECK_EQ(entry->type, sessions::TabRestoreService::TAB);
46 if (entry->type == sessions::TabRestoreService::TAB) { 45 if (entry->type == sessions::TabRestoreService::TAB) {
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 EnsureTabRestoreService(); 148 EnsureTabRestoreService();
150 if (tab_restore_service_) 149 if (tab_restore_service_)
151 tab_restore_service_->ClearEntries(); 150 tab_restore_service_->ClearEntries();
152 } 151 }
153 152
154 void RecentlyClosedTabsBridge::TabRestoreServiceChanged( 153 void RecentlyClosedTabsBridge::TabRestoreServiceChanged(
155 sessions::TabRestoreService* service) { 154 sessions::TabRestoreService* service) {
156 if (callback_.is_null()) 155 if (callback_.is_null())
157 return; 156 return;
158 JNIEnv* env = AttachCurrentThread(); 157 JNIEnv* env = AttachCurrentThread();
159 Java_RecentlyClosedCallback_onUpdated(env, callback_.obj()); 158 Java_RecentlyClosedCallback_onUpdated(env, callback_);
160 } 159 }
161 160
162 void RecentlyClosedTabsBridge::TabRestoreServiceDestroyed( 161 void RecentlyClosedTabsBridge::TabRestoreServiceDestroyed(
163 sessions::TabRestoreService* service) { 162 sessions::TabRestoreService* service) {
164 tab_restore_service_ = NULL; 163 tab_restore_service_ = NULL;
165 } 164 }
166 165
167 void RecentlyClosedTabsBridge::EnsureTabRestoreService() { 166 void RecentlyClosedTabsBridge::EnsureTabRestoreService() {
168 if (tab_restore_service_) 167 if (tab_restore_service_)
169 return; 168 return;
(...skipping 15 matching lines...) Expand all
185 const JavaParamRef<jobject>& jprofile) { 184 const JavaParamRef<jobject>& jprofile) {
186 RecentlyClosedTabsBridge* bridge = new RecentlyClosedTabsBridge( 185 RecentlyClosedTabsBridge* bridge = new RecentlyClosedTabsBridge(
187 ProfileAndroid::FromProfileAndroid(jprofile)); 186 ProfileAndroid::FromProfileAndroid(jprofile));
188 return reinterpret_cast<intptr_t>(bridge); 187 return reinterpret_cast<intptr_t>(bridge);
189 } 188 }
190 189
191 // static 190 // static
192 bool RecentlyClosedTabsBridge::Register(JNIEnv* env) { 191 bool RecentlyClosedTabsBridge::Register(JNIEnv* env) {
193 return RegisterNativesImpl(env); 192 return RegisterNativesImpl(env);
194 } 193 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698