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

Side by Side Diff: chrome/browser/extensions/extension_message_service.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/extension_message_service.h" 5 #include "chrome/browser/extensions/extension_message_service.h"
6 6
7 #include "base/atomic_sequence_num.h" 7 #include "base/atomic_sequence_num.h"
8 #include "base/json/json_writer.h" 8 #include "base/json/json_writer.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 GetExtensionProcess(profile, target_extension_id), 162 GetExtensionProcess(profile, target_extension_id),
163 MSG_ROUTING_CONTROL); 163 MSG_ROUTING_CONTROL);
164 WebContents* source_contents = tab_util::GetWebContentsByID( 164 WebContents* source_contents = tab_util::GetWebContentsByID(
165 source_process_id, source_routing_id); 165 source_process_id, source_routing_id);
166 166
167 // Include info about the opener's tab (if it was a tab). 167 // Include info about the opener's tab (if it was a tab).
168 std::string tab_json = "null"; 168 std::string tab_json = "null";
169 if (source_contents) { 169 if (source_contents) {
170 scoped_ptr<DictionaryValue> tab_value( 170 scoped_ptr<DictionaryValue> tab_value(
171 ExtensionTabUtil::CreateTabValue(source_contents)); 171 ExtensionTabUtil::CreateTabValue(source_contents));
172 base::JSONWriter::Write(tab_value.get(), false, &tab_json); 172 base::JSONWriter::Write(tab_value.get(), &tab_json);
173 } 173 }
174 174
175 OpenChannelImpl(source, tab_json, receiver, receiver_port_id, 175 OpenChannelImpl(source, tab_json, receiver, receiver_port_id,
176 source_extension_id, target_extension_id, channel_name); 176 source_extension_id, target_extension_id, channel_name);
177 } 177 }
178 178
179 void ExtensionMessageService::OpenChannelToTab( 179 void ExtensionMessageService::OpenChannelToTab(
180 int source_process_id, int source_routing_id, int receiver_port_id, 180 int source_process_id, int source_routing_id, int receiver_port_id,
181 int tab_id, const std::string& extension_id, 181 int tab_id, const std::string& extension_id,
182 const std::string& channel_name) { 182 const std::string& channel_name) {
(...skipping 21 matching lines...) Expand all
204 } 204 }
205 205
206 WebContents* source_contents = tab_util::GetWebContentsByID( 206 WebContents* source_contents = tab_util::GetWebContentsByID(
207 source_process_id, source_routing_id); 207 source_process_id, source_routing_id);
208 208
209 // Include info about the opener's tab (if it was a tab). 209 // Include info about the opener's tab (if it was a tab).
210 std::string tab_json = "null"; 210 std::string tab_json = "null";
211 if (source_contents) { 211 if (source_contents) {
212 scoped_ptr<DictionaryValue> tab_value( 212 scoped_ptr<DictionaryValue> tab_value(
213 ExtensionTabUtil::CreateTabValue(source_contents)); 213 ExtensionTabUtil::CreateTabValue(source_contents));
214 base::JSONWriter::Write(tab_value.get(), false, &tab_json); 214 base::JSONWriter::Write(tab_value.get(), &tab_json);
215 } 215 }
216 216
217 OpenChannelImpl(source, tab_json, receiver, receiver_port_id, 217 OpenChannelImpl(source, tab_json, receiver, receiver_port_id,
218 extension_id, extension_id, channel_name); 218 extension_id, extension_id, channel_name);
219 } 219 }
220 220
221 bool ExtensionMessageService::OpenChannelImpl( 221 bool ExtensionMessageService::OpenChannelImpl(
222 content::RenderProcessHost* source, 222 content::RenderProcessHost* source,
223 const std::string& tab_json, 223 const std::string& tab_json,
224 const MessagePort& receiver, int receiver_port_id, 224 const MessagePort& receiver, int receiver_port_id,
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 325
326 if (current->second->opener.process == process) { 326 if (current->second->opener.process == process) {
327 CloseChannelImpl(current, GET_CHANNEL_OPENER_ID(current->first), 327 CloseChannelImpl(current, GET_CHANNEL_OPENER_ID(current->first),
328 notify_other_port); 328 notify_other_port);
329 } else if (current->second->receiver.process == process) { 329 } else if (current->second->receiver.process == process) {
330 CloseChannelImpl(current, GET_CHANNEL_RECEIVERS_ID(current->first), 330 CloseChannelImpl(current, GET_CHANNEL_RECEIVERS_ID(current->first),
331 notify_other_port); 331 notify_other_port);
332 } 332 }
333 } 333 }
334 } 334 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_menu_manager.cc ('k') | chrome/browser/extensions/extension_omnibox_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698