Chromium Code Reviews| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 88 virtual void NavigationStateChanged(const WebContents* source, | 88 virtual void NavigationStateChanged(const WebContents* source, |
| 89 unsigned changed_flags) {} | 89 unsigned changed_flags) {} |
| 90 | 90 |
| 91 // Adds the navigation request headers to |headers|. Use | 91 // Adds the navigation request headers to |headers|. Use |
| 92 // net::HttpUtil::AppendHeaderIfMissing to build the set of headers. | 92 // net::HttpUtil::AppendHeaderIfMissing to build the set of headers. |
| 93 virtual void AddNavigationHeaders(const GURL& url, std::string* headers) {} | 93 virtual void AddNavigationHeaders(const GURL& url, std::string* headers) {} |
| 94 | 94 |
| 95 // Creates a new tab with the already-created WebContents 'new_contents'. | 95 // Creates a new tab with the already-created WebContents 'new_contents'. |
| 96 // The window for the added contents should be reparented correctly when this | 96 // The window for the added contents should be reparented correctly when this |
| 97 // method returns. If |disposition| is NEW_POPUP, |pos| should hold the | 97 // method returns. If |disposition| is NEW_POPUP, |pos| should hold the |
| 98 // initial position. | 98 // initial position. Returns false if the tab is blocked. |
| 99 virtual void AddNewContents(WebContents* source, | 99 virtual bool AddNewContents(WebContents* source, |
| 100 WebContents* new_contents, | 100 WebContents* new_contents, |
| 101 WindowOpenDisposition disposition, | 101 WindowOpenDisposition disposition, |
| 102 const gfx::Rect& initial_pos, | 102 const gfx::Rect& initial_pos, |
| 103 bool user_gesture) {} | 103 bool user_gesture) { return true; } |
| 104 | 104 |
| 105 // Selects the specified contents, bringing its container to the front. | 105 // Selects the specified contents, bringing its container to the front. |
| 106 virtual void ActivateContents(WebContents* contents) {} | 106 virtual void ActivateContents(WebContents* contents) {} |
| 107 | 107 |
| 108 // Deactivates the specified contents by deactivating its container and | 108 // Deactivates the specified contents by deactivating its container and |
| 109 // potentialy moving it to the back of the Z order. | 109 // potentialy moving it to the back of the Z order. |
| 110 virtual void DeactivateContents(WebContents* contents) {} | 110 virtual void DeactivateContents(WebContents* contents) {} |
| 111 | 111 |
| 112 // Notifies the delegate that this contents is starting or is done loading | 112 // Notifies the delegate that this contents is starting or is done loading |
| 113 // some resource. The delegate should use this notification to represent | 113 // some resource. The delegate should use this notification to represent |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 290 // true to allow the creation. Default is to allow it. In cases where the | 290 // true to allow the creation. Default is to allow it. In cases where the |
| 291 // delegate handles the creation/navigation itself, it will use |target_url|. | 291 // delegate handles the creation/navigation itself, it will use |target_url|. |
| 292 virtual bool ShouldCreateWebContents( | 292 virtual bool ShouldCreateWebContents( |
| 293 WebContents* web_contents, | 293 WebContents* web_contents, |
| 294 int route_id, | 294 int route_id, |
| 295 WindowContainerType window_container_type, | 295 WindowContainerType window_container_type, |
| 296 const string16& frame_name, | 296 const string16& frame_name, |
| 297 const GURL& target_url); | 297 const GURL& target_url); |
| 298 | 298 |
| 299 // Notifies the delegate about the creation of a new WebContents. This | 299 // Notifies the delegate about the creation of a new WebContents. This |
| 300 // typically happens when popups are created. | 300 // typically happens when popups are created. Returns false if the delegate |
| 301 virtual void WebContentsCreated(WebContents* source_contents, | 301 // chooses to block the popup. |
| 302 virtual bool WebContentsCreated(WebContents* source_contents, | |
| 302 int64 source_frame_id, | 303 int64 source_frame_id, |
| 303 const GURL& target_url, | 304 const GURL& target_url, |
| 304 WebContents* new_contents) {} | 305 WebContents* new_contents) { return true; } |
|
jam
2012/08/29 00:07:23
nit: you will get clang errors for this, you need
| |
| 305 | 306 |
| 306 // Notifies the delegate that the content restrictions for this tab has | 307 // Notifies the delegate that the content restrictions for this tab has |
| 307 // changed. | 308 // changed. |
| 308 virtual void ContentRestrictionsChanged(WebContents* source) {} | 309 virtual void ContentRestrictionsChanged(WebContents* source) {} |
| 309 | 310 |
| 310 #if defined(OS_ANDROID) | 311 #if defined(OS_ANDROID) |
| 311 // Returns true if the delegate wants to handle the url instead. Default | 312 // Returns true if the delegate wants to handle the url instead. Default |
| 312 // returns false. | 313 // returns false. |
| 313 virtual bool ShouldOverrideLoading(const GURL& url); | 314 virtual bool ShouldOverrideLoading(const GURL& url); |
| 314 #endif | 315 #endif |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 440 // Called when |this| is no longer the WebContentsDelegate for |source|. | 441 // Called when |this| is no longer the WebContentsDelegate for |source|. |
| 441 void Detach(WebContents* source); | 442 void Detach(WebContents* source); |
| 442 | 443 |
| 443 // The WebContents that this is currently a delegate for. | 444 // The WebContents that this is currently a delegate for. |
| 444 std::set<WebContents*> attached_contents_; | 445 std::set<WebContents*> attached_contents_; |
| 445 }; | 446 }; |
| 446 | 447 |
| 447 } // namespace content | 448 } // namespace content |
| 448 | 449 |
| 449 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_DELEGATE_H_ | 450 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_DELEGATE_H_ |
| OLD | NEW |