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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 // heap-allocated pointer is owned by the caller. | 290 // heap-allocated pointer is owned by the caller. |
291 virtual TabContents* Clone(); | 291 virtual TabContents* Clone(); |
292 | 292 |
293 // Shows the page info. | 293 // Shows the page info. |
294 void ShowPageInfo(const GURL& url, | 294 void ShowPageInfo(const GURL& url, |
295 const NavigationEntry::SSLStatus& ssl, | 295 const NavigationEntry::SSLStatus& ssl, |
296 bool show_history); | 296 bool show_history); |
297 | 297 |
298 // Window management --------------------------------------------------------- | 298 // Window management --------------------------------------------------------- |
299 | 299 |
300 // Adds the given window to the list of child windows. The window will notify | |
301 // via WillClose() when it is being destroyed. | |
302 void AddConstrainedDialog(ConstrainedWindow* window); | |
303 | |
304 // Adds a new tab or window with the given already-created contents. | 300 // Adds a new tab or window with the given already-created contents. |
305 void AddNewContents(TabContents* new_contents, | 301 void AddNewContents(TabContents* new_contents, |
306 WindowOpenDisposition disposition, | 302 WindowOpenDisposition disposition, |
307 const gfx::Rect& initial_pos, | 303 const gfx::Rect& initial_pos, |
308 bool user_gesture); | 304 bool user_gesture); |
309 | 305 |
310 // Returns the number of constrained windows in this tab. Used by tests. | |
311 size_t constrained_window_count() { return child_windows_.size(); } | |
312 | |
313 typedef std::deque<ConstrainedWindow*> ConstrainedWindowList; | |
314 | |
315 // Return an iterator for the first constrained window in this tab contents. | |
316 ConstrainedWindowList::iterator constrained_window_begin() | |
317 { return child_windows_.begin(); } | |
318 | |
319 // Return an iterator for the last constrained window in this tab contents. | |
320 ConstrainedWindowList::iterator constrained_window_end() | |
321 { return child_windows_.end(); } | |
322 | |
323 // Views and focus ----------------------------------------------------------- | 306 // Views and focus ----------------------------------------------------------- |
324 // TODO(brettw): Most of these should be removed and the caller should call | 307 // TODO(brettw): Most of these should be removed and the caller should call |
325 // the view directly. | 308 // the view directly. |
326 | 309 |
327 // Returns the actual window that is focused when this TabContents is shown. | 310 // Returns the actual window that is focused when this TabContents is shown. |
328 gfx::NativeView GetContentNativeView() const; | 311 gfx::NativeView GetContentNativeView() const; |
329 | 312 |
330 // Returns the NativeView associated with this TabContents. Outside of | 313 // Returns the NativeView associated with this TabContents. Outside of |
331 // automation in the context of the UI, this is required to be implemented. | 314 // automation in the context of the UI, this is required to be implemented. |
332 gfx::NativeView GetNativeView() const; | 315 gfx::NativeView GetNativeView() const; |
(...skipping 25 matching lines...) Expand all Loading... |
358 | 341 |
359 // Toolbars and such --------------------------------------------------------- | 342 // Toolbars and such --------------------------------------------------------- |
360 | 343 |
361 // Notifies the delegate that a download is about to be started. | 344 // Notifies the delegate that a download is about to be started. |
362 // This notification is fired before a local temporary file has been created. | 345 // This notification is fired before a local temporary file has been created. |
363 bool CanDownload(int request_id); | 346 bool CanDownload(int request_id); |
364 | 347 |
365 // Notifies the delegate that a download started. | 348 // Notifies the delegate that a download started. |
366 void OnStartDownload(DownloadItem* download); | 349 void OnStartDownload(DownloadItem* download); |
367 | 350 |
368 // Called when a ConstrainedWindow we own is about to be closed. | |
369 void WillClose(ConstrainedWindow* window); | |
370 | |
371 // Interstitials ------------------------------------------------------------- | 351 // Interstitials ------------------------------------------------------------- |
372 | 352 |
373 // Various other systems need to know about our interstitials. | 353 // Various other systems need to know about our interstitials. |
374 bool showing_interstitial_page() const { | 354 bool showing_interstitial_page() const { |
375 return render_manager_.interstitial_page() != NULL; | 355 return render_manager_.interstitial_page() != NULL; |
376 } | 356 } |
377 | 357 |
378 // Sets the passed passed interstitial as the currently showing interstitial. | 358 // Sets the passed passed interstitial as the currently showing interstitial. |
379 // |interstitial_page| should be non NULL (use the remove_interstitial_page | 359 // |interstitial_page| should be non NULL (use the remove_interstitial_page |
380 // method to unset the interstitial) and no interstitial page should be set | 360 // method to unset the interstitial) and no interstitial page should be set |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
589 // |details| is used to provide details on the load that just finished | 569 // |details| is used to provide details on the load that just finished |
590 // (but can be null if not applicable). Can be overridden. | 570 // (but can be null if not applicable). Can be overridden. |
591 void SetIsLoading(bool is_loading, | 571 void SetIsLoading(bool is_loading, |
592 LoadNotificationDetails* details); | 572 LoadNotificationDetails* details); |
593 | 573 |
594 // Called by derived classes to indicate that we're no longer waiting for a | 574 // Called by derived classes to indicate that we're no longer waiting for a |
595 // response. This won't actually update the throbber, but it will get picked | 575 // response. This won't actually update the throbber, but it will get picked |
596 // up at the next animation step if the throbber is going. | 576 // up at the next animation step if the throbber is going. |
597 void SetNotWaitingForResponse() { waiting_for_response_ = false; } | 577 void SetNotWaitingForResponse() { waiting_for_response_ = false; } |
598 | 578 |
599 ConstrainedWindowList child_windows_; | |
600 | |
601 // Navigation helpers -------------------------------------------------------- | 579 // Navigation helpers -------------------------------------------------------- |
602 // | 580 // |
603 // These functions are helpers for Navigate() and DidNavigate(). | 581 // These functions are helpers for Navigate() and DidNavigate(). |
604 | 582 |
605 // Handles post-navigation tasks in DidNavigate AFTER the entry has been | 583 // Handles post-navigation tasks in DidNavigate AFTER the entry has been |
606 // committed to the navigation controller. Note that the navigation entry is | 584 // committed to the navigation controller. Note that the navigation entry is |
607 // not provided since it may be invalid/changed after being committed. The | 585 // not provided since it may be invalid/changed after being committed. The |
608 // current navigation entry is in the NavigationController at this point. | 586 // current navigation entry is in the NavigationController at this point. |
609 void DidNavigateMainFramePostCommit( | 587 void DidNavigateMainFramePostCommit( |
610 const content::LoadCommittedDetails& details, | 588 const content::LoadCommittedDetails& details, |
611 const ViewHostMsg_FrameNavigate_Params& params); | 589 const ViewHostMsg_FrameNavigate_Params& params); |
612 void DidNavigateAnyFramePostCommit( | 590 void DidNavigateAnyFramePostCommit( |
613 RenderViewHost* render_view_host, | 591 RenderViewHost* render_view_host, |
614 const content::LoadCommittedDetails& details, | 592 const content::LoadCommittedDetails& details, |
615 const ViewHostMsg_FrameNavigate_Params& params); | 593 const ViewHostMsg_FrameNavigate_Params& params); |
616 | 594 |
617 // Closes all constrained windows. | |
618 void CloseConstrainedWindows(); | |
619 | |
620 // If our controller was restored and the page id is > than the site | 595 // If our controller was restored and the page id is > than the site |
621 // instance's page id, the site instances page id is updated as well as the | 596 // instance's page id, the site instances page id is updated as well as the |
622 // renderers max page id. | 597 // renderers max page id. |
623 void UpdateMaxPageIDIfNecessary(SiteInstance* site_instance, | 598 void UpdateMaxPageIDIfNecessary(SiteInstance* site_instance, |
624 RenderViewHost* rvh); | 599 RenderViewHost* rvh); |
625 | 600 |
626 // Saves the given title to the navigation entry and does associated work. It | 601 // Saves the given title to the navigation entry and does associated work. It |
627 // will update history and the view for the new title, and also synthesize | 602 // will update history and the view for the new title, and also synthesize |
628 // titles for file URLs that have none (so we require that the URL of the | 603 // titles for file URLs that have none (so we require that the URL of the |
629 // entry already be set). | 604 // entry already be set). |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
725 virtual void HandleMouseUp() OVERRIDE; | 700 virtual void HandleMouseUp() OVERRIDE; |
726 virtual void HandleMouseActivate() OVERRIDE; | 701 virtual void HandleMouseActivate() OVERRIDE; |
727 virtual bool OnMessageReceived(const IPC::Message& message); | 702 virtual bool OnMessageReceived(const IPC::Message& message); |
728 virtual void RunFileChooser(RenderViewHost* render_view_host, | 703 virtual void RunFileChooser(RenderViewHost* render_view_host, |
729 const ViewHostMsg_RunFileChooser_Params& params); | 704 const ViewHostMsg_RunFileChooser_Params& params); |
730 virtual void ToggleFullscreenMode(bool enter_fullscreen) OVERRIDE; | 705 virtual void ToggleFullscreenMode(bool enter_fullscreen) OVERRIDE; |
731 virtual void UpdatePreferredSize(const gfx::Size& pref_size) OVERRIDE; | 706 virtual void UpdatePreferredSize(const gfx::Size& pref_size) OVERRIDE; |
732 | 707 |
733 // RenderViewHostManager::Delegate ------------------------------------------- | 708 // RenderViewHostManager::Delegate ------------------------------------------- |
734 | 709 |
735 // Blocks/unblocks interaction with renderer process. | |
736 void BlockTabContent(bool blocked); | |
737 | |
738 virtual void BeforeUnloadFiredFromRenderManager( | 710 virtual void BeforeUnloadFiredFromRenderManager( |
739 bool proceed, | 711 bool proceed, |
740 bool* proceed_to_fire_unload); | 712 bool* proceed_to_fire_unload); |
741 virtual void DidStartLoadingFromRenderManager( | 713 virtual void DidStartLoadingFromRenderManager( |
742 RenderViewHost* render_view_host); | 714 RenderViewHost* render_view_host); |
743 virtual void RenderViewGoneFromRenderManager( | 715 virtual void RenderViewGoneFromRenderManager( |
744 RenderViewHost* render_view_host); | 716 RenderViewHost* render_view_host); |
745 virtual void UpdateRenderViewSizeForRenderManager(); | 717 virtual void UpdateRenderViewSizeForRenderManager(); |
746 virtual void NotifySwappedFromRenderManager(); | 718 virtual void NotifySwappedFromRenderManager(); |
747 virtual NavigationController& GetControllerForRenderManager(); | 719 virtual NavigationController& GetControllerForRenderManager(); |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
887 ObserverList<TabContentsObserver> observers_; | 859 ObserverList<TabContentsObserver> observers_; |
888 | 860 |
889 // Content restrictions, used to disable print/copy etc based on content's | 861 // Content restrictions, used to disable print/copy etc based on content's |
890 // (full-page plugins for now only) permissions. | 862 // (full-page plugins for now only) permissions. |
891 int content_restrictions_; | 863 int content_restrictions_; |
892 | 864 |
893 DISALLOW_COPY_AND_ASSIGN(TabContents); | 865 DISALLOW_COPY_AND_ASSIGN(TabContents); |
894 }; | 866 }; |
895 | 867 |
896 #endif // CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ | 868 #endif // CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ |
OLD | NEW |