OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_H_ |
6 #define CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_H_ | 6 #define CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
| 9 #include "base/basictypes.h" |
| 10 #include "base/process_util.h" |
9 #include "base/string16.h" | 11 #include "base/string16.h" |
10 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
11 | 13 |
12 class NavigationController; | 14 class NavigationController; |
13 class RenderViewHost; | 15 class RenderViewHost; |
| 16 class RenderViewHostManager; |
14 class RenderWidgetHostView; | 17 class RenderWidgetHostView; |
| 18 class SiteInstance; |
15 // TODO(jam): of course we will have to rename TabContentsView etc to use | 19 // TODO(jam): of course we will have to rename TabContentsView etc to use |
16 // WebContents. | 20 // WebContents. |
17 class TabContentsView; | 21 class TabContentsView; |
| 22 class WebUI; |
18 | 23 |
19 namespace base { | 24 namespace base { |
20 class PropertyBag; | 25 class PropertyBag; |
| 26 class TimeTicks; |
| 27 } |
| 28 |
| 29 namespace net { |
| 30 struct LoadStateWithParam; |
21 } | 31 } |
22 | 32 |
23 namespace content { | 33 namespace content { |
24 | 34 |
25 class BrowserContext; | 35 class BrowserContext; |
26 class RenderProcessHost; | 36 class RenderProcessHost; |
27 class WebContentsDelegate; | 37 class WebContentsDelegate; |
28 | 38 |
29 // Describes what goes in the main content area of a tab. | 39 // Describes what goes in the main content area of a tab. |
30 class WebContents { | 40 class WebContents { |
(...skipping 27 matching lines...) Expand all Loading... |
58 | 68 |
59 // Gets the current RenderViewHost for this tab. | 69 // Gets the current RenderViewHost for this tab. |
60 virtual RenderViewHost* GetRenderViewHost() const = 0; | 70 virtual RenderViewHost* GetRenderViewHost() const = 0; |
61 | 71 |
62 // Returns the currently active RenderWidgetHostView. This may change over | 72 // Returns the currently active RenderWidgetHostView. This may change over |
63 // time and can be NULL (during setup and teardown). | 73 // time and can be NULL (during setup and teardown). |
64 virtual RenderWidgetHostView* GetRenderWidgetHostView() const = 0; | 74 virtual RenderWidgetHostView* GetRenderWidgetHostView() const = 0; |
65 | 75 |
66 // The TabContentsView will never change and is guaranteed non-NULL. | 76 // The TabContentsView will never change and is guaranteed non-NULL. |
67 virtual TabContentsView* GetView() const = 0; | 77 virtual TabContentsView* GetView() const = 0; |
| 78 |
| 79 // Returns the committed WebUI if one exists, otherwise the pending one. |
| 80 // Callers who want to use the pending WebUI for the pending navigation entry |
| 81 // should use GetWebUIForCurrentState instead. |
| 82 virtual WebUI* GetWebUI() const = 0; |
| 83 virtual WebUI* GetCommittedWebUI() const = 0; |
| 84 |
| 85 // Tab navigation state ------------------------------------------------------ |
| 86 |
| 87 // Returns the current navigation properties, which if a navigation is |
| 88 // pending may be provisional (e.g., the navigation could result in a |
| 89 // download, in which case the URL would revert to what it was previously). |
| 90 virtual const string16& GetTitle() const = 0; |
| 91 |
| 92 // The max page ID for any page that the current SiteInstance has loaded in |
| 93 // this TabContents. Page IDs are specific to a given SiteInstance and |
| 94 // TabContents, corresponding to a specific RenderView in the renderer. |
| 95 // Page IDs increase with each new page that is loaded by a tab. |
| 96 virtual int32 GetMaxPageID() = 0; |
| 97 |
| 98 // The max page ID for any page that the given SiteInstance has loaded in |
| 99 // this TabContents. |
| 100 virtual int32 GetMaxPageIDForSiteInstance(SiteInstance* site_instance) = 0; |
| 101 |
| 102 // Returns the SiteInstance associated with the current page. |
| 103 virtual SiteInstance* GetSiteInstance() const = 0; |
| 104 |
| 105 // Returns the SiteInstance for the pending navigation, if any. Otherwise |
| 106 // returns the current SiteInstance. |
| 107 virtual SiteInstance* GetPendingSiteInstance() const = 0; |
| 108 |
| 109 // Return whether this tab contents is loading a resource. |
| 110 virtual bool IsLoading() const = 0; |
| 111 |
| 112 // Returns whether this tab contents is waiting for a first-response for the |
| 113 // main resource of the page. |
| 114 virtual bool IsWaitingForResponse() const = 0; |
| 115 |
| 116 // Return the current load state and the URL associated with it. |
| 117 virtual const net::LoadStateWithParam& GetLoadState() const = 0; |
| 118 virtual const string16& GetLoadStateHost() const = 0; |
| 119 |
| 120 // Return the upload progress. |
| 121 virtual uint64 GetUploadSize() const = 0; |
| 122 virtual uint64 GetUploadPosition() const = 0; |
| 123 |
| 124 // Return the character encoding of the page. |
| 125 virtual const std::string& GetEncoding() const = 0; |
| 126 |
| 127 // True if this is a secure page which displayed insecure content. |
| 128 virtual bool DisplayedInsecureContent() const = 0; |
| 129 |
| 130 // Internal state ------------------------------------------------------------ |
| 131 |
| 132 // This flag indicates whether the tab contents is currently being |
| 133 // screenshotted by the DraggedTabController. |
| 134 virtual void SetCapturingContents(bool cap) = 0; |
| 135 |
| 136 // Indicates whether this tab should be considered crashed. The setter will |
| 137 // also notify the delegate when the flag is changed. |
| 138 virtual bool IsCrashed() const = 0; |
| 139 virtual void SetIsCrashed(base::TerminationStatus status, int error_code) = 0; |
| 140 |
| 141 virtual base::TerminationStatus GetCrashedStatus() const = 0; |
| 142 |
| 143 // Whether the tab is in the process of being destroyed. |
| 144 // Added as a tentative work-around for focus related bug #4633. This allows |
| 145 // us not to store focus when a tab is being closed. |
| 146 virtual bool IsBeingDestroyed() const = 0; |
| 147 |
| 148 // Convenience method for notifying the delegate of a navigation state |
| 149 // change. See WebContentsDelegate. |
| 150 virtual void NotifyNavigationStateChanged(unsigned changed_flags) = 0; |
| 151 |
| 152 // Invoked when the tab contents becomes selected. If you override, be sure |
| 153 // and invoke super's implementation. |
| 154 virtual void DidBecomeSelected() = 0; |
| 155 virtual base::TimeTicks GetLastSelectedTime() const = 0; |
| 156 |
| 157 // Invoked when the tab contents becomes hidden. |
| 158 // NOTE: If you override this, call the superclass version too! |
| 159 virtual void WasHidden() = 0; |
| 160 |
| 161 // TODO(brettw) document these. |
| 162 virtual void ShowContents() = 0; |
| 163 virtual void HideContents() = 0; |
| 164 |
| 165 // Returns true if the before unload and unload listeners need to be |
| 166 // fired. The value of this changes over time. For example, if true and the |
| 167 // before unload listener is executed and allows the user to exit, then this |
| 168 // returns false. |
| 169 virtual bool NeedToFireBeforeUnload() = 0; |
| 170 |
| 171 // Expose the render manager for testing. |
| 172 virtual RenderViewHostManager* GetRenderManagerForTesting() = 0; |
68 }; | 173 }; |
69 | 174 |
70 } // namespace content | 175 } // namespace content |
71 | 176 |
72 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_H_ | 177 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_H_ |
OLD | NEW |