Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: chrome/browser/dom_ui/dom_ui.h

Issue 126137: Part 1 of merging Extensions and DOMUI (Closed)
Patch Set: add test and rebase Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/browser.cc ('k') | chrome/browser/dom_ui/dom_ui.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_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 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 14 matching lines...) Expand all
25 // A DOMUI sets up the datasources and message handlers for a given HTML-based 25 // A DOMUI sets up the datasources and message handlers for a given HTML-based
26 // UI. It is contained by a DOMUIManager. 26 // UI. It is contained by a DOMUIManager.
27 class DOMUI { 27 class DOMUI {
28 public: 28 public:
29 explicit DOMUI(TabContents* contents); 29 explicit DOMUI(TabContents* contents);
30 virtual ~DOMUI(); 30 virtual ~DOMUI();
31 31
32 virtual void RenderViewCreated(RenderViewHost* render_view_host) {} 32 virtual void RenderViewCreated(RenderViewHost* render_view_host) {}
33 33
34 // Called from DOMUIContents. 34 // Called from DOMUIContents.
35 void ProcessDOMUIMessage(const std::string& message, 35 virtual void ProcessDOMUIMessage(const std::string& message,
36 const std::string& content); 36 const std::string& content,
37 int request_id,
38 bool has_callback);
37 39
38 // Used by DOMMessageHandlers. 40 // Used by DOMMessageHandlers.
39 typedef Callback1<const Value*>::Type MessageCallback; 41 typedef Callback1<const Value*>::Type MessageCallback;
40 void RegisterMessageCallback(const std::string& message, 42 void RegisterMessageCallback(const std::string& message,
41 MessageCallback* callback); 43 MessageCallback* callback);
42 44
43 // Returns true if the favicon should be hidden for the current tab. 45 // Returns true if the favicon should be hidden for the current tab.
44 bool hide_favicon() const { 46 bool hide_favicon() const {
45 return hide_favicon_; 47 return hide_favicon_;
46 } 48 }
(...skipping 23 matching lines...) Expand all
70 const string16& overridden_title() const { 72 const string16& overridden_title() const {
71 return overridden_title_; 73 return overridden_title_;
72 } 74 }
73 75
74 // Returns the transition type that should be used for link clicks on this 76 // Returns the transition type that should be used for link clicks on this
75 // DOM UI. This will default to LINK but may be overridden. 77 // DOM UI. This will default to LINK but may be overridden.
76 const PageTransition::Type link_transition_type() const { 78 const PageTransition::Type link_transition_type() const {
77 return link_transition_type_; 79 return link_transition_type_;
78 } 80 }
79 81
82 const int bindings() const {
83 return bindings_;
84 }
85
80 // Call a Javascript function by sending its name and arguments down to 86 // Call a Javascript function by sending its name and arguments down to
81 // the renderer. This is asynchronous; there's no way to get the result 87 // the renderer. This is asynchronous; there's no way to get the result
82 // of the call, and should be thought of more like sending a message to 88 // of the call, and should be thought of more like sending a message to
83 // the page. 89 // the page.
84 // There are two function variants for one-arg and two-arg calls. 90 // There are two function variants for one-arg and two-arg calls.
85 void CallJavascriptFunction(const std::wstring& function_name); 91 void CallJavascriptFunction(const std::wstring& function_name);
86 void CallJavascriptFunction(const std::wstring& function_name, 92 void CallJavascriptFunction(const std::wstring& function_name,
87 const Value& arg); 93 const Value& arg);
88 void CallJavascriptFunction(const std::wstring& function_name, 94 void CallJavascriptFunction(const std::wstring& function_name,
89 const Value& arg1, 95 const Value& arg1,
90 const Value& arg2); 96 const Value& arg2);
91 97
92 ThemeProvider* GetThemeProvider() const; 98 ThemeProvider* GetThemeProvider() const;
93 99
94 TabContents* tab_contents() { return tab_contents_; } 100 TabContents* tab_contents() { return tab_contents_; }
95 101
96 Profile* GetProfile(); 102 Profile* GetProfile();
97 103
98 protected: 104 protected:
99 void AddMessageHandler(DOMMessageHandler* handler); 105 void AddMessageHandler(DOMMessageHandler* handler);
100 106
101 // Options that may be overridden by individual DOM UI implementations. The 107 // Options that may be overridden by individual DOM UI implementations. The
102 // bool options default to false. See the public getters for more information. 108 // bool options default to false. See the public getters for more information.
103 bool hide_favicon_; 109 bool hide_favicon_;
104 bool force_bookmark_bar_visible_; 110 bool force_bookmark_bar_visible_;
105 bool focus_location_bar_by_default_; 111 bool focus_location_bar_by_default_;
106 bool should_hide_url_; 112 bool should_hide_url_;
107 string16 overridden_title_; // Defaults to empty string. 113 string16 overridden_title_; // Defaults to empty string.
108 PageTransition::Type link_transition_type_; // Defaults to LINK. 114 PageTransition::Type link_transition_type_; // Defaults to LINK.
115 int bindings_; // The bindings from BindingsPolicy that should be enabled for
116 // this page.
109 117
110 private: 118 private:
111 // Execute a string of raw Javascript on the page. 119 // Execute a string of raw Javascript on the page.
112 void ExecuteJavascript(const std::wstring& javascript); 120 void ExecuteJavascript(const std::wstring& javascript);
113 121
114 // Non-owning pointer to the TabContents this DOMUI is associated with. 122 // Non-owning pointer to the TabContents this DOMUI is associated with.
115 TabContents* tab_contents_; 123 TabContents* tab_contents_;
116 124
117 // The DOMMessageHandlers we own. 125 // The DOMMessageHandlers we own.
118 std::vector<DOMMessageHandler*> handlers_; 126 std::vector<DOMMessageHandler*> handlers_;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 // Extract a string value from a Value. 160 // Extract a string value from a Value.
153 std::wstring ExtractStringValue(const Value* value); 161 std::wstring ExtractStringValue(const Value* value);
154 162
155 DOMUI* dom_ui_; 163 DOMUI* dom_ui_;
156 164
157 private: 165 private:
158 DISALLOW_COPY_AND_ASSIGN(DOMMessageHandler); 166 DISALLOW_COPY_AND_ASSIGN(DOMMessageHandler);
159 }; 167 };
160 168
161 #endif // CHROME_BROWSER_DOM_UI_DOM_UI_H_ 169 #endif // CHROME_BROWSER_DOM_UI_DOM_UI_H_
OLDNEW
« no previous file with comments | « chrome/browser/browser.cc ('k') | chrome/browser/dom_ui/dom_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698