-
Notifications
You must be signed in to change notification settings - Fork 887
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11669 from brave/reset-wallet
Various reset wallet fixes
- Loading branch information
Showing
35 changed files
with
365 additions
and
78 deletions.
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
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
21 changes: 21 additions & 0 deletions
21
android/java/org/chromium/chrome/browser/crypto_wallet/util/WalletNativeUtils.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,21 @@ | ||
/* Copyright (c) 2021 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 http://mozilla.org/MPL/2.0/. */ | ||
|
||
package org.chromium.chrome.browser.crypto_wallet.util; | ||
|
||
import org.chromium.base.annotations.JNINamespace; | ||
import org.chromium.base.annotations.NativeMethods; | ||
|
||
@JNINamespace("chrome::android") | ||
public class WalletNativeUtils { | ||
public static void resetWallet() { | ||
WalletNativeUtilsJni.get().resetWallet(); | ||
} | ||
|
||
@NativeMethods | ||
interface Natives { | ||
void resetWallet(); | ||
} | ||
} |
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
24 changes: 24 additions & 0 deletions
24
browser/brave_wallet/android/wallet_native_utils_android.cc
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,24 @@ | ||
/* Copyright (c) 2021 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 http://mozilla.org/MPL/2.0/. */ | ||
|
||
#include "base/android/jni_android.h" | ||
#include "base/logging.h" | ||
#include "brave/browser/brave_wallet/brave_wallet_reset.h" | ||
#include "brave/build/android/jni_headers/WalletNativeUtils_jni.h" | ||
#include "chrome/browser/profiles/profile.h" | ||
#include "chrome/browser/profiles/profile_manager.h" | ||
|
||
namespace chrome { | ||
namespace android { | ||
|
||
static void JNI_WalletNativeUtils_ResetWallet(JNIEnv* env) { | ||
auto* profile = ProfileManager::GetActiveUserProfile(); | ||
DCHECK(profile); | ||
|
||
brave_wallet::ResetWallet(profile); | ||
} | ||
|
||
} // namespace android | ||
} // namespace chrome |
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,36 @@ | ||
/* Copyright (c) 2021 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 http://mozilla.org/MPL/2.0/. */ | ||
|
||
#include "brave/browser/brave_wallet/brave_wallet_reset.h" | ||
#include "brave/browser/brave_wallet/brave_wallet_service_factory.h" | ||
#include "brave/browser/brave_wallet/eth_tx_controller_factory.h" | ||
#include "brave/browser/brave_wallet/keyring_controller_factory.h" | ||
#include "brave/browser/brave_wallet/rpc_controller_factory.h" | ||
#include "brave/components/brave_wallet/browser/brave_wallet_service.h" | ||
#include "brave/components/brave_wallet/browser/eth_json_rpc_controller.h" | ||
#include "brave/components/brave_wallet/browser/eth_tx_controller.h" | ||
#include "brave/components/brave_wallet/browser/keyring_controller.h" | ||
|
||
namespace brave_wallet { | ||
|
||
void ResetWallet(content::BrowserContext* context) { | ||
auto* eth_tx_controller = | ||
brave_wallet::EthTxControllerFactory::GetControllerForContext(context); | ||
eth_tx_controller->Reset(); | ||
|
||
auto* rpc_controller = | ||
brave_wallet::RpcControllerFactory::GetControllerForContext(context); | ||
rpc_controller->Reset(); | ||
|
||
auto* brave_wallet_service = | ||
brave_wallet::BraveWalletServiceFactory::GetServiceForContext(context); | ||
brave_wallet_service->Reset(); | ||
|
||
auto* keyring_controller = | ||
brave_wallet::KeyringControllerFactory::GetControllerForContext(context); | ||
keyring_controller->Reset(); | ||
} | ||
|
||
} // namespace brave_wallet |
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,21 @@ | ||
/* Copyright (c) 2021 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 http://mozilla.org/MPL/2.0/. */ | ||
|
||
#ifndef BRAVE_BROWSER_BRAVE_WALLET_BRAVE_WALLET_RESET_H_ | ||
#define BRAVE_BROWSER_BRAVE_WALLET_BRAVE_WALLET_RESET_H_ | ||
|
||
#include "content/public/browser/browser_context.h" | ||
|
||
namespace content { | ||
class BrowserContext; | ||
} // namespace content | ||
|
||
namespace brave_wallet { | ||
|
||
void ResetWallet(content::BrowserContext* context); | ||
|
||
} // namespace brave_wallet | ||
|
||
#endif // BRAVE_BROWSER_BRAVE_WALLET_BRAVE_WALLET_RESET_H_ |
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.