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_CONTENTS_DELEGATE_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_DELEGATE_H_ |
6 #define CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_DELEGATE_H_ | 6 #define CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_DELEGATE_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 // Invoked prior to showing before unload handler confirmation dialog. | 171 // Invoked prior to showing before unload handler confirmation dialog. |
172 virtual void WillRunBeforeUnloadConfirm() {} | 172 virtual void WillRunBeforeUnloadConfirm() {} |
173 | 173 |
174 // Returns true if javascript dialogs and unload alerts are suppressed. | 174 // Returns true if javascript dialogs and unload alerts are suppressed. |
175 // Default is false. | 175 // Default is false. |
176 virtual bool ShouldSuppressDialogs(); | 176 virtual bool ShouldSuppressDialogs(); |
177 | 177 |
178 // Add a message to the console. Returning true indicates that the delegate | 178 // Add a message to the console. Returning true indicates that the delegate |
179 // handled the message. If false is returned the default logging mechanism | 179 // handled the message. If false is returned the default logging mechanism |
180 // will be used for the message. | 180 // will be used for the message. |
181 virtual bool AddMessageToConsole(WebContents* soruce, | 181 virtual bool AddMessageToConsole(WebContents* source, |
182 int32 level, | 182 int32 level, |
183 const string16& message, | 183 const string16& message, |
184 int32 line_no, | 184 int32 line_no, |
185 const string16& source_id); | 185 const string16& source_id); |
186 | 186 |
187 // Tells us that we've finished firing this tab's beforeunload event. | 187 // Tells us that we've finished firing this tab's beforeunload event. |
188 // The proceed bool tells us whether the user chose to proceed closing the | 188 // The proceed bool tells us whether the user chose to proceed closing the |
189 // tab. Returns true if the tab can continue on firing its unload event. | 189 // tab. Returns true if the tab can continue on firing its unload event. |
190 // If we're closing the entire browser, then we'll want to delay firing | 190 // If we're closing the entire browser, then we'll want to delay firing |
191 // unload events until all the beforeunload events have fired. | 191 // unload events until all the beforeunload events have fired. |
192 virtual void BeforeUnloadFired(WebContents* tab, | 192 virtual void BeforeUnloadFired(WebContents* tab, |
193 bool proceed, | 193 bool proceed, |
194 bool* proceed_to_fire_unload); | 194 bool* proceed_to_fire_unload); |
195 | 195 |
| 196 // Returns true if the location bar should be focused by default rather than |
| 197 // the page contents. |
| 198 virtual bool ShouldFocusLocationBarByDefault(WebContents* source); |
| 199 |
196 // Sets focus to the location bar or some other place that is appropriate. | 200 // Sets focus to the location bar or some other place that is appropriate. |
197 // This is called when the tab wants to encourage user input, like for the | 201 // This is called when the tab wants to encourage user input, like for the |
198 // new tab page. | 202 // new tab page. |
199 virtual void SetFocusToLocationBar(bool select_all) {} | 203 virtual void SetFocusToLocationBar(bool select_all) {} |
200 | 204 |
201 // Returns whether the page should be focused when transitioning from crashed | 205 // Returns whether the page should be focused when transitioning from crashed |
202 // to live. Default is true. | 206 // to live. Default is true. |
203 virtual bool ShouldFocusPageAfterCrash(); | 207 virtual bool ShouldFocusPageAfterCrash(); |
204 | 208 |
205 // Called when a popup select is about to be displayed. The delegate can use | 209 // Called when a popup select is about to be displayed. The delegate can use |
206 // this to disable inactive rendering for the frame in the window the select | 210 // this to disable inactive rendering for the frame in the window the select |
207 // is opened within if necessary. | 211 // is opened within if necessary. |
208 virtual void RenderWidgetShowing() {} | 212 virtual void RenderWidgetShowing() {} |
209 | 213 |
210 // This is called when WebKit tells us that it is done tabbing through | 214 // This is called when WebKit tells us that it is done tabbing through |
211 // controls on the page. Provides a way for WebContentsDelegates to handle | 215 // controls on the page. Provides a way for WebContentsDelegates to handle |
212 // this. Returns true if the delegate successfully handled it. | 216 // this. Returns true if the delegate successfully handled it. |
213 virtual bool TakeFocus(WebContents* soruce, | 217 virtual bool TakeFocus(WebContents* source, |
214 bool reverse); | 218 bool reverse); |
215 | 219 |
216 // Invoked when the page loses mouse capture. | 220 // Invoked when the page loses mouse capture. |
217 virtual void LostCapture() {} | 221 virtual void LostCapture() {} |
218 | 222 |
219 // Notification that |contents| has gained focus. | 223 // Notification that |contents| has gained focus. |
220 virtual void WebContentsFocused(WebContents* contents) {} | 224 virtual void WebContentsFocused(WebContents* contents) {} |
221 | 225 |
222 // Asks the delegate if the given tab can download. | 226 // Asks the delegate if the given tab can download. |
223 virtual bool CanDownload(RenderViewHost* render_view_host, | 227 virtual bool CanDownload(RenderViewHost* render_view_host, |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 // Called when |this| is no longer the WebContentsDelegate for |source|. | 448 // Called when |this| is no longer the WebContentsDelegate for |source|. |
445 void Detach(WebContents* source); | 449 void Detach(WebContents* source); |
446 | 450 |
447 // The WebContents that this is currently a delegate for. | 451 // The WebContents that this is currently a delegate for. |
448 std::set<WebContents*> attached_contents_; | 452 std::set<WebContents*> attached_contents_; |
449 }; | 453 }; |
450 | 454 |
451 } // namespace content | 455 } // namespace content |
452 | 456 |
453 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_DELEGATE_H_ | 457 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_DELEGATE_H_ |
OLD | NEW |