| OLD | NEW |
| 1 // Copyright (c) 2011 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 #ifndef CONTENT_RENDERER_WEB_UI_BINDINGS_H_ | 5 #ifndef CONTENT_RENDERER_WEB_UI_BINDINGS_H_ |
| 6 #define CONTENT_RENDERER_WEB_UI_BINDINGS_H_ | 6 #define CONTENT_RENDERER_WEB_UI_BINDINGS_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "content/common/content_export.h" | 9 #include "content/common/content_export.h" |
| 10 #include "ipc/ipc_message.h" | 10 #include "ipc/ipc_message.h" |
| 11 #include "webkit/glue/cpp_bound_class.h" | 11 #include "webkit/glue/cpp_bound_class.h" |
| 12 | 12 |
| 13 // A DOMBoundBrowserObject is a backing for some object bound to the window | 13 // A DOMBoundBrowserObject is a backing for some object bound to the window |
| 14 // in JS that knows how to dispatch messages to an associated c++ object living | 14 // in JS that knows how to dispatch messages to an associated c++ object living |
| 15 // in the browser process. | 15 // in the browser process. |
| 16 class DOMBoundBrowserObject : public CppBoundClass { | 16 class DOMBoundBrowserObject : public webkit_glue::CppBoundClass { |
| 17 public: | 17 public: |
| 18 CONTENT_EXPORT DOMBoundBrowserObject(); | 18 CONTENT_EXPORT DOMBoundBrowserObject(); |
| 19 CONTENT_EXPORT virtual ~DOMBoundBrowserObject(); | 19 CONTENT_EXPORT virtual ~DOMBoundBrowserObject(); |
| 20 | 20 |
| 21 // Sets a property with the given name and value. | 21 // Sets a property with the given name and value. |
| 22 void SetProperty(const std::string& name, const std::string& value); | 22 void SetProperty(const std::string& name, const std::string& value); |
| 23 | 23 |
| 24 private: | 24 private: |
| 25 // The list of properties that have been set. We keep track of this so we | 25 // The list of properties that have been set. We keep track of this so we |
| 26 // can free them on destruction. | 26 // can free them on destruction. |
| 27 typedef std::vector<CppVariant*> PropertyList; | 27 typedef std::vector<webkit_glue::CppVariant*> PropertyList; |
| 28 PropertyList properties_; | 28 PropertyList properties_; |
| 29 | 29 |
| 30 DISALLOW_COPY_AND_ASSIGN(DOMBoundBrowserObject); | 30 DISALLOW_COPY_AND_ASSIGN(DOMBoundBrowserObject); |
| 31 }; | 31 }; |
| 32 | 32 |
| 33 // WebUIBindings is the class backing the "chrome" object accessible | 33 // WebUIBindings is the class backing the "chrome" object accessible |
| 34 // from Javascript from privileged pages. | 34 // from Javascript from privileged pages. |
| 35 // | 35 // |
| 36 // We expose one function, for sending a message to the browser: | 36 // We expose one function, for sending a message to the browser: |
| 37 // send(String name, Object argument); | 37 // send(String name, Object argument); |
| 38 // It's plumbed through to the OnWebUIMessage callback on RenderViewHost | 38 // It's plumbed through to the OnWebUIMessage callback on RenderViewHost |
| 39 // delegate. | 39 // delegate. |
| 40 class WebUIBindings : public DOMBoundBrowserObject { | 40 class WebUIBindings : public DOMBoundBrowserObject { |
| 41 public: | 41 public: |
| 42 WebUIBindings(IPC::Message::Sender* sender, | 42 WebUIBindings(IPC::Message::Sender* sender, |
| 43 int routing_id); | 43 int routing_id); |
| 44 virtual ~WebUIBindings(); | 44 virtual ~WebUIBindings(); |
| 45 | 45 |
| 46 private: | 46 private: |
| 47 // The send() function provided to Javascript. | 47 // The send() function provided to Javascript. |
| 48 void Send(const CppArgumentList& args, CppVariant* result); | 48 void Send(const webkit_glue::CppArgumentList& args, |
| 49 webkit_glue::CppVariant* result); |
| 49 | 50 |
| 50 IPC::Message::Sender* sender_; | 51 IPC::Message::Sender* sender_; |
| 51 int routing_id_; | 52 int routing_id_; |
| 52 | 53 |
| 53 DISALLOW_COPY_AND_ASSIGN(WebUIBindings); | 54 DISALLOW_COPY_AND_ASSIGN(WebUIBindings); |
| 54 }; | 55 }; |
| 55 | 56 |
| 56 #endif // CONTENT_RENDERER_WEB_UI_BINDINGS_H_ | 57 #endif // CONTENT_RENDERER_WEB_UI_BINDINGS_H_ |
| OLD | NEW |