| OLD | NEW |
| 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 "content/renderer/web_ui_bindings.h" | 5 #include "content/renderer/web_ui_bindings.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 | 48 |
| 49 } // namespace | 49 } // namespace |
| 50 | 50 |
| 51 DOMBoundBrowserObject::DOMBoundBrowserObject() { | 51 DOMBoundBrowserObject::DOMBoundBrowserObject() { |
| 52 } | 52 } |
| 53 | 53 |
| 54 DOMBoundBrowserObject::~DOMBoundBrowserObject() { | 54 DOMBoundBrowserObject::~DOMBoundBrowserObject() { |
| 55 STLDeleteContainerPointers(properties_.begin(), properties_.end()); | 55 STLDeleteContainerPointers(properties_.begin(), properties_.end()); |
| 56 } | 56 } |
| 57 | 57 |
| 58 WebUIBindings::WebUIBindings(IPC::Message::Sender* sender, int routing_id) | 58 WebUIBindings::WebUIBindings(IPC::Sender* sender, int routing_id) |
| 59 : sender_(sender), routing_id_(routing_id) { | 59 : sender_(sender), routing_id_(routing_id) { |
| 60 BindCallback("send", base::Bind(&WebUIBindings::Send, | 60 BindCallback("send", base::Bind(&WebUIBindings::Send, |
| 61 base::Unretained(this))); | 61 base::Unretained(this))); |
| 62 } | 62 } |
| 63 | 63 |
| 64 WebUIBindings::~WebUIBindings() {} | 64 WebUIBindings::~WebUIBindings() {} |
| 65 | 65 |
| 66 void WebUIBindings::Send(const CppArgumentList& args, CppVariant* result) { | 66 void WebUIBindings::Send(const CppArgumentList& args, CppVariant* result) { |
| 67 // We expect at least a string message identifier, and optionally take | 67 // We expect at least a string message identifier, and optionally take |
| 68 // an object parameter. If we get anything else we bail. | 68 // an object parameter. If we get anything else we bail. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 *(static_cast<ListValue*>(content.get())))); | 101 *(static_cast<ListValue*>(content.get())))); |
| 102 } | 102 } |
| 103 | 103 |
| 104 void DOMBoundBrowserObject::SetProperty(const std::string& name, | 104 void DOMBoundBrowserObject::SetProperty(const std::string& name, |
| 105 const std::string& value) { | 105 const std::string& value) { |
| 106 CppVariant* cpp_value = new CppVariant; | 106 CppVariant* cpp_value = new CppVariant; |
| 107 cpp_value->Set(value); | 107 cpp_value->Set(value); |
| 108 BindProperty(name, cpp_value); | 108 BindProperty(name, cpp_value); |
| 109 properties_.push_back(cpp_value); | 109 properties_.push_back(cpp_value); |
| 110 } | 110 } |
| OLD | NEW |