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

Side by Side Diff: chrome/browser/extensions/api/push_messaging/push_messaging_api.cc

Issue 10694085: Refactor extension event distribution to use Values instead of JSON strings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixing memory leak in a test. Created 8 years, 4 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
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/push_messaging/push_messaging_api.h" 5 #include "chrome/browser/extensions/api/push_messaging/push_messaging_api.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "chrome/browser/extensions/event_names.h" 9 #include "chrome/browser/extensions/event_names.h"
10 #include "chrome/browser/extensions/event_router.h" 10 #include "chrome/browser/extensions/event_router.h"
(...skipping 16 matching lines...) Expand all
27 // TODO(dcheng): Add hooks into InvalidationHandler when landed. 27 // TODO(dcheng): Add hooks into InvalidationHandler when landed.
28 } 28 }
29 29
30 void PushMessagingEventRouter::OnMessage(const std::string& extension_id, 30 void PushMessagingEventRouter::OnMessage(const std::string& extension_id,
31 int subchannel, 31 int subchannel,
32 const std::string& payload) { 32 const std::string& payload) {
33 glue::Message message; 33 glue::Message message;
34 message.subchannel_id = subchannel; 34 message.subchannel_id = subchannel;
35 message.payload = payload; 35 message.payload = payload;
36 36
37 scoped_ptr<base::Value> parameters(glue::OnMessage::Create(message)); 37 scoped_ptr<base::ListValue> args(glue::OnMessage::Create(message));
38 profile_->GetExtensionEventRouter()->DispatchEventToExtension( 38 profile_->GetExtensionEventRouter()->DispatchEventToExtension(
39 extension_id, 39 extension_id,
40 event_names::kOnPushMessage, 40 event_names::kOnPushMessage,
41 *parameters.get(), 41 args.Pass(),
42 profile_, 42 profile_,
43 GURL()); 43 GURL());
44 } 44 }
45 45
46 } // namespace extensions 46 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/proxy/proxy_api.cc ('k') | chrome/browser/extensions/api/runtime/runtime_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698