#include "chrome/browser/extensions/api/declarative_content/declarative_content_is_bookmarked_condition_tracker.h"
#include "base/containers/contains.h"
#include "base/functional/bind.h"
#include "base/memory/ptr_util.h"
#include "base/not_fatal_until.h"
#include "base/strings/stringprintf.h"
#include "base/values.h"
#include "chrome/browser/bookmarks/bookmark_model_factory.h"
#include "content/public/browser/web_contents.h"
#include "extensions/common/api/declarative/declarative_constants.h"
#include "extensions/common/permissions/permissions_data.h"
namespace extensions {
namespace {
const char kIsBookmarkedInvalidTypeOfParameter[] = …;
const char kIsBookmarkedRequiresBookmarkPermission[] = …;
bool HasBookmarkAPIPermission(const Extension* extension) { … }
}
DeclarativeContentIsBookmarkedPredicate::
~DeclarativeContentIsBookmarkedPredicate() = default;
bool DeclarativeContentIsBookmarkedPredicate::IsIgnored() const { … }
std::unique_ptr<DeclarativeContentIsBookmarkedPredicate>
DeclarativeContentIsBookmarkedPredicate::Create(
ContentPredicateEvaluator* evaluator,
const Extension* extension,
const base::Value& value,
std::string* error) { … }
ContentPredicateEvaluator*
DeclarativeContentIsBookmarkedPredicate::GetEvaluator() const { … }
DeclarativeContentIsBookmarkedPredicate::
DeclarativeContentIsBookmarkedPredicate(
ContentPredicateEvaluator* evaluator,
scoped_refptr<const Extension> extension,
bool is_bookmarked)
: … { … }
DeclarativeContentIsBookmarkedConditionTracker::PerWebContentsTracker::
PerWebContentsTracker(content::WebContents* contents,
RequestEvaluationCallback request_evaluation,
WebContentsDestroyedCallback web_contents_destroyed)
: … { … }
DeclarativeContentIsBookmarkedConditionTracker::PerWebContentsTracker::
~PerWebContentsTracker() = default;
void DeclarativeContentIsBookmarkedConditionTracker::PerWebContentsTracker::
BookmarkAddedForUrl(const GURL& url) { … }
void DeclarativeContentIsBookmarkedConditionTracker::PerWebContentsTracker::
BookmarkRemovedForUrls(const std::set<GURL>& urls) { … }
void DeclarativeContentIsBookmarkedConditionTracker::PerWebContentsTracker::
UpdateState(bool request_evaluation_if_unchanged) { … }
bool DeclarativeContentIsBookmarkedConditionTracker::PerWebContentsTracker::
IsCurrentUrlBookmarked() { … }
void DeclarativeContentIsBookmarkedConditionTracker::PerWebContentsTracker::
WebContentsDestroyed() { … }
DeclarativeContentIsBookmarkedConditionTracker::
DeclarativeContentIsBookmarkedConditionTracker(
content::BrowserContext* context,
Delegate* delegate)
: … { … }
DeclarativeContentIsBookmarkedConditionTracker::
~DeclarativeContentIsBookmarkedConditionTracker() = default;
std::string DeclarativeContentIsBookmarkedConditionTracker::
GetPredicateApiAttributeName() const { … }
std::unique_ptr<const ContentPredicate>
DeclarativeContentIsBookmarkedConditionTracker::CreatePredicate(
const Extension* extension,
const base::Value& value,
std::string* error) { … }
void DeclarativeContentIsBookmarkedConditionTracker::TrackPredicates(
const std::map<const void*, std::vector<const ContentPredicate*>>&
predicates) { … }
void DeclarativeContentIsBookmarkedConditionTracker::StopTrackingPredicates(
const std::vector<const void*>& predicate_groups) { … }
void DeclarativeContentIsBookmarkedConditionTracker::TrackForWebContents(
content::WebContents* contents) { … }
void DeclarativeContentIsBookmarkedConditionTracker::OnWebContentsNavigation(
content::WebContents* contents,
content::NavigationHandle* navigation_handle) { … }
void DeclarativeContentIsBookmarkedConditionTracker::OnWatchedPageChanged(
content::WebContents* contents,
const std::vector<std::string>& css_selectors) { … }
bool DeclarativeContentIsBookmarkedConditionTracker::EvaluatePredicate(
const ContentPredicate* predicate,
content::WebContents* tab) const { … }
void DeclarativeContentIsBookmarkedConditionTracker::BookmarkModelChanged() { … }
void DeclarativeContentIsBookmarkedConditionTracker::BookmarkNodeAdded(
const bookmarks::BookmarkNode* parent,
size_t index,
bool added_by_user) { … }
void DeclarativeContentIsBookmarkedConditionTracker::BookmarkNodeRemoved(
const bookmarks::BookmarkNode* parent,
size_t old_index,
const bookmarks::BookmarkNode* node,
const std::set<GURL>& no_longer_bookmarked,
const base::Location& location) { … }
void DeclarativeContentIsBookmarkedConditionTracker::
ExtensiveBookmarkChangesBeginning() { … }
void DeclarativeContentIsBookmarkedConditionTracker::
ExtensiveBookmarkChangesEnded() { … }
void DeclarativeContentIsBookmarkedConditionTracker::
GroupedBookmarkChangesBeginning() { … }
void DeclarativeContentIsBookmarkedConditionTracker::
GroupedBookmarkChangesEnded() { … }
void
DeclarativeContentIsBookmarkedConditionTracker::DeletePerWebContentsTracker(
content::WebContents* contents) { … }
void DeclarativeContentIsBookmarkedConditionTracker::
UpdateAllPerWebContentsTrackers() { … }
}