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

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

Issue 39206: NO CODE CHANGE. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 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
« no previous file with comments | « chrome/browser/dom_ui/dom_ui_contents.cc ('k') | chrome/browser/download/save_package.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/values.h" 9 #include "base/values.h"
10 #include "chrome/browser/browser.h" 10 #include "chrome/browser/browser.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 std::wstring javascript = function_name + L"(" + UTF8ToWide(json); 67 std::wstring javascript = function_name + L"(" + UTF8ToWide(json);
68 JSONWriter::Write(&arg2, false, &json); 68 JSONWriter::Write(&arg2, false, &json);
69 javascript += L"," + UTF8ToWide(json) + L");"; 69 javascript += L"," + UTF8ToWide(json) + L");";
70 70
71 ExecuteJavascript(javascript); 71 ExecuteJavascript(javascript);
72 } 72 }
73 73
74 void DOMUIHost::ProcessDOMUIMessage(const std::string& message, 74 void DOMUIHost::ProcessDOMUIMessage(const std::string& message,
75 const std::string& content) { 75 const std::string& content) {
76 // Look up the callback for this message. 76 // Look up the callback for this message.
77 MessageCallbackMap::const_iterator callback = message_callbacks_.find(message) ; 77 MessageCallbackMap::const_iterator callback(message_callbacks_.find(message));
78 if (callback == message_callbacks_.end()) 78 if (callback == message_callbacks_.end())
79 return; 79 return;
80 80
81 // Convert the content JSON into a Value. 81 // Convert the content JSON into a Value.
82 scoped_ptr<Value> value; 82 scoped_ptr<Value> value;
83 if (!content.empty()) { 83 if (!content.empty()) {
84 value.reset(JSONReader::Read(content, false)); 84 value.reset(JSONReader::Read(content, false));
85 if (!value.get()) { 85 if (!value.get()) {
86 // The page sent us something that we didn't understand. 86 // The page sent us something that we didn't understand.
87 // This probably indicates a programming error. 87 // This probably indicates a programming error.
(...skipping 11 matching lines...) Expand all
99 WebPreferences web_prefs = WebContents::GetWebkitPrefs(); 99 WebPreferences web_prefs = WebContents::GetWebkitPrefs();
100 web_prefs.loads_images_automatically = true; 100 web_prefs.loads_images_automatically = true;
101 101
102 return web_prefs; 102 return web_prefs;
103 } 103 }
104 104
105 void DOMUIHost::ExecuteJavascript(const std::wstring& javascript) { 105 void DOMUIHost::ExecuteJavascript(const std::wstring& javascript) {
106 render_view_host()->ExecuteJavascriptInWebFrame(std::wstring(), javascript); 106 render_view_host()->ExecuteJavascriptInWebFrame(std::wstring(), javascript);
107 } 107 }
108 108
OLDNEW
« no previous file with comments | « chrome/browser/dom_ui/dom_ui_contents.cc ('k') | chrome/browser/download/save_package.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698