| 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 #ifndef CONTENT_PUBLIC_BROWSER_WEB_UI_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_WEB_UI_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_WEB_UI_H_ | 6 #define CONTENT_PUBLIC_BROWSER_WEB_UI_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 // An opaque identifier used to identify a WebUI. This can only be compared to | 34 // An opaque identifier used to identify a WebUI. This can only be compared to |
| 35 // kNoWebUI or other WebUI types. See GetWebUIType. | 35 // kNoWebUI or other WebUI types. See GetWebUIType. |
| 36 typedef void* TypeID; | 36 typedef void* TypeID; |
| 37 | 37 |
| 38 // A special WebUI type that signifies that a given page would not use the | 38 // A special WebUI type that signifies that a given page would not use the |
| 39 // Web UI system. | 39 // Web UI system. |
| 40 static const TypeID kNoWebUI; | 40 static const TypeID kNoWebUI; |
| 41 | 41 |
| 42 // Returns JavaScript code that, when executed, calls the function specified | 42 // Returns JavaScript code that, when executed, calls the function specified |
| 43 // by |function_name| with the arguments specified in |arg_list|. | 43 // by |function_name| with the arguments specified in |arg_list|. |
| 44 static string16 GetJavascriptCall( | 44 static base::string16 GetJavascriptCall( |
| 45 const std::string& function_name, | 45 const std::string& function_name, |
| 46 const std::vector<const base::Value*>& arg_list); | 46 const std::vector<const base::Value*>& arg_list); |
| 47 | 47 |
| 48 virtual ~WebUI() {} | 48 virtual ~WebUI() {} |
| 49 | 49 |
| 50 virtual WebContents* GetWebContents() const = 0; | 50 virtual WebContents* GetWebContents() const = 0; |
| 51 | 51 |
| 52 virtual WebUIController* GetController() const = 0; | 52 virtual WebUIController* GetController() const = 0; |
| 53 virtual void SetController(WebUIController* controller) = 0; | 53 virtual void SetController(WebUIController* controller) = 0; |
| 54 | 54 |
| 55 // Returns the device scale factor of the monitor that the renderer is on. | 55 // Returns the device scale factor of the monitor that the renderer is on. |
| 56 // Whenever possible, WebUI should push resources with this scale factor to | 56 // Whenever possible, WebUI should push resources with this scale factor to |
| 57 // Javascript. | 57 // Javascript. |
| 58 virtual ui::ScaleFactor GetDeviceScaleFactor() const = 0; | 58 virtual ui::ScaleFactor GetDeviceScaleFactor() const = 0; |
| 59 | 59 |
| 60 // Gets a custom tab title provided by the Web UI. If there is no title | 60 // Gets a custom tab title provided by the Web UI. If there is no title |
| 61 // override, the string will be empty which should trigger the default title | 61 // override, the string will be empty which should trigger the default title |
| 62 // behavior for the tab. | 62 // behavior for the tab. |
| 63 virtual const string16& GetOverriddenTitle() const = 0; | 63 virtual const base::string16& GetOverriddenTitle() const = 0; |
| 64 virtual void OverrideTitle(const string16& title) = 0; | 64 virtual void OverrideTitle(const base::string16& title) = 0; |
| 65 | 65 |
| 66 // Returns the transition type that should be used for link clicks on this | 66 // Returns the transition type that should be used for link clicks on this |
| 67 // Web UI. This will default to LINK but may be overridden. | 67 // Web UI. This will default to LINK but may be overridden. |
| 68 virtual PageTransition GetLinkTransitionType() const = 0; | 68 virtual PageTransition GetLinkTransitionType() const = 0; |
| 69 virtual void SetLinkTransitionType(PageTransition type) = 0; | 69 virtual void SetLinkTransitionType(PageTransition type) = 0; |
| 70 | 70 |
| 71 // Allows a controller to override the BindingsPolicy that should be enabled | 71 // Allows a controller to override the BindingsPolicy that should be enabled |
| 72 // for this page. | 72 // for this page. |
| 73 virtual int GetBindings() const = 0; | 73 virtual int GetBindings() const = 0; |
| 74 virtual void SetBindings(int bindings) = 0; | 74 virtual void SetBindings(int bindings) = 0; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 const base::Value& arg3, | 114 const base::Value& arg3, |
| 115 const base::Value& arg4) = 0; | 115 const base::Value& arg4) = 0; |
| 116 virtual void CallJavascriptFunction( | 116 virtual void CallJavascriptFunction( |
| 117 const std::string& function_name, | 117 const std::string& function_name, |
| 118 const std::vector<const base::Value*>& args) = 0; | 118 const std::vector<const base::Value*>& args) = 0; |
| 119 }; | 119 }; |
| 120 | 120 |
| 121 } // namespace content | 121 } // namespace content |
| 122 | 122 |
| 123 #endif // CONTENT_PUBLIC_BROWSER_WEB_UI_H_ | 123 #endif // CONTENT_PUBLIC_BROWSER_WEB_UI_H_ |
| OLD | NEW |