-
Notifications
You must be signed in to change notification settings - Fork 910
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Speedreader #12678
Speedreader #12678
Conversation
@@ -51,6 +51,7 @@ class DeAmpURLLoader : public body_sniffer::BodySnifferURLLoader { | |||
void ForwardBodyToClient(); | |||
|
|||
base::WeakPtr<DeAmpThrottle> de_amp_throttle_; | |||
base::WeakPtrFactory<DeAmpURLLoader> weak_factory_{this}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not used?
// Page can't be distilled. | ||
bool PageDoesntSupportDistillation(DistillState state); | ||
|
||
// Page can be destilled. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo
@@ -58,6 +58,12 @@ enum class DistillState { | |||
// Page is in reader mode or speedreader mode. | |||
bool PageStateIsDistilled(DistillState state); | |||
|
|||
// Page can't be distilled. | |||
bool PageDoesntSupportDistillation(DistillState state); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's not really clear what method of these two to use and when. It sounds like ! PageSupportsDistillation()
is the same as PageDoesn'tSupportDistillation()
but from the code this is not true. Can we switch to a single method or pick better names?
// content::WebContentsObserver | ||
void ClearCache(); | ||
void ReloadContents(); | ||
void ProcessNavigation(content::NavigationHandle* navigation_handle); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comments?
|
||
// SpeedreaderResultDelegate: | ||
void OnDistillComplete() override; | ||
|
||
std::unique_ptr<PrefChangeRegistrar> pref_change_registrar_; | ||
|
||
bool is_active_ = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it is_visible_
?
void SpeedreaderTabHelper::HideBubble() { | ||
if (speedreader_bubble_) { | ||
speedreader_bubble_->Hide(); | ||
speedreader_bubble_ = nullptr; | ||
} | ||
} | ||
|
||
void SpeedreaderTabHelper::ClearCache() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ClearPersistedData
Profile::FromBrowserContext(web_contents()->GetBrowserContext()); | ||
auto* content_rules = HostContentSettingsMapFactory::GetForProfile(profile); | ||
return speedreader::IsEnabledForSite(content_rules, url); | ||
void SpeedreaderTabHelper::Distill() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not Distill
, rather UpdateDistillationState()
?
Resolves brave/brave-browser#18242,
Resolves brave/brave-browser#18234,
Resolves brave/brave-browser#18243
Submitter Checklist:
QA/Yes
orQA/No
;release-notes/include
orrelease-notes/exclude
;OS/...
) to the associated issuenpm run test -- brave_browser_tests
,npm run test -- brave_unit_tests
,npm run lint
,npm run gn_check
,npm run tslint
git rebase master
(if needed)Reviewer Checklist:
gn
After-merge Checklist:
changes has landed on
Test Plan: