OLD | NEW |
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 #ifndef CHROME_BROWSER_DOM_UI_H__ | 5 #ifndef CHROME_BROWSER_DOM_UI_H__ |
6 #define CHROME_BROWSER_DOM_UI_H__ | 6 #define CHROME_BROWSER_DOM_UI_H__ |
7 | 7 |
8 #include "base/task.h" | 8 #include "base/task.h" |
9 #include "chrome/browser/dom_ui/dom_ui_contents.h" | 9 #include "chrome/browser/dom_ui/dom_ui_contents.h" |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... |
28 // Used by DOMMessageHandlers. | 28 // Used by DOMMessageHandlers. |
29 typedef Callback1<const Value*>::Type MessageCallback; | 29 typedef Callback1<const Value*>::Type MessageCallback; |
30 void RegisterMessageCallback (const std::string& message, | 30 void RegisterMessageCallback (const std::string& message, |
31 MessageCallback* callback); | 31 MessageCallback* callback); |
32 | 32 |
33 // Call a Javascript function by sending its name and arguments down to | 33 // Call a Javascript function by sending its name and arguments down to |
34 // the renderer. This is asynchronous; there's no way to get the result | 34 // the renderer. This is asynchronous; there's no way to get the result |
35 // of the call, and should be thought of more like sending a message to | 35 // of the call, and should be thought of more like sending a message to |
36 // the page. | 36 // the page. |
37 // There are two function variants for one-arg and two-arg calls. | 37 // There are two function variants for one-arg and two-arg calls. |
| 38 void CallJavascriptFunction(const std::wstring& function_name); |
38 void CallJavascriptFunction(const std::wstring& function_name, | 39 void CallJavascriptFunction(const std::wstring& function_name, |
39 const Value& arg); | 40 const Value& arg); |
40 void CallJavascriptFunction(const std::wstring& function_name, | 41 void CallJavascriptFunction(const std::wstring& function_name, |
41 const Value& arg1, | 42 const Value& arg1, |
42 const Value& arg2); | 43 const Value& arg2); |
43 | 44 |
44 Profile* get_profile() { return contents_->profile(); } | 45 Profile* get_profile() { return contents_->profile(); } |
45 | 46 |
46 protected: | 47 protected: |
47 void AddMessageHandler(DOMMessageHandler* handler); | 48 void AddMessageHandler(DOMMessageHandler* handler); |
(...skipping 22 matching lines...) Expand all Loading... |
70 explicit DOMMessageHandler(DOMUI* dom_ui); | 71 explicit DOMMessageHandler(DOMUI* dom_ui); |
71 virtual ~DOMMessageHandler(); | 72 virtual ~DOMMessageHandler(); |
72 | 73 |
73 protected: | 74 protected: |
74 // Adds "url" and "title" keys on incoming dictionary, setting title | 75 // Adds "url" and "title" keys on incoming dictionary, setting title |
75 // as the url as a fallback on empty title. | 76 // as the url as a fallback on empty title. |
76 static void SetURLAndTitle(DictionaryValue* dictionary, | 77 static void SetURLAndTitle(DictionaryValue* dictionary, |
77 std::wstring title, | 78 std::wstring title, |
78 const GURL& gurl); | 79 const GURL& gurl); |
79 | 80 |
| 81 // Extract an integer value from a Value. |
| 82 int ExtractIntegerValue(const Value* value); |
| 83 |
| 84 // Extract a string value from a Value. |
| 85 std::wstring ExtractStringValue(const Value* value); |
| 86 |
80 DOMUI* const dom_ui_; | 87 DOMUI* const dom_ui_; |
81 | 88 |
82 private: | 89 private: |
83 DISALLOW_COPY_AND_ASSIGN(DOMMessageHandler); | 90 DISALLOW_COPY_AND_ASSIGN(DOMMessageHandler); |
84 }; | 91 }; |
85 | 92 |
86 | 93 |
87 #endif // CHROME_BROWSER_DOM_UI_H__ | 94 #endif // CHROME_BROWSER_DOM_UI_H__ |
OLD | NEW |