-
Notifications
You must be signed in to change notification settings - Fork 887
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Local state pref to use from Java #16486
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
1fbb56c
BraveLocalState Java class
AlexeyBarabash 26afec4
Move P3A prefs from BravePrefServiceBridge to BraveLocalState Java wr…
AlexeyBarabash 1163547
Fix presubmit errors
AlexeyBarabash 1e7774c
Move stats reporting pref from BravePrefServiceBridge to BraveLocalSt…
AlexeyBarabash 0d73687
Move safetynet status pref from BravePrefServiceBridge to BraveLocalS…
AlexeyBarabash 121f8d5
Removed unused Java/JNI methods:
AlexeyBarabash 0b34338
Move UD/ENS/SNS prefs from BravePrefServiceBridge to BraveLocalState …
AlexeyBarabash 429de76
Updated comment for BravePrefServiceBridge class
AlexeyBarabash File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
android/java/org/chromium/chrome/browser/BraveLocalState.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* Copyright (c) 2022 The Brave Authors. All rights reserved. | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at https://mozilla.org/MPL/2.0/. */ | ||
|
||
package org.chromium.chrome.browser; | ||
|
||
import org.chromium.base.annotations.JNINamespace; | ||
import org.chromium.base.annotations.NativeMethods; | ||
import org.chromium.components.prefs.PrefService; | ||
|
||
/** | ||
* Helper for retrieving a {@link PrefService} from a browser local state. | ||
*/ | ||
@JNINamespace("chrome::android") | ||
public class BraveLocalState { | ||
/** Returns the {@link PrefService} associated with the browser's local state */ | ||
public static PrefService get() { | ||
return BraveLocalStateJni.get().getPrefService(); | ||
} | ||
|
||
/** Makes local state data be written to the disk asap */ | ||
public static void commitPendingWrite() { | ||
BraveLocalStateJni.get().commitPendingWrite(); | ||
} | ||
|
||
@NativeMethods | ||
public interface Natives { | ||
// this method cannot be called 'get', because of the error: | ||
// method get() is already defined in class BraveLocalStateJni | ||
PrefService getPrefService(); | ||
|
||
void commitPendingWrite(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should not do this, the actual writing of prefs to disk should be left to the pref service