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
Issue 2301: Enable push messaging #3390
Conversation
PushMessagingServiceImpl* push_service = | ||
PushMessagingServiceFactory::GetForProfile(profile); | ||
- push_service->IncreasePushSubscriptionCount(count, false /* is_pending */); | ||
+ if (push_service) { push_service->IncreasePushSubscriptionCount(count, false /* is_pending */); } |
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.
GetForProfile
can return NULL, upstream issue here: https://bugs.chromium.org/p/chromium/issues/detail?id=999665
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 this the only place where the check is needed? I'm concerned about https://bugs.chromium.org/p/chromium/issues/detail?id=999665#c2
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'm ok with this patch, given that this check is enough. I'm just not sure if we will not hit any other null push_service
pointers.
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: @bridiver
Looking at the chromium code looks like other push_service
pointers are covered -
https://cs.chromium.org/chromium/src/content/browser/push_messaging/push_messaging_context.cc?l=32
https://cs.chromium.org/chromium/src/content/browser/push_messaging/push_messaging_context.cc?l=34
https://cs.chromium.org/chromium/src/content/browser/push_messaging/push_messaging_context.cc?l=43
https://cs.chromium.org/chromium/src/content/browser/push_messaging/push_messaging_manager.cc?l=423
10c90db
to
de56006
Compare
@@ -7,12 +7,18 @@ | |||
|
|||
#include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h" | |||
|
|||
namespace content { | |||
class WebUIDataSource; |
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.
spacing is not needed
@@ -30,6 +30,7 @@ int OnBeforeURLRequest_StaticRedirectWork( | |||
int OnBeforeURLRequest_StaticRedirectWorkForGURL( | |||
const GURL& request_url, | |||
GURL* new_url) { | |||
LOG(INFO) << "URL: " << request_url.spec(); |
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 too much for production, I hope this is something temporary :)
07acad0
to
fae9111
Compare
fae9111
to
0b45159
Compare
3050dd0
to
e138d62
Compare
std::string group_name = | ||
base::FieldTrialList::FindFullName(kInstanceIDFieldTrialName); | ||
- return !base::StartsWith(group_name, kInstanceIDFieldTrialDisabledGroupPrefix, | ||
+ return true || !base::StartsWith(group_name, kInstanceIDFieldTrialDisabledGroupPrefix, |
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.
To deal with NULL deref: https://bugs.chromium.org/p/chromium/issues/detail?id=999665
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 don't understand, either we're not setting this field trial in which case it won't start with "Disabled" or we should set it to something that doesn't start with "Disabled" if we always want it to return true. If we did need to patch it should return true;
on its own line before the original return, but it doesn't look to me like we should have to.
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 my bad, was trying to refactor the original patch. Will fix. Sorry about this.
If a relaunch is required (seems to be, from my testing) should this present a similar banner to what was done for Chromecast (Media Router)? (cc: @rebron) It does have the |
app/brave_generated_resources.grd
Outdated
@@ -389,6 +389,10 @@ By installing this extension, you are agreeing to the Google Widevine Terms of U | |||
<message name="IDS_SETTINGS_WEBRTC_POLICY_DISABLE_NON_PROXIED_UDP" desc="Select value"> | |||
Disable non-proxied UDP | |||
</message> | |||
<!-- Push Messaging --> | |||
<message name="IDS_SETTINGS_PUSH_MESSAGING" desc="Select value"> | |||
Use GCM/FCM for Push Messaging |
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.
@rebron what do you think of this text? Is this good enough for users? or should this be simplified a bit?
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.
Change to "Use Google Services for Push Messaging"
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.
cf9e3ca
to
3351a08
Compare
Yes. We should do the same UE as Chromecast (Media Router). Sounds like that's already the case. |
sec review: lgtm with the current text and the switch off by default |
9e2f818
to
92b1bf5
Compare
browser/ui/BUILD.gn
Outdated
@@ -161,6 +163,8 @@ source_set("ui") { | |||
"//chrome/app:command_ids", | |||
"//chrome/common", | |||
"//components/prefs", | |||
"//components/gcm_driver:gcm_driver", |
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 doesn't need gcm_driver anymore, but brave_gcm_driver target does
browser/ui/BUILD.gn
Outdated
@@ -153,6 +154,7 @@ source_set("ui") { | |||
"//brave/browser/tor", | |||
"//brave/common", | |||
"//brave/components/brave_adblock_ui:generated_resources", | |||
"//brave/components/brave_gcm_driver:brave_gcm_driver", |
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.
:brave_gcm_driver
is redundant. //brave/components/brave_gcm_driver
is all you need
|
||
namespace gcm { | ||
|
||
static bool gcm_channel_enabled_ = 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.
already discussed in DM, but can't have a static var for a per-profile setting
346eb40
to
5a6a017
Compare
@iefremov - One line change to enable the |
#include "brave/components/brave_gcm_driver/brave_gcm_channel_status_syncer.h" | ||
|
||
#include "base/memory/ptr_util.h" | ||
#include "chrome/browser/profiles/profile.h" |
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.
you can't have dependencies on chrome/browser
inside a component. This class should be moved to brave/browser/gcm_driver/
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.
actually that's a problem because of this https://github.com/brave/brave-core/pull/3390/files#diff-b7494bf5a7e56428c188f4349d20eb49R10
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.
do we still need ^^ ?
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.
yes we are capturing the initial pref status using the subclass BraveGCMChannelStatusSyncer
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.
you can't have dependencies on
chrome/browser
inside a component. This class should be moved tobrave/browser/gcm_driver/
will move.
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 seems like we don't need the BraveGCMChannelStatusSyncer
class at all anymore and only need BraveGCMChannelStatus?
user_agent, | ||
url_loader_factory) { | ||
// At destruction all the objects will be cleaned up by SupportsUserData | ||
BraveGCMChannelStatusSyncer::status = |
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 correct, you've created a static BraveGCMChannelStatus*
here. You should be creating a unique_ptr in GetForProfile
if profile->GetUserData(kBraveGCMStatusKey)
is null
4bf7dcf
to
b475918
Compare
browser/gcm_driver/BUILD.gn
Outdated
import("//build/buildflag_header.gni") | ||
import("//components/gcm_driver/config.gni") | ||
|
||
static_library("gcm_driver") { |
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 a static_library instead of source_set?
gcm::BraveGCMChannelStatus::GetForProfile(profile); | ||
|
||
DCHECK(gcm_channel_status); | ||
data_source->AddBoolean("pushMessagingEnabledAtStartup", |
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.
should this just be true
if USE_GCM_FROM_PLATFORM
?
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.
done!
efeffcd
to
8fd3083
Compare
https://bugs.chromium.org/p/chromium/issues/detail?id=1011244 - Debug failure on receiving push notifications on some site. |
fix brave/brave-browser#2301
Submitter Checklist:
npm run lint
)git rebase master
(if needed).git rebase -i
to squash commits (if needed).Test Plan:
Use Google Services for Push Messaging
and verify push messaging works.
Use Google Services for Push Messaging
and relaunchReviewer Checklist:
After-merge Checklist:
changes has landed on.