Skip to content

Commit

Permalink
PasswordStoreInterface removal methods ask location
Browse files Browse the repository at this point in the history
This change corrects both calling sites as well as overriding methods
that must now provide a location argument. No attempt has been done in
making any use of the location data in cases where the argument is
necessary to override the function.

Chromium change:
https://chromium.googlesource.com/chromium/src/+/cdacee55c70cc463b7079cec258de4a6d7188506

commit cdacee55c70cc463b7079cec258de4a6d7188506
Author: Mikel Astiz <mastiz@chromium.org>
Date:   Wed Apr 24 18:42:38 2024 +0000

    [passwords] Require base::Location for PasswordStoreInterface removals

    This patch extends PasswordStoreInterface and all implementations with
    a new argument in APIs that issue password deletions. Callers must
    specify a base::Location, often FROM_HERE, that allows tracing where
    a deletion request originated.

    The goal is to consume this information for logging purposes, in case
    user reports need to be investigated. The plumbing required for Sync
    code to consume this information will be tackled in follow-up patches.

    Change-Id: I0c6bbc250ea67f10e3d5e3879f674003a86f3abc
  • Loading branch information
cdesouza-chromium committed Apr 29, 2024
1 parent 8b3cb31 commit b2f7607
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
6 changes: 4 additions & 2 deletions ios/browser/api/bookmarks/bookmark_model_listener_ios.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,14 @@ class BookmarkModelListener : public bookmarks::BookmarkModelObserver {
void BookmarkNodeRemoved(const bookmarks::BookmarkNode* parent,
size_t old_index,
const bookmarks::BookmarkNode* node,
const std::set<GURL>& removed_urls) override;
const std::set<GURL>& removed_urls,
const base::Location& location) override;
void BookmarkNodeChanged(const bookmarks::BookmarkNode* node) override;
void BookmarkNodeFaviconChanged(const bookmarks::BookmarkNode* node) override;
void BookmarkNodeChildrenReordered(
const bookmarks::BookmarkNode* node) override;
void BookmarkAllUserNodesRemoved(const std::set<GURL>& removed_urls) override;
void BookmarkAllUserNodesRemoved(const std::set<GURL>& removed_urls,
const base::Location& location) override;

__strong id<BookmarkModelObserver> observer_;
bookmarks::BookmarkModel* model_; // NOT OWNED
Expand Down
6 changes: 4 additions & 2 deletions ios/browser/api/bookmarks/bookmark_model_listener_ios.mm
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ - (instancetype)initWithNode:(const bookmarks::BookmarkNode*)node
const bookmarks::BookmarkNode* parent,
size_t old_index,
const bookmarks::BookmarkNode* node,
const std::set<GURL>& removed_urls) {
const std::set<GURL>& removed_urls,
const base::Location& location) {
IOSBookmarkNode* ios_node = [[IOSBookmarkNode alloc] initWithNode:node
model:model_];
IOSBookmarkNode* ios_parent = [[IOSBookmarkNode alloc] initWithNode:parent
Expand Down Expand Up @@ -133,7 +134,8 @@ - (instancetype)initWithNode:(const bookmarks::BookmarkNode*)node
}

void BookmarkModelListener::BookmarkAllUserNodesRemoved(
const std::set<GURL>& removed_urls) {
const std::set<GURL>& removed_urls,
const base::Location& location) {
if ([observer_ respondsToSelector:@selector(bookmarkModelRemovedAllNodes)]) {
[observer_ bookmarkModelRemovedAllNodes];
}
Expand Down
5 changes: 3 additions & 2 deletions ios/browser/api/bookmarks/brave_bookmarks_api.mm
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,8 @@ - (bool)hasAncestor:(IOSBookmarkNode*)parent {
- (void)remove {
DCHECK(node_);
DCHECK(model_);
model_->Remove(node_, bookmarks::metrics::BookmarkEditSource::kOther);
model_->Remove(node_, bookmarks::metrics::BookmarkEditSource::kOther,
FROM_HERE);
node_ = nil;
model_ = nil;
}
Expand Down Expand Up @@ -616,7 +617,7 @@ - (void)removeBookmark:(IOSBookmarkNode*)bookmark {

- (void)removeAll {
DCHECK_CURRENTLY_ON(web::WebThread::UI);
bookmark_model_->RemoveAllUserBookmarks();
bookmark_model_->RemoveAllUserBookmarks(FROM_HERE);
}

- (void)searchWithQuery:(NSString*)queryArg
Expand Down
3 changes: 2 additions & 1 deletion ios/browser/api/password/brave_password_api.mm
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,8 @@ - (void)addLogin:(IOSPasswordForm*)passwordForm {
}

- (void)removeLogin:(IOSPasswordForm*)passwordForm {
password_store_->RemoveLogin([self createCredentialForm:passwordForm]);
password_store_->RemoveLogin(FROM_HERE,
[self createCredentialForm:passwordForm]);
}

- (void)updateLogin:(IOSPasswordForm*)newPasswordForm
Expand Down

0 comments on commit b2f7607

Please sign in to comment.