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_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 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/callback_forward.h" | 9 #include "base/callback_forward.h" |
10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
11 #include "base/string16.h" | 11 #include "base/string16.h" |
12 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
| 13 #include "content/public/browser/navigation_controller.h" |
13 #include "content/public/browser/page_navigator.h" | 14 #include "content/public/browser/page_navigator.h" |
14 #include "content/public/browser/save_page_type.h" | 15 #include "content/public/browser/save_page_type.h" |
15 #include "content/public/browser/web_ui.h" | 16 #include "content/public/browser/web_ui.h" |
16 #include "third_party/skia/include/core/SkColor.h" | 17 #include "third_party/skia/include/core/SkColor.h" |
17 #include "ui/gfx/native_widget_types.h" | 18 #include "ui/gfx/native_widget_types.h" |
18 #include "webkit/glue/window_open_disposition.h" | 19 #include "webkit/glue/window_open_disposition.h" |
19 | 20 |
20 namespace base { | 21 namespace base { |
21 class PropertyBag; | 22 class PropertyBag; |
22 class TimeTicks; | 23 class TimeTicks; |
23 } | 24 } |
24 | 25 |
25 namespace gfx { | 26 namespace gfx { |
26 class Rect; | 27 class Rect; |
27 class Size; | 28 class Size; |
28 } | 29 } |
29 | 30 |
30 namespace net { | 31 namespace net { |
31 struct LoadStateWithParam; | 32 struct LoadStateWithParam; |
32 } | 33 } |
33 | 34 |
34 namespace content { | 35 namespace content { |
35 | 36 |
36 class BrowserContext; | 37 class BrowserContext; |
37 class InterstitialPage; | 38 class InterstitialPage; |
38 class NavigationController; | |
39 class RenderProcessHost; | 39 class RenderProcessHost; |
40 class RenderViewHost; | 40 class RenderViewHost; |
41 class RenderWidgetHostView; | 41 class RenderWidgetHostView; |
42 class SessionStorageNamespace; | |
43 class SiteInstance; | 42 class SiteInstance; |
44 class WebContentsDelegate; | 43 class WebContentsDelegate; |
45 class WebContentsView; | 44 class WebContentsView; |
46 struct RendererPreferences; | 45 struct RendererPreferences; |
47 | 46 |
48 // Describes what goes in the main content area of a tab. | 47 // Describes what goes in the main content area of a tab. |
49 class WebContents : public PageNavigator { | 48 class WebContents : public PageNavigator { |
50 public: | 49 public: |
51 // |base_web_contents| is used if we want to size the new WebContents's view | 50 // |base_web_contents| is used if we want to size the new WebContents's view |
52 // based on the view of an existing WebContents. This can be NULL if not | 51 // based on the view of an existing WebContents. This can be NULL if not |
53 // needed. | 52 // needed. |
54 // | |
55 // The session storage namespace parameter allows multiple render views and | |
56 // web contentses to share the same session storage (part of the WebStorage | |
57 // spec) space. This is useful when restoring tabs, but most callers should | |
58 // pass in NULL which will cause a new SessionStorageNamespace to be created. | |
59 CONTENT_EXPORT static WebContents* Create( | 53 CONTENT_EXPORT static WebContents* Create( |
60 BrowserContext* browser_context, | 54 BrowserContext* browser_context, |
61 SiteInstance* site_instance, | 55 SiteInstance* site_instance, |
62 int routing_id, | 56 int routing_id, |
| 57 const WebContents* base_web_contents); |
| 58 |
| 59 // Similar to Create() above but should be used when you need to prepopulate |
| 60 // the SessionStorageNamespaceMap of the WebContents. This can happen if |
| 61 // you duplicate a WebContents, try to reconstitute it from a saved state, |
| 62 // or when you create a new WebContents based on another one (eg., when |
| 63 // servicing a window.open() call). |
| 64 // |
| 65 // You do not want to call this. If you think you do, make sure you completely |
| 66 // understand when SessionStorageNamespace objects should be cloned, why |
| 67 // they should not be shared by multiple WebContents, and what bad things |
| 68 // can happen if you share the object. |
| 69 CONTENT_EXPORT static WebContents* CreateWithSessionStorage( |
| 70 BrowserContext* browser_context, |
| 71 SiteInstance* site_instance, |
| 72 int routing_id, |
63 const WebContents* base_web_contents, | 73 const WebContents* base_web_contents, |
64 SessionStorageNamespace* session_storage_namespace); | 74 const SessionStorageNamespaceMap& session_storage_namespace_map); |
65 | 75 |
66 // Returns a WebContents that wraps the RenderViewHost, or NULL if the | 76 // Returns a WebContents that wraps the RenderViewHost, or NULL if the |
67 // render view host's delegate isn't a WebContents. | 77 // render view host's delegate isn't a WebContents. |
68 CONTENT_EXPORT static WebContents* FromRenderViewHost( | 78 CONTENT_EXPORT static WebContents* FromRenderViewHost( |
69 const RenderViewHost* rvh); | 79 const RenderViewHost* rvh); |
70 | 80 |
71 virtual ~WebContents() {} | 81 virtual ~WebContents() {} |
72 | 82 |
73 // Intrinsic tab state ------------------------------------------------------- | 83 // Intrinsic tab state ------------------------------------------------------- |
74 | 84 |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 // Focuses the location bar. | 388 // Focuses the location bar. |
379 virtual void SetFocusToLocationBar(bool select_all) = 0; | 389 virtual void SetFocusToLocationBar(bool select_all) = 0; |
380 | 390 |
381 // Does this have an opener associated with it? | 391 // Does this have an opener associated with it? |
382 virtual bool HasOpener() const = 0; | 392 virtual bool HasOpener() const = 0; |
383 }; | 393 }; |
384 | 394 |
385 } // namespace content | 395 } // namespace content |
386 | 396 |
387 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_H_ | 397 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_H_ |
OLD | NEW |