| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_DOM_UI_H_ | 5 #ifndef CHROME_BROWSER_DOM_UI_DOM_UI_H_ |
| 6 #define CHROME_BROWSER_DOM_UI_DOM_UI_H_ | 6 #define CHROME_BROWSER_DOM_UI_DOM_UI_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 // Returns the transition type that should be used for link clicks on this | 98 // Returns the transition type that should be used for link clicks on this |
| 99 // Web UI. This will default to LINK but may be overridden. | 99 // Web UI. This will default to LINK but may be overridden. |
| 100 PageTransition::Type link_transition_type() const { | 100 PageTransition::Type link_transition_type() const { |
| 101 return link_transition_type_; | 101 return link_transition_type_; |
| 102 } | 102 } |
| 103 | 103 |
| 104 int bindings() const { | 104 int bindings() const { |
| 105 return bindings_; | 105 return bindings_; |
| 106 } | 106 } |
| 107 | 107 |
| 108 // Indicates whether RegisterMessageCallback() will overwrite an existing |
| 109 // message callback mapping. Serves as the hook for test mocks. |
| 110 bool register_callback_overwrites() const { |
| 111 return register_callback_overwrites_; |
| 112 } |
| 113 |
| 114 void register_callback_overwrites(bool value) { |
| 115 register_callback_overwrites_ = value; |
| 116 } |
| 117 |
| 108 // Call a Javascript function by sending its name and arguments down to | 118 // Call a Javascript function by sending its name and arguments down to |
| 109 // the renderer. This is asynchronous; there's no way to get the result | 119 // the renderer. This is asynchronous; there's no way to get the result |
| 110 // of the call, and should be thought of more like sending a message to | 120 // of the call, and should be thought of more like sending a message to |
| 111 // the page. | 121 // the page. |
| 112 // There are variants for calls with more arguments. | 122 // There are variants for calls with more arguments. |
| 113 void CallJavascriptFunction(const std::wstring& function_name); | 123 void CallJavascriptFunction(const std::wstring& function_name); |
| 114 void CallJavascriptFunction(const std::wstring& function_name, | 124 void CallJavascriptFunction(const std::wstring& function_name, |
| 115 const Value& arg); | 125 const Value& arg); |
| 116 void CallJavascriptFunction(const std::wstring& function_name, | 126 void CallJavascriptFunction(const std::wstring& function_name, |
| 117 const Value& arg1, | 127 const Value& arg1, |
| (...skipping 30 matching lines...) Expand all Loading... |
| 148 // Options that may be overridden by individual Web UI implementations. The | 158 // Options that may be overridden by individual Web UI implementations. The |
| 149 // bool options default to false. See the public getters for more information. | 159 // bool options default to false. See the public getters for more information. |
| 150 bool hide_favicon_; | 160 bool hide_favicon_; |
| 151 bool force_bookmark_bar_visible_; | 161 bool force_bookmark_bar_visible_; |
| 152 bool focus_location_bar_by_default_; | 162 bool focus_location_bar_by_default_; |
| 153 bool should_hide_url_; | 163 bool should_hide_url_; |
| 154 string16 overridden_title_; // Defaults to empty string. | 164 string16 overridden_title_; // Defaults to empty string. |
| 155 PageTransition::Type link_transition_type_; // Defaults to LINK. | 165 PageTransition::Type link_transition_type_; // Defaults to LINK. |
| 156 int bindings_; // The bindings from BindingsPolicy that should be enabled for | 166 int bindings_; // The bindings from BindingsPolicy that should be enabled for |
| 157 // this page. | 167 // this page. |
| 168 bool register_callback_overwrites_; // Defaults to false; |
| 158 | 169 |
| 159 // The DOMMessageHandlers we own. | 170 // The DOMMessageHandlers we own. |
| 160 std::vector<DOMMessageHandler*> handlers_; | 171 std::vector<DOMMessageHandler*> handlers_; |
| 161 | 172 |
| 162 // Non-owning pointer to the TabContents this DOMUI is associated with. | 173 // Non-owning pointer to the TabContents this DOMUI is associated with. |
| 163 TabContents* tab_contents_; | 174 TabContents* tab_contents_; |
| 164 | 175 |
| 165 private: | 176 private: |
| 166 // A map of message name -> message handling callback. | 177 // A map of message name -> message handling callback. |
| 167 typedef std::map<std::string, MessageCallback*> MessageCallbackMap; | 178 typedef std::map<std::string, MessageCallback*> MessageCallbackMap; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 // Extract a string value from a list Value. | 210 // Extract a string value from a list Value. |
| 200 std::wstring ExtractStringValue(const ListValue* value); | 211 std::wstring ExtractStringValue(const ListValue* value); |
| 201 | 212 |
| 202 DOMUI* dom_ui_; | 213 DOMUI* dom_ui_; |
| 203 | 214 |
| 204 private: | 215 private: |
| 205 DISALLOW_COPY_AND_ASSIGN(DOMMessageHandler); | 216 DISALLOW_COPY_AND_ASSIGN(DOMMessageHandler); |
| 206 }; | 217 }; |
| 207 | 218 |
| 208 #endif // CHROME_BROWSER_DOM_UI_DOM_UI_H_ | 219 #endif // CHROME_BROWSER_DOM_UI_DOM_UI_H_ |
| OLD | NEW |