-
Notifications
You must be signed in to change notification settings - Fork 473
Closes #3824: Adding the site tracking protection icon on the toolbar #3906
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3906 +/- ##
============================================
- Coverage 82.55% 80.58% -1.97%
+ Complexity 3660 3572 -88
============================================
Files 481 483 +2
Lines 15686 15757 +71
Branches 2347 2280 -67
============================================
- Hits 12949 12698 -251
- Misses 1758 2137 +379
+ Partials 979 922 -57
Continue to review full report at Codecov.
|
@@ -6,6 +6,10 @@ | |||
<!-- Content description (not visible, for screen readers etc.): Description for the overflow menu button in the browser toolbar. --> | |||
<string name="mozac_browser_toolbar_menu_button">Menu</string> | |||
<string name="mozac_clear_button_description">Clear</string> | |||
<!-- Content description: For the tracking protection toolbar icon, it is set when the site has tracking protection enabled, but none trackers have been blocked or detected. --> | |||
<string name="mozac_browser_toolbar_content_description_tracking_protection_on">Tracking Protection is on</string> |
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.
Where did these content descriptions come from?
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.
I added them. As every icon means a tracking protection state, we want to communicate that to the accessibility tools like screen readers. I'm not quite sure if they are completely meaningful for these I issued #3925 for investigating about it.
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.
CC @mheubusch
fe12b31
to
2ee9d45
Compare
components/browser/toolbar/src/main/java/mozilla/components/browser/toolbar/BrowserToolbar.kt
Show resolved
Hide resolved
@@ -6,6 +6,10 @@ | |||
<!-- Content description (not visible, for screen readers etc.): Description for the overflow menu button in the browser toolbar. --> | |||
<string name="mozac_browser_toolbar_menu_button">Menu</string> | |||
<string name="mozac_clear_button_description">Clear</string> | |||
<!-- Content description: For the tracking protection toolbar icon, it is set when the site has tracking protection enabled, but none trackers have been blocked or detected. --> | |||
<string name="mozac_browser_toolbar_content_description_tracking_protection_on">Tracking Protection is on</string> |
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.
CC @mheubusch
components/concept/toolbar/src/main/java/mozilla/components/concept/toolbar/Toolbar.kt
Outdated
Show resolved
Hide resolved
components/feature/toolbar/src/main/java/mozilla/components/feature/toolbar/ToolbarPresenter.kt
Show resolved
Hide resolved
components/feature/toolbar/src/main/java/mozilla/components/feature/toolbar/ToolbarPresenter.kt
Show resolved
Hide resolved
} | ||
|
||
override fun onUrlChanged(session: Session, url: String) { | ||
renderer.post(url) | ||
updateToolbarTrackingProtection(session) |
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.
Why do we need that here and why isn't that covered by onTrackerBlockingEnabledChanged
and onTrackerBlocked
?
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.
I was seeing a issue where I switched from a site that has trackers to a site that doesn't have trackers and wasn't getting notified. I will do some further testing to see if there is any relation
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.
If some reseting is needed when navigating then this probably needs to happen in EngineObserver
so that everyone benefits from it and doesn't need to listen to onUrlChanged()
.
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.
👍
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.
Now, I realized exactly why do we need this here.
onTrackerBlockingEnabledChanged
is called when we change tracking protection to ON or OFF.
and
onTrackerBlocked
is called when a new tracker is blocked.
But when I have a session that has tracking protection on and has some trackers blocked then I navigate to a new page that doesn't change trackerBlockingEnabled
nor has trackers on it. I don't have a way to know anything about this page. Because we are only observing when we change the tracking protection to ON or OFF or when new trackers are blocked and none of these cases happen in that scenario.
components/feature/toolbar/src/main/java/mozilla/components/feature/toolbar/ToolbarPresenter.kt
Outdated
Show resolved
Hide resolved
@pocmo ready for the next pass on this review :) |
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.
I left a few comments but it doesn't need to block this PR.
components/browser/toolbar/src/main/java/mozilla/components/browser/toolbar/BrowserToolbar.kt
Outdated
Show resolved
Hide resolved
components/browser/toolbar/src/main/java/mozilla/components/browser/toolbar/BrowserToolbar.kt
Outdated
Show resolved
Hide resolved
* Sets a listener to be invoked when the site tracking protection indicator icon is clicked. | ||
*/ | ||
fun setOnTrackingProtectionClickedListener(listener: (() -> Unit)?) { | ||
if (listener == null) { |
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 setting null
used for this API to remove the listener? I'm not sure I follow how this would be used.
toolbar.setOnTrackingProtectionClickedListener { /* do magic */ }
// I no longer want to listen for TP clicked changes..
toolbar.setOnTrackingProtectionClickedListener(null)
Seems strange to want to allow being able to explicitly do that, and use null to allow that.
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.
We can can open an issue for checking that!
...s/browser/toolbar/src/main/java/mozilla/components/browser/toolbar/display/DisplayToolbar.kt
Outdated
Show resolved
Hide resolved
...s/browser/toolbar/src/main/java/mozilla/components/browser/toolbar/display/DisplayToolbar.kt
Outdated
Show resolved
Hide resolved
components/feature/toolbar/src/main/java/mozilla/components/feature/toolbar/ToolbarPresenter.kt
Show resolved
Hide resolved
…on the toolbar.
Also closes #3920.
Fenix integration demo
There are some states that we are not handling yet as I'm not quite sure how we are going to do that, they could be addressed in future iterations, but if you have any suggestions please let me know.
The state that we are not handling yet:
Tracking protection panel is opened: We are not going to do that.
Tracking protection is disabled for a specific site: The TP icon in the toolbar have to change when this happens. AC doesn't own this list.
Pull Request checklist
After merge