Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(293)

Side by Side Diff: chrome/browser/push_messaging/push_messaging_service_impl.cc

Issue 1017183002: Add rappor metrics for messages received (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@raport
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tools/metrics/rappor/rappor.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/push_messaging/push_messaging_service_impl.h" 5 #include "chrome/browser/push_messaging/push_messaging_service_impl.h"
6 6
7 #include <bitset> 7 #include <bitset>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/barrier_closure.h" 10 #include "base/barrier_closure.h"
(...skipping 16 matching lines...) Expand all
27 #include "chrome/browser/push_messaging/push_messaging_service_factory.h" 27 #include "chrome/browser/push_messaging/push_messaging_service_factory.h"
28 #include "chrome/browser/services/gcm/gcm_profile_service.h" 28 #include "chrome/browser/services/gcm/gcm_profile_service.h"
29 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h" 29 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h"
30 #include "chrome/common/chrome_switches.h" 30 #include "chrome/common/chrome_switches.h"
31 #include "chrome/common/pref_names.h" 31 #include "chrome/common/pref_names.h"
32 #include "chrome/grit/generated_resources.h" 32 #include "chrome/grit/generated_resources.h"
33 #include "components/content_settings/core/browser/host_content_settings_map.h" 33 #include "components/content_settings/core/browser/host_content_settings_map.h"
34 #include "components/content_settings/core/common/permission_request_id.h" 34 #include "components/content_settings/core/common/permission_request_id.h"
35 #include "components/gcm_driver/gcm_driver.h" 35 #include "components/gcm_driver/gcm_driver.h"
36 #include "components/pref_registry/pref_registry_syncable.h" 36 #include "components/pref_registry/pref_registry_syncable.h"
37 #include "components/rappor/rappor_utils.h"
37 #include "content/public/browser/browser_context.h" 38 #include "content/public/browser/browser_context.h"
38 #include "content/public/browser/browser_thread.h" 39 #include "content/public/browser/browser_thread.h"
39 #include "content/public/browser/render_frame_host.h" 40 #include "content/public/browser/render_frame_host.h"
40 #include "content/public/browser/service_worker_context.h" 41 #include "content/public/browser/service_worker_context.h"
41 #include "content/public/browser/storage_partition.h" 42 #include "content/public/browser/storage_partition.h"
42 #include "content/public/browser/web_contents.h" 43 #include "content/public/browser/web_contents.h"
43 #include "content/public/common/child_process_host.h" 44 #include "content/public/common/child_process_host.h"
44 #include "content/public/common/content_switches.h" 45 #include "content/public/common/content_switches.h"
45 #include "content/public/common/platform_notification_data.h" 46 #include "content/public/common/platform_notification_data.h"
46 #include "content/public/common/push_messaging_status.h" 47 #include "content/public/common/push_messaging_status.h"
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 } 194 }
194 // Drop message and unregister if |origin| has lost push permission. 195 // Drop message and unregister if |origin| has lost push permission.
195 if (!HasPermission(application_id.origin())) { 196 if (!HasPermission(application_id.origin())) {
196 DeliverMessageCallback(app_id, application_id.origin(), 197 DeliverMessageCallback(app_id, application_id.origin(),
197 application_id.service_worker_registration_id(), 198 application_id.service_worker_registration_id(),
198 message, 199 message,
199 content::PUSH_DELIVERY_STATUS_PERMISSION_DENIED); 200 content::PUSH_DELIVERY_STATUS_PERMISSION_DENIED);
200 return; 201 return;
201 } 202 }
202 203
204 rappor::SampleDomainAndRegistryFromGURL(
205 g_browser_process->rappor_service(),
206 "PushMessaging.MessageReceived.Origin",
207 application_id.origin());
208
203 // The Push API only exposes a single string of data in the push event fired 209 // The Push API only exposes a single string of data in the push event fired
204 // on the Service Worker. When developers send messages using GCM to the Push 210 // on the Service Worker. When developers send messages using GCM to the Push
205 // API and want to include a message payload, they must pass a single key- 211 // API and want to include a message payload, they must pass a single key-
206 // value pair, where the key is "data" and the value is the string they want 212 // value pair, where the key is "data" and the value is the string they want
207 // to be passed to their Service Worker. For example, they could send the 213 // to be passed to their Service Worker. For example, they could send the
208 // following JSON using the HTTPS GCM API: 214 // following JSON using the HTTPS GCM API:
209 // { 215 // {
210 // "registration_ids": ["FOO", "BAR"], 216 // "registration_ids": ["FOO", "BAR"],
211 // "data": { 217 // "data": {
212 // "data": "BAZ", 218 // "data": "BAZ",
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 CONTENT_SETTING_ALLOW; 784 CONTENT_SETTING_ALLOW;
779 } 785 }
780 786
781 gcm::GCMDriver* PushMessagingServiceImpl::GetGCMDriver() const { 787 gcm::GCMDriver* PushMessagingServiceImpl::GetGCMDriver() const {
782 gcm::GCMProfileService* gcm_profile_service = 788 gcm::GCMProfileService* gcm_profile_service =
783 gcm::GCMProfileServiceFactory::GetForProfile(profile_); 789 gcm::GCMProfileServiceFactory::GetForProfile(profile_);
784 CHECK(gcm_profile_service); 790 CHECK(gcm_profile_service);
785 CHECK(gcm_profile_service->driver()); 791 CHECK(gcm_profile_service->driver());
786 return gcm_profile_service->driver(); 792 return gcm_profile_service->driver();
787 } 793 }
OLDNEW
« no previous file with comments | « no previous file | tools/metrics/rappor/rappor.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698