Skip to content

Commit

Permalink
Calling parent method in BraveBookmarkModelLoadedObserver::BookmarkMo…
Browse files Browse the repository at this point in the history
…delLoaded to avoid duplication
  • Loading branch information
darkdh committed Oct 16, 2019
1 parent 0f076bb commit 1cd5cb7
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 7 deletions.
7 changes: 2 additions & 5 deletions browser/profiles/brave_bookmark_model_loaded_observer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,11 @@ using bookmarks::BookmarkModel;

BraveBookmarkModelLoadedObserver::BraveBookmarkModelLoadedObserver(
Profile* profile)
: BookmarkModelLoadedObserver(profile), profile_(profile) {}
: BookmarkModelLoadedObserver(profile) {}

void BraveBookmarkModelLoadedObserver::BookmarkModelLoaded(
BookmarkModel* model,
bool ids_reassigned) {
// Causes lazy-load if sync is enabled.
ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile_);
#if BUILDFLAG(ENABLE_BRAVE_SYNC)
BraveProfileSyncServiceImpl* brave_profile_service =
static_cast<BraveProfileSyncServiceImpl*>(
Expand All @@ -36,6 +34,5 @@ void BraveBookmarkModelLoadedObserver::BookmarkModelLoaded(
#else
BraveMigrateOtherNode(model);
#endif
model->RemoveObserver(this);
delete this;
BookmarkModelLoadedObserver::BookmarkModelLoaded(model, ids_reassigned);
}
2 changes: 0 additions & 2 deletions browser/profiles/brave_bookmark_model_loaded_observer.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ class BraveBookmarkModelLoadedObserver
void BookmarkModelLoaded(bookmarks::BookmarkModel* model,
bool ids_reassigned) override;

Profile* profile_;

DISALLOW_COPY_AND_ASSIGN(BraveBookmarkModelLoadedObserver);
};

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/* Copyright 2019 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_CHROMIUM_SRC_CHROME_BROWSER_PROFILES_BOOKMARK_MODEL_LOADED_OBSERVER_H_
#define BRAVE_CHROMIUM_SRC_CHROME_BROWSER_PROFILES_BOOKMARK_MODEL_LOADED_OBSERVER_H_

#define BRAVE_BOOKMARK_MODEL_LOADED_OBSERVER_H_ \
private: \
friend class BraveBookmarkModelLoadedObserver; \
\
public:
#include "../../../../../chrome/browser/profiles/bookmark_model_loaded_observer.h"

#endif // BRAVE_CHROMIUM_SRC_CHROME_BROWSER_PROFILES_BOOKMARK_MODEL_LOADED_OBSERVER_H_
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/chrome/browser/profiles/bookmark_model_loaded_observer.h b/chrome/browser/profiles/bookmark_model_loaded_observer.h
index b4ef0d2aa9e393ace55f65f7aa92153e8dd6069d..7034645e46bf9a0f62173fd7db1b60198ad0f8fb 100644
--- a/chrome/browser/profiles/bookmark_model_loaded_observer.h
+++ b/chrome/browser/profiles/bookmark_model_loaded_observer.h
@@ -16,6 +16,7 @@ class BookmarkModelLoadedObserver
public:
explicit BookmarkModelLoadedObserver(Profile* profile);

+ BRAVE_BOOKMARK_MODEL_LOADED_OBSERVER_H_
private:
void BookmarkModelChanged() override;
void BookmarkModelLoaded(bookmarks::BookmarkModel* model,

0 comments on commit 1cd5cb7

Please sign in to comment.