0010-disable-gcm-status-check.patch 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. --- a/components/gcm_driver/gcm_channel_status_request.cc
  2. +++ b/components/gcm_driver/gcm_channel_status_request.cc
  3. @@ -23,8 +23,6 @@ namespace gcm {
  4. namespace {
  5. -const char kRequestContentType[] = "application/octet-stream";
  6. -const char kGCMChannelTag[] = "gcm_channel";
  7. const int kDefaultPollIntervalSeconds = 60 * 60; // 60 minutes.
  8. const int kMinPollIntervalSeconds = 30 * 60; // 30 minutes.
  9. @@ -55,69 +53,8 @@ int GCMChannelStatusRequest::min_poll_in
  10. }
  11. void GCMChannelStatusRequest::Start() {
  12. - // url_loader_factory_ can be null for tests.
  13. - if (!url_loader_factory_)
  14. - return;
  15. -
  16. - DCHECK(!simple_url_loader_);
  17. -
  18. - GURL request_url(channel_status_request_url_);
  19. -
  20. - sync_pb::ExperimentStatusRequest proto_data;
  21. - proto_data.add_experiment_name(kGCMChannelTag);
  22. - std::string upload_data;
  23. - if (!proto_data.SerializeToString(&upload_data)) {
  24. - NOTREACHED();
  25. - }
  26. -
  27. - net::NetworkTrafficAnnotationTag traffic_annotation =
  28. - net::DefineNetworkTrafficAnnotation("gcm_channel_status_request", R"(
  29. - semantics {
  30. - sender: "GCM Driver"
  31. - description:
  32. - "Google Chrome interacts with Google Cloud Messaging to receive "
  33. - "push messages for various browser features, as well as on behalf "
  34. - "of websites and extensions. The channel status request "
  35. - "periodically confirms with Google servers whether the feature "
  36. - "should be enabled."
  37. - trigger:
  38. - "Periodically when Chrome has established an active Google Cloud "
  39. - "Messaging subscription. The first request will be issued a minute "
  40. - "after the first subscription activates. Subsequent requests will "
  41. - "be issued each hour with a jitter of 15 minutes. Google can "
  42. - "adjust this interval when it deems necessary."
  43. - data:
  44. - "A user agent string containing the Chrome version, channel and "
  45. - "platform will be sent to the server. No user identifier is sent "
  46. - "along with the request."
  47. - destination: GOOGLE_OWNED_SERVICE
  48. - }
  49. - policy {
  50. - cookies_allowed: NO
  51. - setting:
  52. - "Support for interacting with Google Cloud Messaging is enabled by "
  53. - "default, and there is no configuration option to completely "
  54. - "disable it. Websites wishing to receive push messages must "
  55. - "acquire express permission from the user for the 'Notification' "
  56. - "permission."
  57. - policy_exception_justification:
  58. - "Not implemented, considered not useful."
  59. - })");
  60. -
  61. - auto resource_request = std::make_unique<network::ResourceRequest>();
  62. -
  63. - resource_request->url = request_url;
  64. - resource_request->allow_credentials = false;
  65. - resource_request->method = "POST";
  66. - resource_request->headers.SetHeader(net::HttpRequestHeaders::kUserAgent,
  67. - user_agent_);
  68. - simple_url_loader_ = network::SimpleURLLoader::Create(
  69. - std::move(resource_request), traffic_annotation);
  70. - simple_url_loader_->AttachStringForUpload(upload_data, kRequestContentType);
  71. - simple_url_loader_->DownloadToStringOfUnboundedSizeUntilCrashAndDie(
  72. - url_loader_factory_.get(),
  73. - base::BindOnce(&GCMChannelStatusRequest::OnSimpleLoaderComplete,
  74. - base::Unretained(this)));
  75. + // Simulate an empty response and disable GCM.
  76. + callback_.Run(false, false, 0);
  77. }
  78. void GCMChannelStatusRequest::OnSimpleLoaderComplete(