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

Side by Side Diff: chrome/browser/extensions/api/api_resource_event_notifier.cc

Issue 9590002: JSONWriter cleanup: integrate pretty print into write options. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix merge conflict 7. Created 8 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 | 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/api_resource_event_notifier.h" 5 #include "chrome/browser/extensions/api/api_resource_event_notifier.h"
6 6
7 #include "base/json/json_writer.h" 7 #include "base/json/json_writer.h"
8 #include "chrome/browser/extensions/extension_event_router.h" 8 #include "chrome/browser/extensions/extension_event_router.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 10
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 DictionaryValue* event = CreateAPIResourceEvent(event_type); 74 DictionaryValue* event = CreateAPIResourceEvent(event_type);
75 event->SetInteger(kResultCodeKey, result_code); 75 event->SetInteger(kResultCodeKey, result_code);
76 DispatchEvent(event); 76 DispatchEvent(event);
77 } 77 }
78 78
79 void APIResourceEventNotifier::DispatchEvent(DictionaryValue* event) { 79 void APIResourceEventNotifier::DispatchEvent(DictionaryValue* event) {
80 ListValue args; 80 ListValue args;
81 81
82 args.Set(0, event); 82 args.Set(0, event);
83 std::string json_args; 83 std::string json_args;
84 base::JSONWriter::Write(&args, false, &json_args); 84 base::JSONWriter::Write(&args, &json_args);
85 router_->DispatchEventToExtension(src_extension_id_, 85 router_->DispatchEventToExtension(src_extension_id_,
86 events::kOnAPIResourceEvent, 86 events::kOnAPIResourceEvent,
87 json_args, profile_, src_url_); 87 json_args, profile_, src_url_);
88 } 88 }
89 89
90 DictionaryValue* APIResourceEventNotifier::CreateAPIResourceEvent( 90 DictionaryValue* APIResourceEventNotifier::CreateAPIResourceEvent(
91 APIResourceEventType event_type) { 91 APIResourceEventType event_type) {
92 DictionaryValue* event = new DictionaryValue(); 92 DictionaryValue* event = new DictionaryValue();
93 event->SetString(kEventTypeKey, APIResourceEventTypeToString(event_type)); 93 event->SetString(kEventTypeKey, APIResourceEventTypeToString(event_type));
94 event->SetInteger(kSrcIdKey, src_id_); 94 event->SetInteger(kSrcIdKey, src_id_);
(...skipping 17 matching lines...) Expand all
112 return kEventTypeDataRead; 112 return kEventTypeDataRead;
113 case API_RESOURCE_EVENT_WRITE_COMPLETE: 113 case API_RESOURCE_EVENT_WRITE_COMPLETE:
114 return kEventTypeWriteComplete; 114 return kEventTypeWriteComplete;
115 } 115 }
116 116
117 NOTREACHED(); 117 NOTREACHED();
118 return std::string(); 118 return std::string();
119 } 119 }
120 120
121 } // namespace extensions 121 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/download/download_extension_api.cc ('k') | chrome/browser/extensions/api/proxy/proxy_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698