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

Side by Side Diff: chrome/browser/extensions/api/notifications/notifications_api.cc

Issue 1201063002: Set up the infrastructure for Extension event metrics. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebaaaaase Created 5 years, 6 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/notifications/notifications_api.h" 5 #include "chrome/browser/extensions/api/notifications/notifications_api.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/guid.h" 8 #include "base/guid.h"
9 #include "base/rand_util.h" 9 #include "base/rand_util.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 177
178 private: 178 private:
179 ~NotificationsApiDelegate() override {} 179 ~NotificationsApiDelegate() override {}
180 180
181 void SendEvent(const std::string& name, 181 void SendEvent(const std::string& name,
182 EventRouter::UserGestureState user_gesture, 182 EventRouter::UserGestureState user_gesture,
183 scoped_ptr<base::ListValue> args) { 183 scoped_ptr<base::ListValue> args) {
184 if (!event_router_) 184 if (!event_router_)
185 return; 185 return;
186 186
187 scoped_ptr<Event> event(new Event(name, args.Pass())); 187 scoped_ptr<Event> event(new Event(events::UNKNOWN, name, args.Pass()));
188 event->user_gesture = user_gesture; 188 event->user_gesture = user_gesture;
189 event_router_->DispatchEventToExtension(extension_id_, event.Pass()); 189 event_router_->DispatchEventToExtension(extension_id_, event.Pass());
190 } 190 }
191 191
192 void Shutdown() { 192 void Shutdown() {
193 event_router_ = nullptr; 193 event_router_ = nullptr;
194 shutdown_notifier_subscription_.reset(); 194 shutdown_notifier_subscription_.reset();
195 } 195 }
196 196
197 scoped_ptr<base::ListValue> CreateBaseEventArgs() { 197 scoped_ptr<base::ListValue> CreateBaseEventArgs() {
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 ? api::notifications::PERMISSION_LEVEL_GRANTED 683 ? api::notifications::PERMISSION_LEVEL_GRANTED
684 : api::notifications::PERMISSION_LEVEL_DENIED; 684 : api::notifications::PERMISSION_LEVEL_DENIED;
685 685
686 SetResult(new base::StringValue(api::notifications::ToString(result))); 686 SetResult(new base::StringValue(api::notifications::ToString(result)));
687 SendResponse(true); 687 SendResponse(true);
688 688
689 return true; 689 return true;
690 } 690 }
691 691
692 } // namespace extensions 692 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698