| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 } | 48 } |
| 49 | 49 |
| 50 namespace prerender { | 50 namespace prerender { |
| 51 class PrerenderManager; | 51 class PrerenderManager; |
| 52 } | 52 } |
| 53 | 53 |
| 54 namespace safe_browsing { | 54 namespace safe_browsing { |
| 55 class ClientSideDetectionHost; | 55 class ClientSideDetectionHost; |
| 56 } | 56 } |
| 57 | 57 |
| 58 class BlockedContentContainer; | |
| 59 class WebUI; | 58 class WebUI; |
| 60 class DownloadItem; | 59 class DownloadItem; |
| 61 class Extension; | 60 class Extension; |
| 62 class InfoBarDelegate; | 61 class InfoBarDelegate; |
| 63 class LoadNotificationDetails; | 62 class LoadNotificationDetails; |
| 64 class OmniboxSearchHint; | 63 class OmniboxSearchHint; |
| 65 class PluginObserver; | 64 class PluginObserver; |
| 66 class Profile; | 65 class Profile; |
| 67 class RenderViewHost; | 66 class RenderViewHost; |
| 68 class SessionStorageNamespace; | 67 class SessionStorageNamespace; |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 // Window management --------------------------------------------------------- | 340 // Window management --------------------------------------------------------- |
| 342 | 341 |
| 343 // Create a new window constrained to this TabContents' clip and visibility. | 342 // Create a new window constrained to this TabContents' clip and visibility. |
| 344 // The window is initialized by using the supplied delegate to obtain basic | 343 // The window is initialized by using the supplied delegate to obtain basic |
| 345 // window characteristics, and the supplied view for the content. Note that | 344 // window characteristics, and the supplied view for the content. Note that |
| 346 // the returned ConstrainedWindow might not yet be visible. | 345 // the returned ConstrainedWindow might not yet be visible. |
| 347 ConstrainedWindow* CreateConstrainedDialog( | 346 ConstrainedWindow* CreateConstrainedDialog( |
| 348 ConstrainedWindowDelegate* delegate); | 347 ConstrainedWindowDelegate* delegate); |
| 349 | 348 |
| 350 // Adds a new tab or window with the given already-created contents. | 349 // Adds a new tab or window with the given already-created contents. |
| 351 // If disposition is NEW_POPUP and user_gesture is false, contents may | 350 void AddNewContents(TabContents* new_contents, |
| 352 // be blocked. | 351 WindowOpenDisposition disposition, |
| 353 void AddOrBlockNewContents(TabContents* new_contents, | 352 const gfx::Rect& initial_pos, |
| 354 WindowOpenDisposition disposition, | 353 bool user_gesture); |
| 355 const gfx::Rect& initial_pos, | |
| 356 bool user_gesture); | |
| 357 | |
| 358 // Called when the blocked popup notification is shown or hidden. | |
| 359 virtual void PopupNotificationVisibilityChanged(bool visible); | |
| 360 | 354 |
| 361 // Returns the number of constrained windows in this tab. Used by tests. | 355 // Returns the number of constrained windows in this tab. Used by tests. |
| 362 size_t constrained_window_count() { return child_windows_.size(); } | 356 size_t constrained_window_count() { return child_windows_.size(); } |
| 363 | 357 |
| 364 typedef std::deque<ConstrainedWindow*> ConstrainedWindowList; | 358 typedef std::deque<ConstrainedWindow*> ConstrainedWindowList; |
| 365 | 359 |
| 366 // Return an iterator for the first constrained window in this tab contents. | 360 // Return an iterator for the first constrained window in this tab contents. |
| 367 ConstrainedWindowList::iterator constrained_window_begin() | 361 ConstrainedWindowList::iterator constrained_window_begin() |
| 368 { return child_windows_.begin(); } | 362 { return child_windows_.begin(); } |
| 369 | 363 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 // Notifies the delegate that a download is about to be started. | 428 // Notifies the delegate that a download is about to be started. |
| 435 // This notification is fired before a local temporary file has been created. | 429 // This notification is fired before a local temporary file has been created. |
| 436 bool CanDownload(int request_id); | 430 bool CanDownload(int request_id); |
| 437 | 431 |
| 438 // Notifies the delegate that a download started. | 432 // Notifies the delegate that a download started. |
| 439 void OnStartDownload(DownloadItem* download); | 433 void OnStartDownload(DownloadItem* download); |
| 440 | 434 |
| 441 // Called when a ConstrainedWindow we own is about to be closed. | 435 // Called when a ConstrainedWindow we own is about to be closed. |
| 442 void WillClose(ConstrainedWindow* window); | 436 void WillClose(ConstrainedWindow* window); |
| 443 | 437 |
| 444 // Called when a BlockedContentContainer we own is about to be closed. | |
| 445 void WillCloseBlockedContentContainer(BlockedContentContainer* container); | |
| 446 | |
| 447 // Interstitials ------------------------------------------------------------- | 438 // Interstitials ------------------------------------------------------------- |
| 448 | 439 |
| 449 // Various other systems need to know about our interstitials. | 440 // Various other systems need to know about our interstitials. |
| 450 bool showing_interstitial_page() const { | 441 bool showing_interstitial_page() const { |
| 451 return render_manager_.interstitial_page() != NULL; | 442 return render_manager_.interstitial_page() != NULL; |
| 452 } | 443 } |
| 453 | 444 |
| 454 // Sets the passed passed interstitial as the currently showing interstitial. | 445 // Sets the passed passed interstitial as the currently showing interstitial. |
| 455 // |interstitial_page| should be non NULL (use the remove_interstitial_page | 446 // |interstitial_page| should be non NULL (use the remove_interstitial_page |
| 456 // method to unset the interstitial) and no interstitial page should be set | 447 // method to unset the interstitial) and no interstitial page should be set |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 // the encoding of the current tab from 'renderer' (determined by | 489 // the encoding of the current tab from 'renderer' (determined by |
| 499 // auto-detect, http header, meta, bom detection, etc). | 490 // auto-detect, http header, meta, bom detection, etc). |
| 500 void SetOverrideEncoding(const std::string& encoding); | 491 void SetOverrideEncoding(const std::string& encoding); |
| 501 | 492 |
| 502 // Remove any user-defined override encoding and reload by sending down | 493 // Remove any user-defined override encoding and reload by sending down |
| 503 // ViewMsg_ResetPageEncodingToDefault to the renderer. | 494 // ViewMsg_ResetPageEncodingToDefault to the renderer. |
| 504 void ResetOverrideEncoding(); | 495 void ResetOverrideEncoding(); |
| 505 | 496 |
| 506 void WindowMoveOrResizeStarted(); | 497 void WindowMoveOrResizeStarted(); |
| 507 | 498 |
| 508 // Sets whether all TabContents added by way of |AddNewContents| should be | |
| 509 // blocked. Transitioning from all blocked to not all blocked results in | |
| 510 // reevaluating any blocked TabContents, which may result in unblocking some | |
| 511 // of the blocked TabContents. | |
| 512 void SetAllContentsBlocked(bool value); | |
| 513 | |
| 514 BlockedContentContainer* blocked_content_container() const { | |
| 515 return blocked_contents_; | |
| 516 } | |
| 517 | |
| 518 RendererPreferences* GetMutableRendererPrefs() { | 499 RendererPreferences* GetMutableRendererPrefs() { |
| 519 return &renderer_preferences_; | 500 return &renderer_preferences_; |
| 520 } | 501 } |
| 521 | 502 |
| 522 void set_opener_web_ui_type(WebUI::TypeID opener_web_ui_type) { | 503 void set_opener_web_ui_type(WebUI::TypeID opener_web_ui_type) { |
| 523 opener_web_ui_type_ = opener_web_ui_type; | 504 opener_web_ui_type_ = opener_web_ui_type; |
| 524 } | 505 } |
| 525 | 506 |
| 526 // We want to time how long it takes to create a new tab page. This method | 507 // We want to time how long it takes to create a new tab page. This method |
| 527 // gets called as parts of the new tab page have loaded. | 508 // gets called as parts of the new tab page have loaded. |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 int content_restrictions() const { return content_restrictions_; } | 585 int content_restrictions() const { return content_restrictions_; } |
| 605 void SetContentRestrictions(int restrictions); | 586 void SetContentRestrictions(int restrictions); |
| 606 | 587 |
| 607 safe_browsing::ClientSideDetectionHost* safebrowsing_detection_host() { | 588 safe_browsing::ClientSideDetectionHost* safebrowsing_detection_host() { |
| 608 return safebrowsing_detection_host_.get(); | 589 return safebrowsing_detection_host_.get(); |
| 609 } | 590 } |
| 610 | 591 |
| 611 // Query the WebUIFactory for the TypeID for the current URL. | 592 // Query the WebUIFactory for the TypeID for the current URL. |
| 612 WebUI::TypeID GetWebUITypeForCurrentState(); | 593 WebUI::TypeID GetWebUITypeForCurrentState(); |
| 613 | 594 |
| 595 // From RenderViewHostDelegate. |
| 596 virtual RenderViewHostDelegate::ContentSettings* GetContentSettingsDelegate(); |
| 597 |
| 614 protected: | 598 protected: |
| 615 friend class TabContentsObserver; | 599 friend class TabContentsObserver; |
| 616 friend class TabContentsObserver::Registrar; | 600 friend class TabContentsObserver::Registrar; |
| 617 | 601 |
| 618 // Add and remove observers for page navigation notifications. Adding or | 602 // Add and remove observers for page navigation notifications. Adding or |
| 619 // removing multiple times has no effect. The order in which notifications | 603 // removing multiple times has no effect. The order in which notifications |
| 620 // are sent to observers is undefined. Clients must be sure to remove the | 604 // are sent to observers is undefined. Clients must be sure to remove the |
| 621 // observer before they go away. | 605 // observer before they go away. |
| 622 void AddObserver(TabContentsObserver* observer); | 606 void AddObserver(TabContentsObserver* observer); |
| 623 void RemoveObserver(TabContentsObserver* observer); | 607 void RemoveObserver(TabContentsObserver* observer); |
| 624 | 608 |
| 625 // from RenderViewHostDelegate. | 609 // From RenderViewHostDelegate. |
| 626 virtual bool OnMessageReceived(const IPC::Message& message); | 610 virtual bool OnMessageReceived(const IPC::Message& message); |
| 627 | 611 |
| 628 private: | 612 private: |
| 629 friend class NavigationController; | 613 friend class NavigationController; |
| 630 // Used to access the child_windows_ (ConstrainedWindowList) for testing | 614 // Used to access the child_windows_ (ConstrainedWindowList) for testing |
| 631 // automation purposes. | 615 // automation purposes. |
| 632 friend class TestingAutomationProvider; | 616 friend class TestingAutomationProvider; |
| 633 | 617 |
| 634 FRIEND_TEST_ALL_PREFIXES(TabContentsTest, NoJSMessageOnInterstitials); | 618 FRIEND_TEST_ALL_PREFIXES(TabContentsTest, NoJSMessageOnInterstitials); |
| 635 FRIEND_TEST_ALL_PREFIXES(TabContentsTest, UpdateTitle); | 619 FRIEND_TEST_ALL_PREFIXES(TabContentsTest, UpdateTitle); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 687 void OnPDFHasUnsupportedFeature(); | 671 void OnPDFHasUnsupportedFeature(); |
| 688 | 672 |
| 689 void OnGoToEntryAtOffset(int offset); | 673 void OnGoToEntryAtOffset(int offset); |
| 690 | 674 |
| 691 // Changes the IsLoading state and notifies delegate as needed | 675 // Changes the IsLoading state and notifies delegate as needed |
| 692 // |details| is used to provide details on the load that just finished | 676 // |details| is used to provide details on the load that just finished |
| 693 // (but can be null if not applicable). Can be overridden. | 677 // (but can be null if not applicable). Can be overridden. |
| 694 void SetIsLoading(bool is_loading, | 678 void SetIsLoading(bool is_loading, |
| 695 LoadNotificationDetails* details); | 679 LoadNotificationDetails* details); |
| 696 | 680 |
| 697 // Adds a new tab or window with the given already-created contents. | |
| 698 // Called from AddOrBlockNewContents or AddPopup. | |
| 699 void AddNewContents(TabContents* new_contents, | |
| 700 WindowOpenDisposition disposition, | |
| 701 const gfx::Rect& initial_pos, | |
| 702 bool user_gesture); | |
| 703 | |
| 704 // Adds the incoming |new_contents| to the |blocked_contents_| container. | |
| 705 void AddPopup(TabContents* new_contents, | |
| 706 const gfx::Rect& initial_pos, | |
| 707 bool user_gesture); | |
| 708 | |
| 709 // Called by derived classes to indicate that we're no longer waiting for a | 681 // Called by derived classes to indicate that we're no longer waiting for a |
| 710 // response. This won't actually update the throbber, but it will get picked | 682 // response. This won't actually update the throbber, but it will get picked |
| 711 // up at the next animation step if the throbber is going. | 683 // up at the next animation step if the throbber is going. |
| 712 void SetNotWaitingForResponse() { waiting_for_response_ = false; } | 684 void SetNotWaitingForResponse() { waiting_for_response_ = false; } |
| 713 | 685 |
| 714 ConstrainedWindowList child_windows_; | 686 ConstrainedWindowList child_windows_; |
| 715 | 687 |
| 716 // Expires InfoBars that need to be expired, according to the state carried | 688 // Expires InfoBars that need to be expired, according to the state carried |
| 717 // in |details|, in response to a new NavigationEntry being committed (the | 689 // in |details|, in response to a new NavigationEntry being committed (the |
| 718 // user navigated to another page). | 690 // user navigated to another page). |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 790 | 762 |
| 791 // TabSpecificContentSettings::Delegate implementation. | 763 // TabSpecificContentSettings::Delegate implementation. |
| 792 virtual void OnContentSettingsAccessed(bool content_was_blocked); | 764 virtual void OnContentSettingsAccessed(bool content_was_blocked); |
| 793 | 765 |
| 794 // RenderViewHostDelegate ---------------------------------------------------- | 766 // RenderViewHostDelegate ---------------------------------------------------- |
| 795 | 767 |
| 796 // RenderViewHostDelegate implementation. | 768 // RenderViewHostDelegate implementation. |
| 797 virtual RenderViewHostDelegate::View* GetViewDelegate(); | 769 virtual RenderViewHostDelegate::View* GetViewDelegate(); |
| 798 virtual RenderViewHostDelegate::RendererManagement* | 770 virtual RenderViewHostDelegate::RendererManagement* |
| 799 GetRendererManagementDelegate(); | 771 GetRendererManagementDelegate(); |
| 800 virtual RenderViewHostDelegate::ContentSettings* GetContentSettingsDelegate(); | |
| 801 virtual RenderViewHostDelegate::SSL* GetSSLDelegate(); | 772 virtual RenderViewHostDelegate::SSL* GetSSLDelegate(); |
| 802 virtual AutomationResourceRoutingDelegate* | 773 virtual AutomationResourceRoutingDelegate* |
| 803 GetAutomationResourceRoutingDelegate(); | 774 GetAutomationResourceRoutingDelegate(); |
| 804 virtual TabContents* GetAsTabContents(); | 775 virtual TabContents* GetAsTabContents(); |
| 805 virtual ViewType::Type GetRenderViewType() const; | 776 virtual ViewType::Type GetRenderViewType() const; |
| 806 virtual int GetBrowserWindowID() const; | 777 virtual int GetBrowserWindowID() const; |
| 807 virtual void RenderViewCreated(RenderViewHost* render_view_host); | 778 virtual void RenderViewCreated(RenderViewHost* render_view_host); |
| 808 virtual void RenderViewReady(RenderViewHost* render_view_host); | 779 virtual void RenderViewReady(RenderViewHost* render_view_host); |
| 809 virtual void RenderViewGone(RenderViewHost* render_view_host, | 780 virtual void RenderViewGone(RenderViewHost* render_view_host, |
| 810 base::TerminationStatus status, | 781 base::TerminationStatus status, |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1001 // messages. | 972 // messages. |
| 1002 bool received_page_title_; | 973 bool received_page_title_; |
| 1003 | 974 |
| 1004 // When a navigation occurs, we record its contents MIME type. It can be | 975 // When a navigation occurs, we record its contents MIME type. It can be |
| 1005 // used to check whether we can do something for some special contents. | 976 // used to check whether we can do something for some special contents. |
| 1006 std::string contents_mime_type_; | 977 std::string contents_mime_type_; |
| 1007 | 978 |
| 1008 // Character encoding. | 979 // Character encoding. |
| 1009 std::string encoding_; | 980 std::string encoding_; |
| 1010 | 981 |
| 1011 // Object that holds any blocked TabContents spawned from this TabContents. | |
| 1012 BlockedContentContainer* blocked_contents_; | |
| 1013 | |
| 1014 // Should we block all child TabContents this attempts to spawn. | |
| 1015 bool all_contents_blocked_; | |
| 1016 | |
| 1017 // True if this is a secure page which displayed insecure content. | 982 // True if this is a secure page which displayed insecure content. |
| 1018 bool displayed_insecure_content_; | 983 bool displayed_insecure_content_; |
| 1019 | 984 |
| 1020 // Data for shelves and stuff ------------------------------------------------ | 985 // Data for shelves and stuff ------------------------------------------------ |
| 1021 | 986 |
| 1022 // Delegates for InfoBars associated with this TabContents. | 987 // Delegates for InfoBars associated with this TabContents. |
| 1023 std::vector<InfoBarDelegate*> infobar_delegates_; | 988 std::vector<InfoBarDelegate*> infobar_delegates_; |
| 1024 | 989 |
| 1025 // Data for misc internal state ---------------------------------------------- | 990 // Data for misc internal state ---------------------------------------------- |
| 1026 | 991 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1094 ObserverList<TabContentsObserver> observers_; | 1059 ObserverList<TabContentsObserver> observers_; |
| 1095 | 1060 |
| 1096 // Content restrictions, used to disable print/copy etc based on content's | 1061 // Content restrictions, used to disable print/copy etc based on content's |
| 1097 // (full-page plugins for now only) permissions. | 1062 // (full-page plugins for now only) permissions. |
| 1098 int content_restrictions_; | 1063 int content_restrictions_; |
| 1099 | 1064 |
| 1100 DISALLOW_COPY_AND_ASSIGN(TabContents); | 1065 DISALLOW_COPY_AND_ASSIGN(TabContents); |
| 1101 }; | 1066 }; |
| 1102 | 1067 |
| 1103 #endif // CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ | 1068 #endif // CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ |
| OLD | NEW |