Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: content/browser/tab_contents/tab_contents.h

Issue 6854035: Move blocked content from TabContents to TabContentsWrapper. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 339
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 void AddNewContents(TabContents* new_contents, 350 void AddNewContents(TabContents* new_contents,
352 WindowOpenDisposition disposition, 351 WindowOpenDisposition disposition,
353 const gfx::Rect& initial_pos, 352 const gfx::Rect& initial_pos,
354 bool user_gesture); 353 bool user_gesture);
355 354
356 // Called when the blocked popup notification is shown or hidden.
357 virtual void PopupNotificationVisibilityChanged(bool visible);
358
359 // 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.
360 size_t constrained_window_count() { return child_windows_.size(); } 356 size_t constrained_window_count() { return child_windows_.size(); }
361 357
362 typedef std::deque<ConstrainedWindow*> ConstrainedWindowList; 358 typedef std::deque<ConstrainedWindow*> ConstrainedWindowList;
363 359
364 // 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.
365 ConstrainedWindowList::iterator constrained_window_begin() 361 ConstrainedWindowList::iterator constrained_window_begin()
366 { return child_windows_.begin(); } 362 { return child_windows_.begin(); }
367 363
368 // Return an iterator for the last constrained window in this tab contents. 364 // Return an iterator for the last constrained window in this tab contents.
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 431
436 // Notifies the delegate that a download started. 432 // Notifies the delegate that a download started.
437 void OnStartDownload(DownloadItem* download); 433 void OnStartDownload(DownloadItem* download);
438 434
439 // Notify our delegate that some of our content has animated. 435 // Notify our delegate that some of our content has animated.
440 void ToolbarSizeChanged(bool is_animating); 436 void ToolbarSizeChanged(bool is_animating);
441 437
442 // Called when a ConstrainedWindow we own is about to be closed. 438 // Called when a ConstrainedWindow we own is about to be closed.
443 void WillClose(ConstrainedWindow* window); 439 void WillClose(ConstrainedWindow* window);
444 440
445 // Called when a BlockedContentContainer we own is about to be closed.
446 void WillCloseBlockedContentContainer(BlockedContentContainer* container);
447
448 // Interstitials ------------------------------------------------------------- 441 // Interstitials -------------------------------------------------------------
449 442
450 // Various other systems need to know about our interstitials. 443 // Various other systems need to know about our interstitials.
451 bool showing_interstitial_page() const { 444 bool showing_interstitial_page() const {
452 return render_manager_.interstitial_page() != NULL; 445 return render_manager_.interstitial_page() != NULL;
453 } 446 }
454 447
455 // Sets the passed passed interstitial as the currently showing interstitial. 448 // Sets the passed passed interstitial as the currently showing interstitial.
456 // |interstitial_page| should be non NULL (use the remove_interstitial_page 449 // |interstitial_page| should be non NULL (use the remove_interstitial_page
457 // method to unset the interstitial) and no interstitial page should be set 450 // method to unset the interstitial) and no interstitial page should be set
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 // the encoding of the current tab from 'renderer' (determined by 497 // the encoding of the current tab from 'renderer' (determined by
505 // auto-detect, http header, meta, bom detection, etc). 498 // auto-detect, http header, meta, bom detection, etc).
506 void SetOverrideEncoding(const std::string& encoding); 499 void SetOverrideEncoding(const std::string& encoding);
507 500
508 // Remove any user-defined override encoding and reload by sending down 501 // Remove any user-defined override encoding and reload by sending down
509 // ViewMsg_ResetPageEncodingToDefault to the renderer. 502 // ViewMsg_ResetPageEncodingToDefault to the renderer.
510 void ResetOverrideEncoding(); 503 void ResetOverrideEncoding();
511 504
512 void WindowMoveOrResizeStarted(); 505 void WindowMoveOrResizeStarted();
513 506
514 // Sets whether all TabContents added by way of |AddNewContents| should be
515 // blocked. Transitioning from all blocked to not all blocked results in
516 // reevaluating any blocked TabContents, which may result in unblocking some
517 // of the blocked TabContents.
518 void SetAllContentsBlocked(bool value);
519
520 BlockedContentContainer* blocked_content_container() const {
521 return blocked_contents_;
522 }
523
524 RendererPreferences* GetMutableRendererPrefs() { 507 RendererPreferences* GetMutableRendererPrefs() {
525 return &renderer_preferences_; 508 return &renderer_preferences_;
526 } 509 }
527 510
528 void set_opener_web_ui_type(WebUI::TypeID opener_web_ui_type) { 511 void set_opener_web_ui_type(WebUI::TypeID opener_web_ui_type) {
529 opener_web_ui_type_ = opener_web_ui_type; 512 opener_web_ui_type_ = opener_web_ui_type;
530 } 513 }
531 514
532 // We want to time how long it takes to create a new tab page. This method 515 // We want to time how long it takes to create a new tab page. This method
533 // gets called as parts of the new tab page have loaded. 516 // gets called as parts of the new tab page have loaded.
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 int content_restrictions() const { return content_restrictions_; } 593 int content_restrictions() const { return content_restrictions_; }
611 void SetContentRestrictions(int restrictions); 594 void SetContentRestrictions(int restrictions);
612 595
613 safe_browsing::ClientSideDetectionHost* safebrowsing_detection_host() { 596 safe_browsing::ClientSideDetectionHost* safebrowsing_detection_host() {
614 return safebrowsing_detection_host_.get(); 597 return safebrowsing_detection_host_.get();
615 } 598 }
616 599
617 // Query the WebUIFactory for the TypeID for the current URL. 600 // Query the WebUIFactory for the TypeID for the current URL.
618 WebUI::TypeID GetWebUITypeForCurrentState(); 601 WebUI::TypeID GetWebUITypeForCurrentState();
619 602
603 // From RenderViewHostDelegate.
604 virtual RenderViewHostDelegate::ContentSettings* GetContentSettingsDelegate();
605
620 protected: 606 protected:
621 friend class TabContentsObserver; 607 friend class TabContentsObserver;
622 friend class TabContentsObserver::Registrar; 608 friend class TabContentsObserver::Registrar;
623 609
624 // Add and remove observers for page navigation notifications. Adding or 610 // Add and remove observers for page navigation notifications. Adding or
625 // removing multiple times has no effect. The order in which notifications 611 // removing multiple times has no effect. The order in which notifications
626 // are sent to observers is undefined. Clients must be sure to remove the 612 // are sent to observers is undefined. Clients must be sure to remove the
627 // observer before they go away. 613 // observer before they go away.
628 void AddObserver(TabContentsObserver* observer); 614 void AddObserver(TabContentsObserver* observer);
629 void RemoveObserver(TabContentsObserver* observer); 615 void RemoveObserver(TabContentsObserver* observer);
630 616
631 // from RenderViewHostDelegate. 617 // From RenderViewHostDelegate.
632 virtual bool OnMessageReceived(const IPC::Message& message); 618 virtual bool OnMessageReceived(const IPC::Message& message);
633 619
634 private: 620 private:
635 friend class NavigationController; 621 friend class NavigationController;
636 // Used to access the child_windows_ (ConstrainedWindowList) for testing 622 // Used to access the child_windows_ (ConstrainedWindowList) for testing
637 // automation purposes. 623 // automation purposes.
638 friend class TestingAutomationProvider; 624 friend class TestingAutomationProvider;
639 625
640 FRIEND_TEST_ALL_PREFIXES(TabContentsTest, NoJSMessageOnInterstitials); 626 FRIEND_TEST_ALL_PREFIXES(TabContentsTest, NoJSMessageOnInterstitials);
641 FRIEND_TEST_ALL_PREFIXES(TabContentsTest, UpdateTitle); 627 FRIEND_TEST_ALL_PREFIXES(TabContentsTest, UpdateTitle);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 void OnPDFHasUnsupportedFeature(); 679 void OnPDFHasUnsupportedFeature();
694 680
695 void OnGoToEntryAtOffset(int offset); 681 void OnGoToEntryAtOffset(int offset);
696 682
697 // Changes the IsLoading state and notifies delegate as needed 683 // Changes the IsLoading state and notifies delegate as needed
698 // |details| is used to provide details on the load that just finished 684 // |details| is used to provide details on the load that just finished
699 // (but can be null if not applicable). Can be overridden. 685 // (but can be null if not applicable). Can be overridden.
700 void SetIsLoading(bool is_loading, 686 void SetIsLoading(bool is_loading,
701 LoadNotificationDetails* details); 687 LoadNotificationDetails* details);
702 688
703 // Adds the incoming |new_contents| to the |blocked_contents_| container.
704 void AddPopup(TabContents* new_contents,
705 const gfx::Rect& initial_pos);
706
707 // Called by derived classes to indicate that we're no longer waiting for a 689 // Called by derived classes to indicate that we're no longer waiting for a
708 // response. This won't actually update the throbber, but it will get picked 690 // response. This won't actually update the throbber, but it will get picked
709 // up at the next animation step if the throbber is going. 691 // up at the next animation step if the throbber is going.
710 void SetNotWaitingForResponse() { waiting_for_response_ = false; } 692 void SetNotWaitingForResponse() { waiting_for_response_ = false; }
711 693
712 ConstrainedWindowList child_windows_; 694 ConstrainedWindowList child_windows_;
713 695
714 // Expires InfoBars that need to be expired, according to the state carried 696 // Expires InfoBars that need to be expired, according to the state carried
715 // in |details|, in response to a new NavigationEntry being committed (the 697 // in |details|, in response to a new NavigationEntry being committed (the
716 // user navigated to another page). 698 // user navigated to another page).
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 770
789 // TabSpecificContentSettings::Delegate implementation. 771 // TabSpecificContentSettings::Delegate implementation.
790 virtual void OnContentSettingsAccessed(bool content_was_blocked); 772 virtual void OnContentSettingsAccessed(bool content_was_blocked);
791 773
792 // RenderViewHostDelegate ---------------------------------------------------- 774 // RenderViewHostDelegate ----------------------------------------------------
793 775
794 // RenderViewHostDelegate implementation. 776 // RenderViewHostDelegate implementation.
795 virtual RenderViewHostDelegate::View* GetViewDelegate(); 777 virtual RenderViewHostDelegate::View* GetViewDelegate();
796 virtual RenderViewHostDelegate::RendererManagement* 778 virtual RenderViewHostDelegate::RendererManagement*
797 GetRendererManagementDelegate(); 779 GetRendererManagementDelegate();
798 virtual RenderViewHostDelegate::ContentSettings* GetContentSettingsDelegate();
799 virtual RenderViewHostDelegate::SSL* GetSSLDelegate(); 780 virtual RenderViewHostDelegate::SSL* GetSSLDelegate();
800 virtual AutomationResourceRoutingDelegate* 781 virtual AutomationResourceRoutingDelegate*
801 GetAutomationResourceRoutingDelegate(); 782 GetAutomationResourceRoutingDelegate();
802 virtual TabContents* GetAsTabContents(); 783 virtual TabContents* GetAsTabContents();
803 virtual ViewType::Type GetRenderViewType() const; 784 virtual ViewType::Type GetRenderViewType() const;
804 virtual int GetBrowserWindowID() const; 785 virtual int GetBrowserWindowID() const;
805 virtual void RenderViewCreated(RenderViewHost* render_view_host); 786 virtual void RenderViewCreated(RenderViewHost* render_view_host);
806 virtual void RenderViewReady(RenderViewHost* render_view_host); 787 virtual void RenderViewReady(RenderViewHost* render_view_host);
807 virtual void RenderViewGone(RenderViewHost* render_view_host, 788 virtual void RenderViewGone(RenderViewHost* render_view_host,
808 base::TerminationStatus status, 789 base::TerminationStatus status,
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
998 // messages. 979 // messages.
999 bool received_page_title_; 980 bool received_page_title_;
1000 981
1001 // When a navigation occurs, we record its contents MIME type. It can be 982 // When a navigation occurs, we record its contents MIME type. It can be
1002 // used to check whether we can do something for some special contents. 983 // used to check whether we can do something for some special contents.
1003 std::string contents_mime_type_; 984 std::string contents_mime_type_;
1004 985
1005 // Character encoding. 986 // Character encoding.
1006 std::string encoding_; 987 std::string encoding_;
1007 988
1008 // Object that holds any blocked TabContents spawned from this TabContents.
1009 BlockedContentContainer* blocked_contents_;
1010
1011 // Should we block all child TabContents this attempts to spawn.
1012 bool all_contents_blocked_;
1013
1014 // TODO(pkasting): Hack to try and fix Linux browser tests.
1015 bool dont_notify_render_view_;
1016
1017 // True if this is a secure page which displayed insecure content. 989 // True if this is a secure page which displayed insecure content.
1018 bool displayed_insecure_content_; 990 bool displayed_insecure_content_;
1019 991
1020 // Data for shelves and stuff ------------------------------------------------ 992 // Data for shelves and stuff ------------------------------------------------
1021 993
1022 // Delegates for InfoBars associated with this TabContents. 994 // Delegates for InfoBars associated with this TabContents.
1023 std::vector<InfoBarDelegate*> infobar_delegates_; 995 std::vector<InfoBarDelegate*> infobar_delegates_;
1024 996
1025 // Data for misc internal state ---------------------------------------------- 997 // Data for misc internal state ----------------------------------------------
1026 998
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1094 ObserverList<TabContentsObserver> observers_; 1066 ObserverList<TabContentsObserver> observers_;
1095 1067
1096 // Content restrictions, used to disable print/copy etc based on content's 1068 // Content restrictions, used to disable print/copy etc based on content's
1097 // (full-page plugins for now only) permissions. 1069 // (full-page plugins for now only) permissions.
1098 int content_restrictions_; 1070 int content_restrictions_;
1099 1071
1100 DISALLOW_COPY_AND_ASSIGN(TabContents); 1072 DISALLOW_COPY_AND_ASSIGN(TabContents);
1101 }; 1073 };
1102 1074
1103 #endif // CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ 1075 #endif // CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698