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

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

Issue 1288183004: jni_generator: Make all object-returning natives return ScopedJavaLocalRef. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add some newlines for readability Created 5 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/chrome_application.h" 5 #include "chrome/browser/android/chrome_application.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/android/jni_android.h" 9 #include "base/android/jni_android.h"
10 #include "base/android/jni_string.h" 10 #include "base/android/jni_string.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 void ChangeAppStatusOnIOThread(SafeBrowsingService* sb_service, 74 void ChangeAppStatusOnIOThread(SafeBrowsingService* sb_service,
75 jboolean foreground) { 75 jboolean foreground) {
76 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); 76 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
77 SafeBrowsingProtocolManager* proto_manager = sb_service->protocol_manager(); 77 SafeBrowsingProtocolManager* proto_manager = sb_service->protocol_manager();
78 if (proto_manager) 78 if (proto_manager)
79 proto_manager->SetAppInForeground(foreground); 79 proto_manager->SetAppInForeground(foreground);
80 } 80 }
81 81
82 } // namespace 82 } // namespace
83 83
84 static jstring GetBrowserUserAgent(JNIEnv* env, jclass clazz) { 84 static ScopedJavaLocalRef<jstring> GetBrowserUserAgent(JNIEnv* env,
85 return ConvertUTF8ToJavaString(env, GetUserAgent()).Release(); 85 jclass clazz) {
86 return ConvertUTF8ToJavaString(env, GetUserAgent());
86 } 87 }
87 88
88 static void FlushPersistentData(JNIEnv* env, jclass obj) { 89 static void FlushPersistentData(JNIEnv* env, jclass obj) {
89 // Commit the prending writes for all the loaded profiles. 90 // Commit the prending writes for all the loaded profiles.
90 std::vector<Profile*> loaded_profiles = 91 std::vector<Profile*> loaded_profiles =
91 g_browser_process->profile_manager()->GetLoadedProfiles(); 92 g_browser_process->profile_manager()->GetLoadedProfiles();
92 std::for_each(loaded_profiles.begin(), loaded_profiles.end(), 93 std::for_each(loaded_profiles.begin(), loaded_profiles.end(),
93 CommitPendingWritesForProfile); 94 CommitPendingWritesForProfile);
94 95
95 if (g_browser_process->local_state()) 96 if (g_browser_process->local_state())
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 } 143 }
143 144
144 bool ChromeApplication::AreParentalControlsEnabled() { 145 bool ChromeApplication::AreParentalControlsEnabled() {
145 return Java_ChromeApplication_areParentalControlsEnabled( 146 return Java_ChromeApplication_areParentalControlsEnabled(
146 base::android::AttachCurrentThread(), 147 base::android::AttachCurrentThread(),
147 base::android::GetApplicationContext()); 148 base::android::GetApplicationContext());
148 } 149 }
149 150
150 } // namespace android 151 } // namespace android
151 } // namespace chrome 152 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698