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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 | 175 |
176 // Returns true if javascript dialogs and unload alerts are suppressed. | 176 // Returns true if javascript dialogs and unload alerts are suppressed. |
177 // Default is false. | 177 // Default is false. |
178 virtual bool ShouldSuppressDialogs(); | 178 virtual bool ShouldSuppressDialogs(); |
179 | 179 |
180 // Add a message to the console. Returning true indicates that the delegate | 180 // Add a message to the console. Returning true indicates that the delegate |
181 // handled the message. If false is returned the default logging mechanism | 181 // handled the message. If false is returned the default logging mechanism |
182 // will be used for the message. | 182 // will be used for the message. |
183 virtual bool AddMessageToConsole(WebContents* source, | 183 virtual bool AddMessageToConsole(WebContents* source, |
184 int32 level, | 184 int32 level, |
185 const string16& message, | 185 const base::string16& message, |
186 int32 line_no, | 186 int32 line_no, |
187 const string16& source_id); | 187 const base::string16& source_id); |
188 | 188 |
189 // Tells us that we've finished firing this tab's beforeunload event. | 189 // Tells us that we've finished firing this tab's beforeunload event. |
190 // The proceed bool tells us whether the user chose to proceed closing the | 190 // The proceed bool tells us whether the user chose to proceed closing the |
191 // tab. Returns true if the tab can continue on firing its unload event. | 191 // tab. Returns true if the tab can continue on firing its unload event. |
192 // If we're closing the entire browser, then we'll want to delay firing | 192 // If we're closing the entire browser, then we'll want to delay firing |
193 // unload events until all the beforeunload events have fired. | 193 // unload events until all the beforeunload events have fired. |
194 virtual void BeforeUnloadFired(WebContents* tab, | 194 virtual void BeforeUnloadFired(WebContents* tab, |
195 bool proceed, | 195 bool proceed, |
196 bool* proceed_to_fire_unload); | 196 bool* proceed_to_fire_unload); |
197 | 197 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 // Returns true to allow WebContents to continue with the default processing. | 291 // Returns true to allow WebContents to continue with the default processing. |
292 virtual bool OnGoToEntryOffset(int offset); | 292 virtual bool OnGoToEntryOffset(int offset); |
293 | 293 |
294 // Allows delegate to control whether a WebContents will be created. Returns | 294 // Allows delegate to control whether a WebContents will be created. Returns |
295 // true to allow the creation. Default is to allow it. In cases where the | 295 // true to allow the creation. Default is to allow it. In cases where the |
296 // delegate handles the creation/navigation itself, it will use |target_url|. | 296 // delegate handles the creation/navigation itself, it will use |target_url|. |
297 virtual bool ShouldCreateWebContents( | 297 virtual bool ShouldCreateWebContents( |
298 WebContents* web_contents, | 298 WebContents* web_contents, |
299 int route_id, | 299 int route_id, |
300 WindowContainerType window_container_type, | 300 WindowContainerType window_container_type, |
301 const string16& frame_name, | 301 const base::string16& frame_name, |
302 const GURL& target_url, | 302 const GURL& target_url, |
303 const std::string& partition_id, | 303 const std::string& partition_id, |
304 SessionStorageNamespace* session_storage_namespace); | 304 SessionStorageNamespace* session_storage_namespace); |
305 | 305 |
306 // Notifies the delegate about the creation of a new WebContents. This | 306 // Notifies the delegate about the creation of a new WebContents. This |
307 // typically happens when popups are created. | 307 // typically happens when popups are created. |
308 virtual void WebContentsCreated(WebContents* source_contents, | 308 virtual void WebContentsCreated(WebContents* source_contents, |
309 int64 source_frame_id, | 309 int64 source_frame_id, |
310 const string16& frame_name, | 310 const base::string16& frame_name, |
311 const GURL& target_url, | 311 const GURL& target_url, |
312 WebContents* new_contents) {} | 312 WebContents* new_contents) {} |
313 | 313 |
314 // Notification that the tab is hung. | 314 // Notification that the tab is hung. |
315 virtual void RendererUnresponsive(WebContents* source) {} | 315 virtual void RendererUnresponsive(WebContents* source) {} |
316 | 316 |
317 // Notification that the tab is no longer hung. | 317 // Notification that the tab is no longer hung. |
318 virtual void RendererResponsive(WebContents* source) {} | 318 virtual void RendererResponsive(WebContents* source) {} |
319 | 319 |
320 // Notification that a worker associated with this tab has crashed. | 320 // Notification that a worker associated with this tab has crashed. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 | 364 |
365 // Called when a Javascript out of memory notification is received. | 365 // Called when a Javascript out of memory notification is received. |
366 virtual void JSOutOfMemory(WebContents* web_contents) {} | 366 virtual void JSOutOfMemory(WebContents* web_contents) {} |
367 | 367 |
368 // Register a new handler for URL requests with the given scheme. | 368 // Register a new handler for URL requests with the given scheme. |
369 // |user_gesture| is true if the registration is made in the context of a user | 369 // |user_gesture| is true if the registration is made in the context of a user |
370 // gesture. | 370 // gesture. |
371 virtual void RegisterProtocolHandler(WebContents* web_contents, | 371 virtual void RegisterProtocolHandler(WebContents* web_contents, |
372 const std::string& protocol, | 372 const std::string& protocol, |
373 const GURL& url, | 373 const GURL& url, |
374 const string16& title, | 374 const base::string16& title, |
375 bool user_gesture) {} | 375 bool user_gesture) {} |
376 | 376 |
377 // Result of string search in the page. This includes the number of matches | 377 // Result of string search in the page. This includes the number of matches |
378 // found and the selection rect (in screen coordinates) for the string found. | 378 // found and the selection rect (in screen coordinates) for the string found. |
379 // If |final_update| is false, it indicates that more results follow. | 379 // If |final_update| is false, it indicates that more results follow. |
380 virtual void FindReply(WebContents* web_contents, | 380 virtual void FindReply(WebContents* web_contents, |
381 int request_id, | 381 int request_id, |
382 int number_of_matches, | 382 int number_of_matches, |
383 const gfx::Rect& selection_rect, | 383 const gfx::Rect& selection_rect, |
384 int active_match_ordinal, | 384 int active_match_ordinal, |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 // Called when |this| is no longer the WebContentsDelegate for |source|. | 463 // Called when |this| is no longer the WebContentsDelegate for |source|. |
464 void Detach(WebContents* source); | 464 void Detach(WebContents* source); |
465 | 465 |
466 // The WebContents that this is currently a delegate for. | 466 // The WebContents that this is currently a delegate for. |
467 std::set<WebContents*> attached_contents_; | 467 std::set<WebContents*> attached_contents_; |
468 }; | 468 }; |
469 | 469 |
470 } // namespace content | 470 } // namespace content |
471 | 471 |
472 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_DELEGATE_H_ | 472 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_DELEGATE_H_ |
OLD | NEW |