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/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 Loading... |
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 ScopedJavaLocalRef<jstring> GetBrowserUserAgent(JNIEnv* env, | 84 static ScopedJavaLocalRef<jstring> GetBrowserUserAgent( |
85 jclass clazz) { | 85 JNIEnv* env, |
| 86 const JavaParamRef<jclass>& clazz) { |
86 return ConvertUTF8ToJavaString(env, GetUserAgent()); | 87 return ConvertUTF8ToJavaString(env, GetUserAgent()); |
87 } | 88 } |
88 | 89 |
89 static void FlushPersistentData(JNIEnv* env, jclass obj) { | 90 static void FlushPersistentData(JNIEnv* env, const JavaParamRef<jclass>& obj) { |
90 // Commit the prending writes for all the loaded profiles. | 91 // Commit the prending writes for all the loaded profiles. |
91 std::vector<Profile*> loaded_profiles = | 92 std::vector<Profile*> loaded_profiles = |
92 g_browser_process->profile_manager()->GetLoadedProfiles(); | 93 g_browser_process->profile_manager()->GetLoadedProfiles(); |
93 std::for_each(loaded_profiles.begin(), loaded_profiles.end(), | 94 std::for_each(loaded_profiles.begin(), loaded_profiles.end(), |
94 CommitPendingWritesForProfile); | 95 CommitPendingWritesForProfile); |
95 | 96 |
96 if (g_browser_process->local_state()) | 97 if (g_browser_process->local_state()) |
97 g_browser_process->local_state()->CommitPendingWrite(); | 98 g_browser_process->local_state()->CommitPendingWrite(); |
98 } | 99 } |
99 | 100 |
100 static void RemoveSessionCookies(JNIEnv* env, jclass obj) { | 101 static void RemoveSessionCookies(JNIEnv* env, const JavaParamRef<jclass>& obj) { |
101 std::vector<Profile*> loaded_profiles = | 102 std::vector<Profile*> loaded_profiles = |
102 g_browser_process->profile_manager()->GetLoadedProfiles(); | 103 g_browser_process->profile_manager()->GetLoadedProfiles(); |
103 std::for_each(loaded_profiles.begin(), loaded_profiles.end(), | 104 std::for_each(loaded_profiles.begin(), loaded_profiles.end(), |
104 RemoveSessionCookiesForProfile); | 105 RemoveSessionCookiesForProfile); |
105 } | 106 } |
106 | 107 |
107 static void ChangeAppStatus(JNIEnv* env, jclass obj, jboolean foreground) { | 108 static void ChangeAppStatus(JNIEnv* env, |
| 109 const JavaParamRef<jclass>& obj, |
| 110 jboolean foreground) { |
108 content::BrowserThread::PostTask( | 111 content::BrowserThread::PostTask( |
109 content::BrowserThread::IO, FROM_HERE, | 112 content::BrowserThread::IO, FROM_HERE, |
110 base::Bind(&ChangeAppStatusOnIOThread, | 113 base::Bind(&ChangeAppStatusOnIOThread, |
111 base::Unretained(g_browser_process->safe_browsing_service()), | 114 base::Unretained(g_browser_process->safe_browsing_service()), |
112 foreground)); | 115 foreground)); |
113 } | 116 } |
114 | 117 |
115 namespace chrome { | 118 namespace chrome { |
116 namespace android { | 119 namespace android { |
117 | 120 |
(...skipping 25 matching lines...) Expand all Loading... |
143 } | 146 } |
144 | 147 |
145 bool ChromeApplication::AreParentalControlsEnabled() { | 148 bool ChromeApplication::AreParentalControlsEnabled() { |
146 return Java_ChromeApplication_areParentalControlsEnabled( | 149 return Java_ChromeApplication_areParentalControlsEnabled( |
147 base::android::AttachCurrentThread(), | 150 base::android::AttachCurrentThread(), |
148 base::android::GetApplicationContext()); | 151 base::android::GetApplicationContext()); |
149 } | 152 } |
150 | 153 |
151 } // namespace android | 154 } // namespace android |
152 } // namespace chrome | 155 } // namespace chrome |
OLD | NEW |