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

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

Issue 1640503003: Remove unused foreground member variable from SB Protocol Manager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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/context_utils.h" 9 #include "base/android/context_utils.h"
10 #include "base/android/jni_android.h" 10 #include "base/android/jni_android.h"
11 #include "base/android/jni_string.h" 11 #include "base/android/jni_string.h"
12 #include "base/prefs/pref_service.h" 12 #include "base/prefs/pref_service.h"
13 #include "chrome/browser/android/tab_android.h" 13 #include "chrome/browser/android/tab_android.h"
14 #include "chrome/browser/browser_process.h" 14 #include "chrome/browser/browser_process.h"
15 #include "chrome/browser/net/predictor.h" 15 #include "chrome/browser/net/predictor.h"
16 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/profiles/profile_manager.h" 17 #include "chrome/browser/profiles/profile_manager.h"
18 #include "chrome/browser/safe_browsing/protocol_manager.h"
19 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
20 #include "chrome/common/chrome_content_client.h" 18 #include "chrome/common/chrome_content_client.h"
21 #include "content/public/browser/browser_thread.h" 19 #include "content/public/browser/browser_thread.h"
22 #include "content/public/browser/storage_partition.h" 20 #include "content/public/browser/storage_partition.h"
23 #include "content/public/browser/web_contents.h" 21 #include "content/public/browser/web_contents.h"
24 #include "jni/ChromeApplication_jni.h" 22 #include "jni/ChromeApplication_jni.h"
25 #include "net/cookies/cookie_store.h" 23 #include "net/cookies/cookie_store.h"
26 #include "net/url_request/url_request_context.h" 24 #include "net/url_request/url_request_context.h"
27 #include "net/url_request/url_request_context_getter.h" 25 #include "net/url_request/url_request_context_getter.h"
28 26
29 using base::android::ConvertUTF8ToJavaString; 27 using base::android::ConvertUTF8ToJavaString;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 net::CookieStore::DeleteCallback()); 59 net::CookieStore::DeleteCallback());
62 } 60 }
63 61
64 void RemoveSessionCookiesForProfile(Profile* profile) { 62 void RemoveSessionCookiesForProfile(Profile* profile) {
65 content::BrowserThread::PostTask( 63 content::BrowserThread::PostTask(
66 content::BrowserThread::IO, FROM_HERE, 64 content::BrowserThread::IO, FROM_HERE,
67 base::Bind(&RemoveSessionCookiesOnIOThread, 65 base::Bind(&RemoveSessionCookiesOnIOThread,
68 make_scoped_refptr(profile->GetRequestContext()))); 66 make_scoped_refptr(profile->GetRequestContext())));
69 } 67 }
70 68
71 void ChangeAppStatusOnIOThread(safe_browsing::SafeBrowsingService* sb_service,
72 jboolean foreground) {
73 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
74 safe_browsing::SafeBrowsingProtocolManager* proto_manager =
75 sb_service->protocol_manager();
76 if (proto_manager)
77 proto_manager->SetAppInForeground(foreground);
78 }
79
80 } // namespace 69 } // namespace
81 70
82 static ScopedJavaLocalRef<jstring> GetBrowserUserAgent( 71 static ScopedJavaLocalRef<jstring> GetBrowserUserAgent(
83 JNIEnv* env, 72 JNIEnv* env,
84 const JavaParamRef<jclass>& clazz) { 73 const JavaParamRef<jclass>& clazz) {
85 return ConvertUTF8ToJavaString(env, GetUserAgent()); 74 return ConvertUTF8ToJavaString(env, GetUserAgent());
86 } 75 }
87 76
88 static void FlushPersistentData(JNIEnv* env, const JavaParamRef<jclass>& obj) { 77 static void FlushPersistentData(JNIEnv* env, const JavaParamRef<jclass>& obj) {
89 // Commit the prending writes for all the loaded profiles. 78 // Commit the prending writes for all the loaded profiles.
90 std::vector<Profile*> loaded_profiles = 79 std::vector<Profile*> loaded_profiles =
91 g_browser_process->profile_manager()->GetLoadedProfiles(); 80 g_browser_process->profile_manager()->GetLoadedProfiles();
92 std::for_each(loaded_profiles.begin(), loaded_profiles.end(), 81 std::for_each(loaded_profiles.begin(), loaded_profiles.end(),
93 CommitPendingWritesForProfile); 82 CommitPendingWritesForProfile);
94 83
95 if (g_browser_process->local_state()) 84 if (g_browser_process->local_state())
96 g_browser_process->local_state()->CommitPendingWrite(); 85 g_browser_process->local_state()->CommitPendingWrite();
97 } 86 }
98 87
99 static void RemoveSessionCookies(JNIEnv* env, const JavaParamRef<jclass>& obj) { 88 static void RemoveSessionCookies(JNIEnv* env, const JavaParamRef<jclass>& obj) {
100 std::vector<Profile*> loaded_profiles = 89 std::vector<Profile*> loaded_profiles =
101 g_browser_process->profile_manager()->GetLoadedProfiles(); 90 g_browser_process->profile_manager()->GetLoadedProfiles();
102 std::for_each(loaded_profiles.begin(), loaded_profiles.end(), 91 std::for_each(loaded_profiles.begin(), loaded_profiles.end(),
103 RemoveSessionCookiesForProfile); 92 RemoveSessionCookiesForProfile);
104 } 93 }
105 94
106 static void ChangeAppStatus(JNIEnv* env,
107 const JavaParamRef<jclass>& obj,
108 jboolean foreground) {
109 content::BrowserThread::PostTask(
110 content::BrowserThread::IO, FROM_HERE,
111 base::Bind(&ChangeAppStatusOnIOThread,
112 base::Unretained(g_browser_process->safe_browsing_service()),
113 foreground));
114 }
115
116 namespace chrome { 95 namespace chrome {
117 namespace android { 96 namespace android {
118 97
119 // static 98 // static
120 bool ChromeApplication::RegisterBindings(JNIEnv* env) { 99 bool ChromeApplication::RegisterBindings(JNIEnv* env) {
121 return RegisterNativesImpl(env); 100 return RegisterNativesImpl(env);
122 } 101 }
123 102
124 void ChromeApplication::ShowAutofillSettings() { 103 void ChromeApplication::ShowAutofillSettings() {
125 Java_ChromeApplication_showAutofillSettings( 104 Java_ChromeApplication_showAutofillSettings(
(...skipping 18 matching lines...) Expand all
144 } 123 }
145 124
146 bool ChromeApplication::AreParentalControlsEnabled() { 125 bool ChromeApplication::AreParentalControlsEnabled() {
147 return Java_ChromeApplication_areParentalControlsEnabled( 126 return Java_ChromeApplication_areParentalControlsEnabled(
148 base::android::AttachCurrentThread(), 127 base::android::AttachCurrentThread(),
149 base::android::GetApplicationContext()); 128 base::android::GetApplicationContext());
150 } 129 }
151 130
152 } // namespace android 131 } // namespace android
153 } // namespace chrome 132 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698