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

Side by Side Diff: chrome/browser/extensions/extension_devtools_bridge.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_devtools_bridge.h" 5 #include "chrome/browser/extensions/extension_devtools_bridge.h"
6 6
7 #include "base/json/json_writer.h" 7 #include "base/json/json_writer.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/stringprintf.h" 10 #include "base/stringprintf.h"
(...skipping 28 matching lines...) Expand all
39 ExtensionDevToolsBridge::~ExtensionDevToolsBridge() { 39 ExtensionDevToolsBridge::~ExtensionDevToolsBridge() {
40 } 40 }
41 41
42 static std::string FormatDevToolsMessage(int id, const std::string& method) { 42 static std::string FormatDevToolsMessage(int id, const std::string& method) {
43 DictionaryValue message; 43 DictionaryValue message;
44 message.SetInteger("id", id); 44 message.SetInteger("id", id);
45 message.SetString("method", method); 45 message.SetString("method", method);
46 message.Set("params", new DictionaryValue); 46 message.Set("params", new DictionaryValue);
47 47
48 std::string json; 48 std::string json;
49 base::JSONWriter::Write(&message, false, &json); 49 base::JSONWriter::Write(&message, &json);
50 return json; 50 return json;
51 } 51 }
52 52
53 bool ExtensionDevToolsBridge::RegisterAsDevToolsClientHost() { 53 bool ExtensionDevToolsBridge::RegisterAsDevToolsClientHost() {
54 DCHECK_EQ(MessageLoop::current()->type(), MessageLoop::TYPE_UI); 54 DCHECK_EQ(MessageLoop::current()->type(), MessageLoop::TYPE_UI);
55 55
56 Browser* browser; 56 Browser* browser;
57 TabStripModel* tab_strip; 57 TabStripModel* tab_strip;
58 TabContentsWrapper* contents; 58 TabContentsWrapper* contents;
59 int tab_index; 59 int tab_index;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 117
118 std::string json = base::StringPrintf("[%s]", data.c_str()); 118 std::string json = base::StringPrintf("[%s]", data.c_str());
119 profile_->GetExtensionEventRouter()->DispatchEventToRenderers( 119 profile_->GetExtensionEventRouter()->DispatchEventToRenderers(
120 on_page_event_name_, json, profile_, GURL()); 120 on_page_event_name_, json, profile_, GURL());
121 } 121 }
122 122
123 void ExtensionDevToolsBridge::TabReplaced(WebContents* new_tab) { 123 void ExtensionDevToolsBridge::TabReplaced(WebContents* new_tab) {
124 // We don't update the tab id as it needs to remain the same so that we can 124 // We don't update the tab id as it needs to remain the same so that we can
125 // properly unregister. 125 // properly unregister.
126 } 126 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_debugger_api.cc ('k') | chrome/browser/extensions/extension_function.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698