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 CHROME_BROWSER_UI_TAB_CONTENTS_TAB_CONTENTS_H_ | 5 #ifndef CHROME_BROWSER_UI_TAB_CONTENTS_TAB_CONTENTS_H_ |
6 #define CHROME_BROWSER_UI_TAB_CONTENTS_TAB_CONTENTS_H_ | 6 #define CHROME_BROWSER_UI_TAB_CONTENTS_TAB_CONTENTS_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
11 #include "base/memory/ref_counted.h" | |
12 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
13 #include "content/public/browser/web_contents_observer.h" | 12 #include "content/public/browser/web_contents_observer.h" |
14 | 13 |
15 class AutofillExternalDelegate; | 14 class AutofillExternalDelegate; |
16 class AutofillManager; | |
17 class BasePanelBrowserTest; | 15 class BasePanelBrowserTest; |
18 class Browser; | 16 class Browser; |
19 class BrowserCommandsTabContentsCreator; | 17 class BrowserCommandsTabContentsCreator; |
20 class BrowserLauncherItemControllerContentsCreator; | 18 class BrowserLauncherItemControllerContentsCreator; |
21 class BrowserTabstripTabContentsCreator; | 19 class BrowserTabstripTabContentsCreator; |
22 class ChromeWebContentsHandler; | 20 class ChromeWebContentsHandler; |
23 class ConstrainedWebDialogDelegateBase; | 21 class ConstrainedWebDialogDelegateBase; |
24 class ExtensionTabUtil; | 22 class ExtensionTabUtil; |
25 class ExternalTabContainerWin; | 23 class ExternalTabContainerWin; |
26 class GeolocationPermissionContextTests; | 24 class GeolocationPermissionContextTests; |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 content::WebContents* web_contents() const; | 132 content::WebContents* web_contents() const; |
135 | 133 |
136 // Returns the Profile that is associated with this TabContents. | 134 // Returns the Profile that is associated with this TabContents. |
137 Profile* profile() const; | 135 Profile* profile() const; |
138 | 136 |
139 // True if this TabContents is being torn down. | 137 // True if this TabContents is being torn down. |
140 bool in_destructor() const { return in_destructor_; } | 138 bool in_destructor() const { return in_destructor_; } |
141 | 139 |
142 // Tab Helpers --------------------------------------------------------------- | 140 // Tab Helpers --------------------------------------------------------------- |
143 | 141 |
144 AutofillManager* autofill_manager() { return autofill_manager_.get(); } | |
145 | |
146 InfoBarTabHelper* infobar_tab_helper() { return infobar_tab_helper_.get(); } | 142 InfoBarTabHelper* infobar_tab_helper() { return infobar_tab_helper_.get(); } |
147 | 143 |
148 PasswordManager* password_manager() { return password_manager_.get(); } | 144 PasswordManager* password_manager() { return password_manager_.get(); } |
149 | 145 |
150 // NOTE: This returns NULL unless in-browser thumbnail generation is enabled. | 146 // NOTE: This returns NULL unless in-browser thumbnail generation is enabled. |
151 ThumbnailGenerator* thumbnail_generator() { | 147 ThumbnailGenerator* thumbnail_generator() { |
152 return thumbnail_generator_.get(); | 148 return thumbnail_generator_.get(); |
153 } | 149 } |
154 | 150 |
155 // Overrides ----------------------------------------------------------------- | 151 // Overrides ----------------------------------------------------------------- |
156 | 152 |
157 // content::WebContentsObserver overrides: | 153 // content::WebContentsObserver overrides: |
158 virtual void WebContentsDestroyed(content::WebContents* tab) OVERRIDE; | 154 virtual void WebContentsDestroyed(content::WebContents* tab) OVERRIDE; |
159 | 155 |
160 private: | 156 private: |
161 friend class TabContentsFactory; | 157 friend class TabContentsFactory; |
162 | 158 |
163 // Takes ownership of |contents|, which must be heap-allocated (as it lives | 159 // Takes ownership of |contents|, which must be heap-allocated (as it lives |
164 // in a scoped_ptr) and can not be NULL. | 160 // in a scoped_ptr) and can not be NULL. |
165 explicit TabContents(content::WebContents* contents); | 161 explicit TabContents(content::WebContents* contents); |
166 | 162 |
167 // Create a TabContents with the same state as this one. The returned | 163 // Create a TabContents with the same state as this one. The returned |
168 // heap-allocated pointer is owned by the caller. | 164 // heap-allocated pointer is owned by the caller. |
169 TabContents* Clone(); | 165 TabContents* Clone(); |
170 | 166 |
171 // Tab Helpers --------------------------------------------------------------- | 167 // Tab Helpers --------------------------------------------------------------- |
172 // (These provide API for callers and have a getter function listed in the | 168 // (These provide API for callers and have a getter function listed in the |
173 // "Tab Helpers" section in the member functions area, above.) | 169 // "Tab Helpers" section in the member functions area, above.) |
174 | 170 |
175 scoped_refptr<AutofillManager> autofill_manager_; | |
176 scoped_ptr<AutofillExternalDelegate> autofill_external_delegate_; | 171 scoped_ptr<AutofillExternalDelegate> autofill_external_delegate_; |
177 scoped_ptr<InfoBarTabHelper> infobar_tab_helper_; | 172 scoped_ptr<InfoBarTabHelper> infobar_tab_helper_; |
178 | 173 |
179 // PasswordManager and its delegate. The delegate must outlive the manager, | 174 // PasswordManager and its delegate. The delegate must outlive the manager, |
180 // per documentation in password_manager.h. | 175 // per documentation in password_manager.h. |
181 scoped_ptr<PasswordManagerDelegate> password_manager_delegate_; | 176 scoped_ptr<PasswordManagerDelegate> password_manager_delegate_; |
182 scoped_ptr<PasswordManager> password_manager_; | 177 scoped_ptr<PasswordManager> password_manager_; |
183 | 178 |
184 scoped_ptr<ThumbnailGenerator> thumbnail_generator_; | 179 scoped_ptr<ThumbnailGenerator> thumbnail_generator_; |
185 | 180 |
186 // WebContents (MUST BE LAST) ------------------------------------------------ | 181 // WebContents (MUST BE LAST) ------------------------------------------------ |
187 | 182 |
188 // If true, we're running the destructor. | 183 // If true, we're running the destructor. |
189 bool in_destructor_; | 184 bool in_destructor_; |
190 | 185 |
191 // The supporting objects need to outlive the WebContents dtor (as they may | 186 // The supporting objects need to outlive the WebContents dtor (as they may |
192 // be called upon during its execution). As a result, this must come last | 187 // be called upon during its execution). As a result, this must come last |
193 // in the list. | 188 // in the list. |
194 scoped_ptr<content::WebContents> web_contents_; | 189 scoped_ptr<content::WebContents> web_contents_; |
195 | 190 |
196 DISALLOW_COPY_AND_ASSIGN(TabContents); | 191 DISALLOW_COPY_AND_ASSIGN(TabContents); |
197 }; | 192 }; |
198 | 193 |
199 #endif // CHROME_BROWSER_UI_TAB_CONTENTS_TAB_CONTENTS_H_ | 194 #endif // CHROME_BROWSER_UI_TAB_CONTENTS_TAB_CONTENTS_H_ |
OLD | NEW |