mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 02:07:36 +00:00
Ladybird+LibWebView: Move CookieJar, Database, and History to LibWebView
These classes are used as-is in all chromes. Move them to LibWebView so that non-Serenity chromes don't have to awkwardly reach into its headers and sources.
This commit is contained in:
parent
7d313ff83d
commit
5c5a00dd3a
28 changed files with 76 additions and 107 deletions
45
Userland/Libraries/LibWebView/History.h
Normal file
45
Userland/Libraries/LibWebView/History.h
Normal file
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/URL.h>
|
||||
#include <AK/Vector.h>
|
||||
|
||||
namespace WebView {
|
||||
|
||||
class History {
|
||||
public:
|
||||
struct URLTitlePair {
|
||||
URL url;
|
||||
DeprecatedString title;
|
||||
};
|
||||
void dump() const;
|
||||
Vector<URLTitlePair> get_all_history_entries();
|
||||
|
||||
void push(const URL& url, DeprecatedString const& title);
|
||||
void replace_current(const URL& url, DeprecatedString const& title);
|
||||
void update_title(DeprecatedString const& title);
|
||||
URLTitlePair current() const;
|
||||
|
||||
Vector<StringView> const get_back_title_history();
|
||||
Vector<StringView> const get_forward_title_history();
|
||||
|
||||
void go_back(int steps = 1);
|
||||
void go_forward(int steps = 1);
|
||||
|
||||
bool can_go_back(int steps = 1) { return (m_current - steps) >= 0; }
|
||||
bool can_go_forward(int steps = 1) { return (m_current + steps) < static_cast<int>(m_items.size()); }
|
||||
void clear();
|
||||
|
||||
bool is_empty() const { return m_items.is_empty(); }
|
||||
|
||||
private:
|
||||
Vector<URLTitlePair> m_items;
|
||||
int m_current { -1 };
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue