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

Side by Side Diff: chrome/browser/extensions/api/gcm/gcm_api.cc

Issue 270783002: [GCM] Add more UMA to GCM (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Patch to land Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/extensions/api/gcm/gcm_apitest.cc » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/extensions/api/gcm/gcm_api.h" 5 #include "chrome/browser/extensions/api/gcm/gcm_api.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/metrics/histogram.h"
11 #include "base/strings/string_number_conversions.h" 12 #include "base/strings/string_number_conversions.h"
12 #include "base/strings/string_util.h" 13 #include "base/strings/string_util.h"
13 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/services/gcm/gcm_profile_service.h" 16 #include "chrome/browser/services/gcm/gcm_profile_service.h"
16 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h" 17 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h"
17 #include "chrome/common/extensions/api/gcm.h" 18 #include "chrome/common/extensions/api/gcm.h"
18 #include "extensions/common/extension.h" 19 #include "extensions/common/extension.h"
19 20
20 namespace { 21 namespace {
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 SetResult(new base::StringValue(registration_id)); 125 SetResult(new base::StringValue(registration_id));
125 SetError(GcmResultToError(result)); 126 SetError(GcmResultToError(result));
126 SendResponse(gcm::GCMClient::SUCCESS == result); 127 SendResponse(gcm::GCMClient::SUCCESS == result);
127 } 128 }
128 129
129 GcmUnregisterFunction::GcmUnregisterFunction() {} 130 GcmUnregisterFunction::GcmUnregisterFunction() {}
130 131
131 GcmUnregisterFunction::~GcmUnregisterFunction() {} 132 GcmUnregisterFunction::~GcmUnregisterFunction() {}
132 133
133 bool GcmUnregisterFunction::DoWork() { 134 bool GcmUnregisterFunction::DoWork() {
135 UMA_HISTOGRAM_BOOLEAN("GCM.APICallUnregister", true);
136
134 GCMProfileService()->Unregister( 137 GCMProfileService()->Unregister(
135 GetExtension()->id(), 138 GetExtension()->id(),
136 base::Bind(&GcmUnregisterFunction::CompleteFunctionWithResult, this)); 139 base::Bind(&GcmUnregisterFunction::CompleteFunctionWithResult, this));
137 140
138 return true; 141 return true;
139 } 142 }
140 143
141 void GcmUnregisterFunction::CompleteFunctionWithResult( 144 void GcmUnregisterFunction::CompleteFunctionWithResult(
142 gcm::GCMClient::Result result) { 145 gcm::GCMClient::Result result) {
143 SetError(GcmResultToError(result)); 146 SetError(GcmResultToError(result));
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 254
252 void GcmJsEventRouter::OnListenerAdded(const EventListenerInfo& details) { 255 void GcmJsEventRouter::OnListenerAdded(const EventListenerInfo& details) {
253 if (gcm::GCMProfileService::GetGCMEnabledState(profile_) == 256 if (gcm::GCMProfileService::GetGCMEnabledState(profile_) ==
254 gcm::GCMProfileService::ALWAYS_DISABLED) { 257 gcm::GCMProfileService::ALWAYS_DISABLED) {
255 return; 258 return;
256 } 259 }
257 gcm::GCMProfileServiceFactory::GetForProfile(profile_)->Start(); 260 gcm::GCMProfileServiceFactory::GetForProfile(profile_)->Start();
258 } 261 }
259 262
260 } // namespace extensions 263 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/gcm/gcm_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698