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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 20 matching lines...) Expand all Loading... |
31 class BrowserContext; | 31 class BrowserContext; |
32 class ColorChooser; | 32 class ColorChooser; |
33 class DownloadItem; | 33 class DownloadItem; |
34 class JavaScriptDialogCreator; | 34 class JavaScriptDialogCreator; |
35 class RenderViewHost; | 35 class RenderViewHost; |
36 class WebContents; | 36 class WebContents; |
37 class WebIntentsDispatcher; | 37 class WebIntentsDispatcher; |
38 struct ContextMenuParams; | 38 struct ContextMenuParams; |
39 struct FileChooserParams; | 39 struct FileChooserParams; |
40 struct NativeWebKeyboardEvent; | 40 struct NativeWebKeyboardEvent; |
| 41 struct Referrer; |
41 struct SSLStatus; | 42 struct SSLStatus; |
42 } | 43 } |
43 | 44 |
44 namespace gfx { | 45 namespace gfx { |
45 class Point; | 46 class Point; |
46 class Rect; | 47 class Rect; |
47 class Size; | 48 class Size; |
48 } | 49 } |
49 | 50 |
50 namespace history { | 51 namespace history { |
(...skipping 20 matching lines...) Expand all Loading... |
71 // should be opened in a new tab or window. | 72 // should be opened in a new tab or window. |
72 // | 73 // |
73 // A NULL source indicates the current tab (callers should probably use | 74 // A NULL source indicates the current tab (callers should probably use |
74 // OpenURL() for these cases which does it for you). | 75 // OpenURL() for these cases which does it for you). |
75 | 76 |
76 // Returns the WebContents the URL is opened in, or NULL if the URL wasn't | 77 // Returns the WebContents the URL is opened in, or NULL if the URL wasn't |
77 // opened immediately. | 78 // opened immediately. |
78 virtual WebContents* OpenURLFromTab(WebContents* source, | 79 virtual WebContents* OpenURLFromTab(WebContents* source, |
79 const OpenURLParams& params); | 80 const OpenURLParams& params); |
80 | 81 |
| 82 // Called for top-level navigation to decide whether the navigation should be |
| 83 // allowed to proceed. |
| 84 virtual bool ShouldIgnoreNavigation( |
| 85 WebContents* source, |
| 86 const GURL& validated_url, |
| 87 const content::Referrer& referrer, |
| 88 bool is_content_initiated); |
| 89 |
81 // Called to inform the delegate that the WebContents's navigation state | 90 // Called to inform the delegate that the WebContents's navigation state |
82 // changed. The |changed_flags| indicates the parts of the navigation state | 91 // changed. The |changed_flags| indicates the parts of the navigation state |
83 // that have been updated, and is any combination of the | 92 // that have been updated, and is any combination of the |
84 // |WebContents::InvalidateTypes| bits. | 93 // |WebContents::InvalidateTypes| bits. |
85 virtual void NavigationStateChanged(const WebContents* source, | 94 virtual void NavigationStateChanged(const WebContents* source, |
86 unsigned changed_flags) {} | 95 unsigned changed_flags) {} |
87 | 96 |
88 // Adds the navigation request headers to |headers|. Use | 97 // Adds the navigation request headers to |headers|. Use |
89 // net::HttpUtil::AppendHeaderIfMissing to build the set of headers. | 98 // net::HttpUtil::AppendHeaderIfMissing to build the set of headers. |
90 virtual void AddNavigationHeaders(const GURL& url, std::string* headers) {} | 99 virtual void AddNavigationHeaders(const GURL& url, std::string* headers) {} |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 // Called when |this| is no longer the WebContentsDelegate for |source|. | 434 // Called when |this| is no longer the WebContentsDelegate for |source|. |
426 void Detach(WebContents* source); | 435 void Detach(WebContents* source); |
427 | 436 |
428 // The WebContents that this is currently a delegate for. | 437 // The WebContents that this is currently a delegate for. |
429 std::set<WebContents*> attached_contents_; | 438 std::set<WebContents*> attached_contents_; |
430 }; | 439 }; |
431 | 440 |
432 } // namespace content | 441 } // namespace content |
433 | 442 |
434 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_DELEGATE_H_ | 443 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_DELEGATE_H_ |
OLD | NEW |