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

Side by Side Diff: chrome/browser/dom_ui/dom_ui_host.cc

Issue 16270: Change the signature of JSONReader::Read() and related methods to be more (Closed)
Patch Set: fixens Created 11 years, 12 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/dom_ui/dom_ui_host.h" 5 #include "chrome/browser/dom_ui/dom_ui_host.h"
6 6
7 #include "base/json_reader.h" 7 #include "base/json_reader.h"
8 #include "base/json_writer.h" 8 #include "base/json_writer.h"
9 #include "chrome/browser/browser.h" 9 #include "chrome/browser/browser.h"
10 #include "chrome/browser/navigation_entry.h" 10 #include "chrome/browser/navigation_entry.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 } 71 }
72 72
73 void DOMUIHost::ProcessDOMUIMessage(const std::string& message, 73 void DOMUIHost::ProcessDOMUIMessage(const std::string& message,
74 const std::string& content) { 74 const std::string& content) {
75 // Look up the callback for this message. 75 // Look up the callback for this message.
76 MessageCallbackMap::const_iterator callback = message_callbacks_.find(message) ; 76 MessageCallbackMap::const_iterator callback = message_callbacks_.find(message) ;
77 if (callback == message_callbacks_.end()) 77 if (callback == message_callbacks_.end())
78 return; 78 return;
79 79
80 // Convert the content JSON into a Value. 80 // Convert the content JSON into a Value.
81 Value* value = NULL; 81 scoped_ptr<Value> value;
82 if (!content.empty()) { 82 if (!content.empty()) {
83 if (!JSONReader::Read(content, &value, false)) { 83 value.reset(JSONReader::Read(content, false));
84 if (!value.get()) {
84 // The page sent us something that we didn't understand. 85 // The page sent us something that we didn't understand.
85 // This probably indicates a programming error. 86 // This probably indicates a programming error.
86 NOTREACHED(); 87 NOTREACHED();
87 return; 88 return;
88 } 89 }
89 } 90 }
90 91
91 // Forward this message and content on. 92 // Forward this message and content on.
92 callback->second->Run(value); 93 callback->second->Run(value.get());
93 delete value;
94 } 94 }
95 95
96 WebPreferences DOMUIHost::GetWebkitPrefs() { 96 WebPreferences DOMUIHost::GetWebkitPrefs() {
97 // Get the users preferences then force image loading to always be on. 97 // Get the users preferences then force image loading to always be on.
98 WebPreferences web_prefs = WebContents::GetWebkitPrefs(); 98 WebPreferences web_prefs = WebContents::GetWebkitPrefs();
99 web_prefs.loads_images_automatically = true; 99 web_prefs.loads_images_automatically = true;
100 100
101 return web_prefs; 101 return web_prefs;
102 } 102 }
103 103
104 void DOMUIHost::ExecuteJavascript(const std::wstring& javascript) { 104 void DOMUIHost::ExecuteJavascript(const std::wstring& javascript) {
105 render_view_host()->ExecuteJavascriptInWebFrame(std::wstring(), javascript); 105 render_view_host()->ExecuteJavascriptInWebFrame(std::wstring(), javascript);
106 } 106 }
107 107
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698