-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
1,069 additions
and
15 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,42 @@ | ||
#pragma once | ||
|
||
#include "common.hpp" | ||
|
||
class CefRequest; | ||
|
||
namespace browservice { | ||
|
||
struct Bookmark { | ||
string url; | ||
string title; | ||
uint64_t time; | ||
}; | ||
|
||
class Bookmarks { | ||
SHARED_ONLY_CLASS(Bookmarks); | ||
public: | ||
Bookmarks(CKey); | ||
|
||
// Returns empty pointer and writes to log if loading failed | ||
static shared_ptr<Bookmarks> load(); | ||
|
||
// Returns false and writes to log if saving failed | ||
bool save(); | ||
|
||
const map<uint64_t, Bookmark>& getData() const; | ||
|
||
uint64_t putBookmark(Bookmark bookmark); | ||
void removeBookmark(uint64_t id); | ||
|
||
private: | ||
map<uint64_t, Bookmark> data_; | ||
}; | ||
|
||
// Returns the bookmark ID if given url is bookmarked in the last state saved | ||
// using Bookmarks::save, or if no bookmarks have yet been saved, the state | ||
// loaded on the first call to this function. Safe to call from any thread. | ||
optional<uint64_t> getCachedBookmarkIDByURL(string url); | ||
|
||
string handleBookmarksRequest(CefRefPtr<CefRequest> request); | ||
|
||
} |
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.