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 CHROME_BROWSER_UI_TAB_CONTENTS_TAB_CONTENTS_WRAPPER_H_ | 5 #ifndef CHROME_BROWSER_UI_TAB_CONTENTS_TAB_CONTENTS_WRAPPER_H_ |
6 #define CHROME_BROWSER_UI_TAB_CONTENTS_TAB_CONTENTS_WRAPPER_H_ | 6 #define CHROME_BROWSER_UI_TAB_CONTENTS_TAB_CONTENTS_WRAPPER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 27 matching lines...) Expand all Loading... |
38 class BookmarkTabHelper; | 38 class BookmarkTabHelper; |
39 class DownloadRequestLimiterObserver; | 39 class DownloadRequestLimiterObserver; |
40 class Extension; | 40 class Extension; |
41 class ExtensionTabHelper; | 41 class ExtensionTabHelper; |
42 class ExtensionWebNavigationTabObserver; | 42 class ExtensionWebNavigationTabObserver; |
43 class ExternalProtocolObserver; | 43 class ExternalProtocolObserver; |
44 class FaviconTabHelper; | 44 class FaviconTabHelper; |
45 class FileSelectObserver; | 45 class FileSelectObserver; |
46 class FindTabHelper; | 46 class FindTabHelper; |
47 class FirewallTraversalTabHelper; | 47 class FirewallTraversalTabHelper; |
48 class InfoBarDelegate; | 48 class InfoBarTabHelper; |
49 class HistoryTabHelper; | 49 class HistoryTabHelper; |
50 class NavigationController; | 50 class NavigationController; |
51 class OmniboxSearchHint; | 51 class OmniboxSearchHint; |
52 class PasswordManager; | 52 class PasswordManager; |
53 class PasswordManagerDelegate; | 53 class PasswordManagerDelegate; |
54 class PluginObserver; | 54 class PluginObserver; |
55 class RestoreTabHelper; | 55 class RestoreTabHelper; |
56 class SearchEngineTabHelper; | 56 class SearchEngineTabHelper; |
57 class TabContentsSSLHelper; | 57 class TabContentsSSLHelper; |
58 class TabContentsWrapperDelegate; | 58 class TabContentsWrapperDelegate; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 // Returns a human-readable description the tab's loading state. | 90 // Returns a human-readable description the tab's loading state. |
91 string16 GetStatusText() const; | 91 string16 GetStatusText() const; |
92 | 92 |
93 // Create a TabContentsWrapper with the same state as this one. The returned | 93 // Create a TabContentsWrapper with the same state as this one. The returned |
94 // heap-allocated pointer is owned by the caller. | 94 // heap-allocated pointer is owned by the caller. |
95 TabContentsWrapper* Clone(); | 95 TabContentsWrapper* Clone(); |
96 | 96 |
97 // Captures a snapshot of the page. | 97 // Captures a snapshot of the page. |
98 void CaptureSnapshot(); | 98 void CaptureSnapshot(); |
99 | 99 |
| 100 // Stop this tab rendering in fullscreen mode. |
| 101 void ExitFullscreenMode(); |
| 102 |
100 // Helper to retrieve the existing instance that wraps a given TabContents. | 103 // Helper to retrieve the existing instance that wraps a given TabContents. |
101 // Returns NULL if there is no such existing instance. | 104 // Returns NULL if there is no such existing instance. |
102 // NOTE: This is not intended for general use. It is intended for situations | 105 // NOTE: This is not intended for general use. It is intended for situations |
103 // like callbacks from content/ where only a TabContents is available. In the | 106 // like callbacks from content/ where only a TabContents is available. In the |
104 // general case, please do NOT use this; plumb TabContentsWrapper through the | 107 // general case, please do NOT use this; plumb TabContentsWrapper through the |
105 // chrome/ code instead of TabContents. | 108 // chrome/ code instead of TabContents. |
106 static TabContentsWrapper* GetCurrentWrapperForContents( | 109 static TabContentsWrapper* GetCurrentWrapperForContents( |
107 TabContents* contents); | 110 TabContents* contents); |
108 static const TabContentsWrapper* GetCurrentWrapperForContents( | 111 static const TabContentsWrapper* GetCurrentWrapperForContents( |
109 const TabContents* contents); | 112 const TabContents* contents); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 } | 156 } |
154 | 157 |
155 const ExtensionTabHelper* extension_tab_helper() const { | 158 const ExtensionTabHelper* extension_tab_helper() const { |
156 return extension_tab_helper_.get(); | 159 return extension_tab_helper_.get(); |
157 } | 160 } |
158 | 161 |
159 FindTabHelper* find_tab_helper() { return find_tab_helper_.get(); } | 162 FindTabHelper* find_tab_helper() { return find_tab_helper_.get(); } |
160 | 163 |
161 FaviconTabHelper* favicon_tab_helper() { return favicon_tab_helper_.get(); } | 164 FaviconTabHelper* favicon_tab_helper() { return favicon_tab_helper_.get(); } |
162 HistoryTabHelper* history_tab_helper() { return history_tab_helper_.get(); } | 165 HistoryTabHelper* history_tab_helper() { return history_tab_helper_.get(); } |
| 166 InfoBarTabHelper* infobar_tab_helper() { return infobar_tab_helper_.get(); } |
163 PasswordManager* password_manager() { return password_manager_.get(); } | 167 PasswordManager* password_manager() { return password_manager_.get(); } |
164 | 168 |
165 printing::PrintViewManager* print_view_manager() { | 169 printing::PrintViewManager* print_view_manager() { |
166 return print_view_manager_.get(); | 170 return print_view_manager_.get(); |
167 } | 171 } |
168 | 172 |
169 safe_browsing::ClientSideDetectionHost* safebrowsing_detection_host() { | 173 safe_browsing::ClientSideDetectionHost* safebrowsing_detection_host() { |
170 return safebrowsing_detection_host_.get(); | 174 return safebrowsing_detection_host_.get(); |
171 } | 175 } |
172 | 176 |
(...skipping 30 matching lines...) Expand all Loading... |
203 virtual void RenderViewGone() OVERRIDE; | 207 virtual void RenderViewGone() OVERRIDE; |
204 virtual void DidBecomeSelected() OVERRIDE; | 208 virtual void DidBecomeSelected() OVERRIDE; |
205 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 209 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
206 virtual void TabContentsDestroyed(TabContents* tab) OVERRIDE; | 210 virtual void TabContentsDestroyed(TabContents* tab) OVERRIDE; |
207 | 211 |
208 // NotificationObserver overrides: | 212 // NotificationObserver overrides: |
209 virtual void Observe(int type, | 213 virtual void Observe(int type, |
210 const NotificationSource& source, | 214 const NotificationSource& source, |
211 const NotificationDetails& details) OVERRIDE; | 215 const NotificationDetails& details) OVERRIDE; |
212 | 216 |
213 // Infobars ------------------------------------------------------------------ | |
214 | |
215 // Adds an InfoBar for the specified |delegate|. | |
216 // | |
217 // If infobars are disabled for this tab or the tab already has a delegate | |
218 // which returns true for InfoBarDelegate::EqualsDelegate(delegate), | |
219 // |delegate| is closed immediately without being added. | |
220 void AddInfoBar(InfoBarDelegate* delegate); | |
221 | |
222 // Removes the InfoBar for the specified |delegate|. | |
223 // | |
224 // If infobars are disabled for this tab, this will do nothing, on the | |
225 // assumption that the matching AddInfoBar() call will have already closed the | |
226 // delegate (see above). | |
227 void RemoveInfoBar(InfoBarDelegate* delegate); | |
228 | |
229 // Replaces one infobar with another, without any animation in between. | |
230 // | |
231 // If infobars are disabled for this tab, |new_delegate| is closed immediately | |
232 // without being added, and nothing else happens. | |
233 // | |
234 // NOTE: This does not perform any EqualsDelegate() checks like AddInfoBar(). | |
235 void ReplaceInfoBar(InfoBarDelegate* old_delegate, | |
236 InfoBarDelegate* new_delegate); | |
237 | |
238 // Enumeration and access functions. | |
239 size_t infobar_count() const { return infobars_.size(); } | |
240 // WARNING: This does not sanity-check |index|! | |
241 InfoBarDelegate* GetInfoBarDelegateAt(size_t index); | |
242 void set_infobars_enabled(bool value) { infobars_enabled_ = value; } | |
243 | |
244 // Stop this tab rendering in fullscreen mode. | |
245 void ExitFullscreenMode(); | |
246 | |
247 private: | 217 private: |
248 // Internal helpers ---------------------------------------------------------- | 218 // Internal helpers ---------------------------------------------------------- |
249 | 219 |
250 // Message handlers. | 220 // Message handlers. |
251 void OnSnapshot(const SkBitmap& bitmap); | 221 void OnSnapshot(const SkBitmap& bitmap); |
252 void OnPDFHasUnsupportedFeature(); | 222 void OnPDFHasUnsupportedFeature(); |
253 void OnDidBlockDisplayingInsecureContent(); | |
254 void OnDidBlockRunningInsecureContent(); | |
255 | 223 |
256 // Returns the server that can provide alternate error pages. If the returned | 224 // Returns the server that can provide alternate error pages. If the returned |
257 // URL is empty, the default error page built into WebKit will be used. | 225 // URL is empty, the default error page built into WebKit will be used. |
258 GURL GetAlternateErrorPageURL() const; | 226 GURL GetAlternateErrorPageURL() const; |
259 | 227 |
260 // Send the alternate error page URL to the renderer. | 228 // Send the alternate error page URL to the renderer. |
261 void UpdateAlternateErrorPageURL(RenderViewHost* rvh); | 229 void UpdateAlternateErrorPageURL(RenderViewHost* rvh); |
262 | 230 |
263 // Update the RenderView's WebPreferences. | 231 // Update the RenderView's WebPreferences. |
264 void UpdateWebPreferences(); | 232 void UpdateWebPreferences(); |
265 | 233 |
266 // Update the TabContents's RendererPreferences. | 234 // Update the TabContents's RendererPreferences. |
267 void UpdateRendererPreferences(); | 235 void UpdateRendererPreferences(); |
268 | 236 |
269 // Create or destroy SafebrowsingDetectionHost as needed if the user's | 237 // Create or destroy SafebrowsingDetectionHost as needed if the user's |
270 // safe browsing preference has changed. | 238 // safe browsing preference has changed. |
271 void UpdateSafebrowsingDetectionHost(); | 239 void UpdateSafebrowsingDetectionHost(); |
272 | 240 |
273 void RemoveInfoBarInternal(InfoBarDelegate* delegate, bool animate); | |
274 void RemoveAllInfoBars(bool animate); | |
275 | |
276 // Data for core operation --------------------------------------------------- | 241 // Data for core operation --------------------------------------------------- |
277 | 242 |
278 // Delegate for notifying our owner about stuff. Not owned by us. | 243 // Delegate for notifying our owner about stuff. Not owned by us. |
279 TabContentsWrapperDelegate* delegate_; | 244 TabContentsWrapperDelegate* delegate_; |
280 | 245 |
281 // Delegates for InfoBars associated with this TabContentsWrapper. | |
282 std::vector<InfoBarDelegate*> infobars_; | |
283 bool infobars_enabled_; | |
284 | |
285 NotificationRegistrar registrar_; | 246 NotificationRegistrar registrar_; |
286 PrefChangeRegistrar pref_change_registrar_; | 247 PrefChangeRegistrar pref_change_registrar_; |
287 | 248 |
288 // Helper which implements the SyncedTabDelegate interface. | 249 // Helper which implements the SyncedTabDelegate interface. |
289 scoped_ptr<TabContentsWrapperSyncedTabDelegate> synced_tab_delegate_; | 250 scoped_ptr<TabContentsWrapperSyncedTabDelegate> synced_tab_delegate_; |
290 | 251 |
291 // Data for current page ----------------------------------------------------- | 252 // Data for current page ----------------------------------------------------- |
292 | 253 |
293 // Shows an info-bar to users when they search from a known search engine and | 254 // Shows an info-bar to users when they search from a known search engine and |
294 // have never used the omnibox for search before. | 255 // have never used the omnibox for search before. |
295 scoped_ptr<OmniboxSearchHint> omnibox_search_hint_; | 256 scoped_ptr<OmniboxSearchHint> omnibox_search_hint_; |
296 | 257 |
297 // Tab Helpers --------------------------------------------------------------- | 258 // Tab Helpers --------------------------------------------------------------- |
298 // (These provide API for callers and have a getter function listed in the | 259 // (These provide API for callers and have a getter function listed in the |
299 // "Tab Helpers" section in the member functions area, above.) | 260 // "Tab Helpers" section in the member functions area, above.) |
300 | 261 |
301 scoped_ptr<AutocompleteHistoryManager> autocomplete_history_manager_; | 262 scoped_ptr<AutocompleteHistoryManager> autocomplete_history_manager_; |
302 scoped_ptr<AutofillManager> autofill_manager_; | 263 scoped_ptr<AutofillManager> autofill_manager_; |
303 scoped_ptr<AutomationTabHelper> automation_tab_helper_; | 264 scoped_ptr<AutomationTabHelper> automation_tab_helper_; |
304 scoped_ptr<BlockedContentTabHelper> blocked_content_tab_helper_; | 265 scoped_ptr<BlockedContentTabHelper> blocked_content_tab_helper_; |
305 scoped_ptr<BookmarkTabHelper> bookmark_tab_helper_; | 266 scoped_ptr<BookmarkTabHelper> bookmark_tab_helper_; |
306 scoped_ptr<ExtensionTabHelper> extension_tab_helper_; | 267 scoped_ptr<ExtensionTabHelper> extension_tab_helper_; |
307 scoped_ptr<FaviconTabHelper> favicon_tab_helper_; | 268 scoped_ptr<FaviconTabHelper> favicon_tab_helper_; |
308 scoped_ptr<FindTabHelper> find_tab_helper_; | 269 scoped_ptr<FindTabHelper> find_tab_helper_; |
309 scoped_ptr<FirewallTraversalTabHelper> firewall_traversal_tab_helper_; | 270 scoped_ptr<FirewallTraversalTabHelper> firewall_traversal_tab_helper_; |
310 scoped_ptr<HistoryTabHelper> history_tab_helper_; | 271 scoped_ptr<HistoryTabHelper> history_tab_helper_; |
| 272 scoped_ptr<InfoBarTabHelper> infobar_tab_helper_; |
311 scoped_ptr<RestoreTabHelper> restore_tab_helper_; | 273 scoped_ptr<RestoreTabHelper> restore_tab_helper_; |
312 | 274 |
313 // PasswordManager and its delegate. The delegate must outlive the manager, | 275 // PasswordManager and its delegate. The delegate must outlive the manager, |
314 // per documentation in password_manager.h. | 276 // per documentation in password_manager.h. |
315 scoped_ptr<PasswordManagerDelegate> password_manager_delegate_; | 277 scoped_ptr<PasswordManagerDelegate> password_manager_delegate_; |
316 scoped_ptr<PasswordManager> password_manager_; | 278 scoped_ptr<PasswordManager> password_manager_; |
317 | 279 |
318 // Handles print job for this contents. | 280 // Handles print job for this contents. |
319 scoped_ptr<printing::PrintViewManager> print_view_manager_; | 281 scoped_ptr<printing::PrintViewManager> print_view_manager_; |
320 | 282 |
(...skipping 29 matching lines...) Expand all Loading... |
350 | 312 |
351 // The supporting objects need to outlive the TabContents dtor (as they may | 313 // The supporting objects need to outlive the TabContents dtor (as they may |
352 // be called upon during its execution). As a result, this must come last | 314 // be called upon during its execution). As a result, this must come last |
353 // in the list. | 315 // in the list. |
354 scoped_ptr<TabContents> tab_contents_; | 316 scoped_ptr<TabContents> tab_contents_; |
355 | 317 |
356 DISALLOW_COPY_AND_ASSIGN(TabContentsWrapper); | 318 DISALLOW_COPY_AND_ASSIGN(TabContentsWrapper); |
357 }; | 319 }; |
358 | 320 |
359 #endif // CHROME_BROWSER_UI_TAB_CONTENTS_TAB_CONTENTS_WRAPPER_H_ | 321 #endif // CHROME_BROWSER_UI_TAB_CONTENTS_TAB_CONTENTS_WRAPPER_H_ |
OLD | NEW |