| 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_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ | 5 #ifndef CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ |
| 6 #define CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ | 6 #define CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <deque> | 9 #include <deque> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 class SiteInstance; | 43 class SiteInstance; |
| 44 class TabContentsDelegate; | 44 class TabContentsDelegate; |
| 45 class TabContentsObserver; | 45 class TabContentsObserver; |
| 46 class TabContentsView; | 46 class TabContentsView; |
| 47 struct ViewHostMsg_DidFailProvisionalLoadWithError_Params; | 47 struct ViewHostMsg_DidFailProvisionalLoadWithError_Params; |
| 48 | 48 |
| 49 namespace webkit_glue { | 49 namespace webkit_glue { |
| 50 struct WebIntentData; | 50 struct WebIntentData; |
| 51 } | 51 } |
| 52 | 52 |
| 53 namespace content { |
| 54 class ContentFrame; |
| 55 } |
| 56 |
| 53 // Describes what goes in the main content area of a tab. TabContents is | 57 // Describes what goes in the main content area of a tab. TabContents is |
| 54 // the only type of TabContents, and these should be merged together. | 58 // the only type of TabContents, and these should be merged together. |
| 55 class CONTENT_EXPORT TabContents : public PageNavigator, | 59 class CONTENT_EXPORT TabContents : public PageNavigator, |
| 56 public RenderViewHostDelegate, | 60 public RenderViewHostDelegate, |
| 57 public RenderViewHostManager::Delegate, | 61 public RenderViewHostManager::Delegate, |
| 58 public content::JavaScriptDialogDelegate { | 62 public content::JavaScriptDialogDelegate { |
| 59 public: | 63 public: |
| 60 // Flags passed to the TabContentsDelegate.NavigationStateChanged to tell it | 64 // Flags passed to the TabContentsDelegate.NavigationStateChanged to tell it |
| 61 // what has changed. Combine them to update more than one thing. | 65 // what has changed. Combine them to update more than one thing. |
| 62 enum InvalidateTypes { | 66 enum InvalidateTypes { |
| 63 INVALIDATE_URL = 1 << 0, // The URL has changed. | 67 INVALIDATE_URL = 1 << 0, // The URL has changed. |
| 64 INVALIDATE_TAB = 1 << 1, // The favicon, app icon, or crashed | 68 INVALIDATE_TAB = 1 << 1, // The favicon, app icon, or crashed |
| 65 // state changed. | 69 // state changed. |
| 66 INVALIDATE_LOAD = 1 << 2, // The loading state has changed. | 70 INVALIDATE_LOAD = 1 << 2, // The loading state has changed. |
| 67 INVALIDATE_PAGE_ACTIONS = 1 << 3, // Page action icons have changed. | 71 INVALIDATE_PAGE_ACTIONS = 1 << 3, // Page action icons have changed. |
| 68 INVALIDATE_TITLE = 1 << 4, // The title changed. | 72 INVALIDATE_TITLE = 1 << 4, // The title changed. |
| 69 }; | 73 }; |
| 70 | 74 |
| 75 // TODO(supersat): Update comment. |
| 71 // |base_tab_contents| is used if we want to size the new tab contents view | 76 // |base_tab_contents| is used if we want to size the new tab contents view |
| 72 // based on an existing tab contents view. This can be NULL if not needed. | 77 // based on an existing tab contents view. This can be NULL if not needed. |
| 73 // | 78 // |
| 74 // The session storage namespace parameter allows multiple render views and | 79 // The session storage namespace parameter allows multiple render views and |
| 75 // tab contentses to share the same session storage (part of the WebStorage | 80 // tab contentses to share the same session storage (part of the WebStorage |
| 76 // spec) space. This is useful when restoring tabs, but most callers should | 81 // spec) space. This is useful when restoring tabs, but most callers should |
| 77 // pass in NULL which will cause a new SessionStorageNamespace to be created. | 82 // pass in NULL which will cause a new SessionStorageNamespace to be created. |
| 78 TabContents(content::BrowserContext* browser_context, | 83 TabContents(content::BrowserContext* browser_context, |
| 79 SiteInstance* site_instance, | 84 SiteInstance* site_instance, |
| 80 int routing_id, | 85 int routing_id, |
| 81 const TabContents* base_tab_contents, | 86 content::ContentFrame* opener, |
| 82 SessionStorageNamespace* session_storage_namespace); | 87 SessionStorageNamespace* session_storage_namespace); |
| 83 virtual ~TabContents(); | 88 virtual ~TabContents(); |
| 84 | 89 |
| 85 // Intrinsic tab state ------------------------------------------------------- | 90 // Intrinsic tab state ------------------------------------------------------- |
| 86 | 91 |
| 87 // Returns the property bag for this tab contents, where callers can add | 92 // Returns the property bag for this tab contents, where callers can add |
| 88 // extra data they may wish to associate with the tab. Returns a pointer | 93 // extra data they may wish to associate with the tab. Returns a pointer |
| 89 // rather than a reference since the PropertyAccessors expect this. | 94 // rather than a reference since the PropertyAccessors expect this. |
| 90 const base::PropertyBag* property_bag() const { return &property_bag_; } | 95 const base::PropertyBag* property_bag() const { return &property_bag_; } |
| 91 base::PropertyBag* property_bag() { return &property_bag_; } | 96 base::PropertyBag* property_bag() { return &property_bag_; } |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 // time and can be NULL (during setup and teardown). | 137 // time and can be NULL (during setup and teardown). |
| 133 RenderWidgetHostView* GetRenderWidgetHostView() const { | 138 RenderWidgetHostView* GetRenderWidgetHostView() const { |
| 134 return render_manager_.GetRenderWidgetHostView(); | 139 return render_manager_.GetRenderWidgetHostView(); |
| 135 } | 140 } |
| 136 | 141 |
| 137 // The TabContentsView will never change and is guaranteed non-NULL. | 142 // The TabContentsView will never change and is guaranteed non-NULL. |
| 138 TabContentsView* view() const { | 143 TabContentsView* view() const { |
| 139 return view_.get(); | 144 return view_.get(); |
| 140 } | 145 } |
| 141 | 146 |
| 147 content::ContentFrame* content_frame() const { |
| 148 return content_frame_; |
| 149 } |
| 150 |
| 142 // Tab navigation state ------------------------------------------------------ | 151 // Tab navigation state ------------------------------------------------------ |
| 143 | 152 |
| 144 // Returns the current navigation properties, which if a navigation is | 153 // Returns the current navigation properties, which if a navigation is |
| 145 // pending may be provisional (e.g., the navigation could result in a | 154 // pending may be provisional (e.g., the navigation could result in a |
| 146 // download, in which case the URL would revert to what it was previously). | 155 // download, in which case the URL would revert to what it was previously). |
| 147 virtual const GURL& GetURL() const OVERRIDE; | 156 virtual const GURL& GetURL() const OVERRIDE; |
| 148 virtual const string16& GetTitle() const; | 157 virtual const string16& GetTitle() const; |
| 149 | 158 |
| 150 // The max page ID for any page that the current SiteInstance has loaded in | 159 // The max page ID for any page that the current SiteInstance has loaded in |
| 151 // this TabContents. Page IDs are specific to a given SiteInstance and | 160 // this TabContents. Page IDs are specific to a given SiteInstance and |
| (...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 742 | 751 |
| 743 // Initializes the given renderer if necessary and creates the view ID | 752 // Initializes the given renderer if necessary and creates the view ID |
| 744 // corresponding to this view host. If this method is not called and the | 753 // corresponding to this view host. If this method is not called and the |
| 745 // process is not shared, then the TabContents will act as though the renderer | 754 // process is not shared, then the TabContents will act as though the renderer |
| 746 // is not running (i.e., it will render "sad tab"). This method is | 755 // is not running (i.e., it will render "sad tab"). This method is |
| 747 // automatically called from LoadURL. | 756 // automatically called from LoadURL. |
| 748 // | 757 // |
| 749 // If you are attaching to an already-existing RenderView, you should call | 758 // If you are attaching to an already-existing RenderView, you should call |
| 750 // InitWithExistingID. | 759 // InitWithExistingID. |
| 751 virtual bool CreateRenderViewForRenderManager( | 760 virtual bool CreateRenderViewForRenderManager( |
| 752 RenderViewHost* render_view_host) OVERRIDE; | 761 RenderViewHost* render_view_host, int opener_route_id) OVERRIDE; |
| 753 | 762 |
| 754 // Stores random bits of data for others to associate with this object. | 763 // Stores random bits of data for others to associate with this object. |
| 755 // WARNING: this needs to be deleted after NavigationController. | 764 // WARNING: this needs to be deleted after NavigationController. |
| 756 base::PropertyBag property_bag_; | 765 base::PropertyBag property_bag_; |
| 757 | 766 |
| 758 // Data for core operation --------------------------------------------------- | 767 // Data for core operation --------------------------------------------------- |
| 759 | 768 |
| 760 // Delegate for notifying our owner about stuff. Not owned by us. | 769 // Delegate for notifying our owner about stuff. Not owned by us. |
| 761 TabContentsDelegate* delegate_; | 770 TabContentsDelegate* delegate_; |
| 762 | 771 |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 885 // remember it. | 894 // remember it. |
| 886 bool temporary_zoom_settings_; | 895 bool temporary_zoom_settings_; |
| 887 | 896 |
| 888 // Content restrictions, used to disable print/copy etc based on content's | 897 // Content restrictions, used to disable print/copy etc based on content's |
| 889 // (full-page plugins for now only) permissions. | 898 // (full-page plugins for now only) permissions. |
| 890 int content_restrictions_; | 899 int content_restrictions_; |
| 891 | 900 |
| 892 // Our view type. Default is VIEW_TYPE_TAB_CONTENTS. | 901 // Our view type. Default is VIEW_TYPE_TAB_CONTENTS. |
| 893 content::ViewType view_type_; | 902 content::ViewType view_type_; |
| 894 | 903 |
| 904 // The ContentFrame for this tab |
| 905 content::ContentFrame* content_frame_; |
| 906 |
| 895 DISALLOW_COPY_AND_ASSIGN(TabContents); | 907 DISALLOW_COPY_AND_ASSIGN(TabContents); |
| 896 }; | 908 }; |
| 897 | 909 |
| 898 #endif // CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ | 910 #endif // CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ |
| OLD | NEW |