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

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

Issue 8498022: Have ExtensionHost use TabContents instead of RenderViewHost. Try #2. The first (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 // Gets the controller for this tab contents. 96 // Gets the controller for this tab contents.
97 NavigationController& controller() { return controller_; } 97 NavigationController& controller() { return controller_; }
98 const NavigationController& controller() const { return controller_; } 98 const NavigationController& controller() const { return controller_; }
99 99
100 // Returns the user browser context associated with this TabContents (via the 100 // Returns the user browser context associated with this TabContents (via the
101 // NavigationController). 101 // NavigationController).
102 content::BrowserContext* browser_context() const { 102 content::BrowserContext* browser_context() const {
103 return controller_.browser_context(); 103 return controller_.browser_context();
104 } 104 }
105 105
106 void set_view_type(content::ViewType view_type) { view_type_ = view_type; }
107
106 // Returns the SavePackage which manages the page saving job. May be NULL. 108 // Returns the SavePackage which manages the page saving job. May be NULL.
107 SavePackage* save_package() const { return save_package_.get(); } 109 SavePackage* save_package() const { return save_package_.get(); }
108 110
109 // Return the currently active RenderProcessHost and RenderViewHost. Each of 111 // Return the currently active RenderProcessHost and RenderViewHost. Each of
110 // these may change over time. 112 // these may change over time.
111 RenderProcessHost* GetRenderProcessHost() const; 113 RenderProcessHost* GetRenderProcessHost() const;
112 RenderViewHost* render_view_host() const { 114 RenderViewHost* render_view_host() const {
113 return render_manager_.current_host(); 115 return render_manager_.current_host();
114 } 116 }
115 117
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 459
458 // Returns the WebUI for the current state of the tab. This will either be 460 // Returns the WebUI for the current state of the tab. This will either be
459 // the pending WebUI, the committed WebUI, or NULL. 461 // the pending WebUI, the committed WebUI, or NULL.
460 WebUI* GetWebUIForCurrentState(); 462 WebUI* GetWebUIForCurrentState();
461 463
462 // Called when the reponse to a pending mouse lock request has arrived. 464 // Called when the reponse to a pending mouse lock request has arrived.
463 // Returns true if |allowed| is true and the mouse has been successfully 465 // Returns true if |allowed| is true and the mouse has been successfully
464 // locked. 466 // locked.
465 bool GotResponseToLockMouseRequest(bool allowed); 467 bool GotResponseToLockMouseRequest(bool allowed);
466 468
469 // RenderViewHostDelegate ----------------------------------------------------
470
471 virtual RenderViewHostDelegate::View* GetViewDelegate() OVERRIDE;
472 virtual RenderViewHostDelegate::RendererManagement*
473 GetRendererManagementDelegate() OVERRIDE;
474 virtual TabContents* GetAsTabContents() OVERRIDE;
475 virtual content::ViewType GetRenderViewType() const OVERRIDE;
476 virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE;
477 virtual void RenderViewReady(RenderViewHost* render_view_host) OVERRIDE;
478 virtual void RenderViewGone(RenderViewHost* render_view_host,
479 base::TerminationStatus status,
480 int error_code) OVERRIDE;
481 virtual void RenderViewDeleted(RenderViewHost* render_view_host) OVERRIDE;
482 virtual void DidNavigate(
483 RenderViewHost* render_view_host,
484 const ViewHostMsg_FrameNavigate_Params& params) OVERRIDE;
485 virtual void UpdateState(RenderViewHost* render_view_host,
486 int32 page_id,
487 const std::string& state) OVERRIDE;
488 virtual void UpdateTitle(RenderViewHost* render_view_host,
489 int32 page_id,
490 const string16& title,
491 base::i18n::TextDirection title_direction) OVERRIDE;
492 virtual void UpdateEncoding(RenderViewHost* render_view_host,
493 const std::string& encoding) OVERRIDE;
494 virtual void UpdateTargetURL(int32 page_id, const GURL& url) OVERRIDE;
495 virtual void Close(RenderViewHost* render_view_host) OVERRIDE;
496 virtual void RequestMove(const gfx::Rect& new_bounds) OVERRIDE;
497 virtual void DidStartLoading() OVERRIDE;
498 virtual void DidStopLoading() OVERRIDE;
499 virtual void DidCancelLoading() OVERRIDE;
500 virtual void DidChangeLoadProgress(double progress) OVERRIDE;
501 virtual void DocumentAvailableInMainFrame(
502 RenderViewHost* render_view_host) OVERRIDE;
503 virtual void DocumentOnLoadCompletedInMainFrame(
504 RenderViewHost* render_view_host,
505 int32 page_id) OVERRIDE;
506 virtual void RequestOpenURL(const GURL& url,
507 const GURL& referrer,
508 WindowOpenDisposition disposition,
509 int64 source_frame_id) OVERRIDE;
510 virtual void RunJavaScriptMessage(const RenderViewHost* rvh,
511 const string16& message,
512 const string16& default_prompt,
513 const GURL& frame_url,
514 const int flags,
515 IPC::Message* reply_msg,
516 bool* did_suppress_message) OVERRIDE;
517 virtual void RunBeforeUnloadConfirm(const RenderViewHost* rvh,
518 const string16& message,
519 IPC::Message* reply_msg) OVERRIDE;
520 virtual content::RendererPreferences GetRendererPrefs(
521 content::BrowserContext* browser_context) const OVERRIDE;
522 virtual WebPreferences GetWebkitPrefs() OVERRIDE;
523 virtual void OnUserGesture() OVERRIDE;
524 virtual void OnIgnoredUIEvent() OVERRIDE;
525 virtual void RendererUnresponsive(RenderViewHost* render_view_host,
526 bool is_during_unload) OVERRIDE;
527 virtual void RendererResponsive(RenderViewHost* render_view_host) OVERRIDE;
528 virtual void LoadStateChanged(const GURL& url,
529 const net::LoadStateWithParam& load_state,
530 uint64 upload_position,
531 uint64 upload_size) OVERRIDE;
532 virtual void WorkerCrashed() OVERRIDE;
533 virtual void Activate() OVERRIDE;
534 virtual void Deactivate() OVERRIDE;
535 virtual void LostCapture() OVERRIDE;
536 virtual bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event,
537 bool* is_keyboard_shortcut) OVERRIDE;
538 virtual void HandleKeyboardEvent(
539 const NativeWebKeyboardEvent& event) OVERRIDE;
540 virtual void HandleMouseUp() OVERRIDE;
541 virtual void HandleMouseActivate() OVERRIDE;
542 virtual bool OnMessageReceived(const IPC::Message& message);
543 virtual void RunFileChooser(RenderViewHost* render_view_host,
544 const ViewHostMsg_RunFileChooser_Params& params);
545 virtual void ToggleFullscreenMode(bool enter_fullscreen) OVERRIDE;
546 virtual bool IsFullscreenForCurrentTab() const OVERRIDE;
547 virtual void UpdatePreferredSize(const gfx::Size& pref_size) OVERRIDE;
548 virtual void RequestToLockMouse() OVERRIDE;
549 virtual void LostMouseLock() OVERRIDE;
550
467 protected: 551 protected:
468 friend class TabContentsObserver; 552 friend class TabContentsObserver;
469 553
470 // Add and remove observers for page navigation notifications. Adding or 554 // Add and remove observers for page navigation notifications. Adding or
471 // removing multiple times has no effect. The order in which notifications 555 // removing multiple times has no effect. The order in which notifications
472 // are sent to observers is undefined. Clients must be sure to remove the 556 // are sent to observers is undefined. Clients must be sure to remove the
473 // observer before they go away. 557 // observer before they go away.
474 void AddObserver(TabContentsObserver* observer); 558 void AddObserver(TabContentsObserver* observer);
475 void RemoveObserver(TabContentsObserver* observer); 559 void RemoveObserver(TabContentsObserver* observer);
476 560
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 int merge_history_length, 686 int merge_history_length,
603 int32 minimum_page_id); 687 int32 minimum_page_id);
604 688
605 // Misc non-view stuff ------------------------------------------------------- 689 // Misc non-view stuff -------------------------------------------------------
606 690
607 // Helper functions for sending notifications. 691 // Helper functions for sending notifications.
608 void NotifySwapped(); 692 void NotifySwapped();
609 void NotifyConnected(); 693 void NotifyConnected();
610 void NotifyDisconnected(); 694 void NotifyDisconnected();
611 695
612 // RenderViewHostDelegate ----------------------------------------------------
613
614 // RenderViewHostDelegate implementation.
615 virtual RenderViewHostDelegate::View* GetViewDelegate() OVERRIDE;
616 virtual RenderViewHostDelegate::RendererManagement*
617 GetRendererManagementDelegate() OVERRIDE;
618 virtual TabContents* GetAsTabContents() OVERRIDE;
619 virtual content::ViewType GetRenderViewType() const OVERRIDE;
620 virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE;
621 virtual void RenderViewReady(RenderViewHost* render_view_host) OVERRIDE;
622 virtual void RenderViewGone(RenderViewHost* render_view_host,
623 base::TerminationStatus status,
624 int error_code) OVERRIDE;
625 virtual void RenderViewDeleted(RenderViewHost* render_view_host) OVERRIDE;
626 virtual void DidNavigate(
627 RenderViewHost* render_view_host,
628 const ViewHostMsg_FrameNavigate_Params& params) OVERRIDE;
629 virtual void UpdateState(RenderViewHost* render_view_host,
630 int32 page_id,
631 const std::string& state) OVERRIDE;
632 virtual void UpdateTitle(RenderViewHost* render_view_host,
633 int32 page_id,
634 const string16& title,
635 base::i18n::TextDirection title_direction) OVERRIDE;
636 virtual void UpdateEncoding(RenderViewHost* render_view_host,
637 const std::string& encoding) OVERRIDE;
638 virtual void UpdateTargetURL(int32 page_id, const GURL& url) OVERRIDE;
639 virtual void Close(RenderViewHost* render_view_host) OVERRIDE;
640 virtual void RequestMove(const gfx::Rect& new_bounds) OVERRIDE;
641 virtual void DidStartLoading() OVERRIDE;
642 virtual void DidStopLoading() OVERRIDE;
643 virtual void DidCancelLoading() OVERRIDE;
644 virtual void DidChangeLoadProgress(double progress) OVERRIDE;
645 virtual void DocumentOnLoadCompletedInMainFrame(
646 RenderViewHost* render_view_host,
647 int32 page_id) OVERRIDE;
648 virtual void RequestOpenURL(const GURL& url,
649 const GURL& referrer,
650 WindowOpenDisposition disposition,
651 int64 source_frame_id) OVERRIDE;
652 virtual void RunJavaScriptMessage(const RenderViewHost* rvh,
653 const string16& message,
654 const string16& default_prompt,
655 const GURL& frame_url,
656 const int flags,
657 IPC::Message* reply_msg,
658 bool* did_suppress_message) OVERRIDE;
659 virtual void RunBeforeUnloadConfirm(const RenderViewHost* rvh,
660 const string16& message,
661 IPC::Message* reply_msg) OVERRIDE;
662 virtual content::RendererPreferences GetRendererPrefs(
663 content::BrowserContext* browser_context) const OVERRIDE;
664 virtual WebPreferences GetWebkitPrefs() OVERRIDE;
665 virtual void OnUserGesture() OVERRIDE;
666 virtual void OnIgnoredUIEvent() OVERRIDE;
667 virtual void RendererUnresponsive(RenderViewHost* render_view_host,
668 bool is_during_unload) OVERRIDE;
669 virtual void RendererResponsive(RenderViewHost* render_view_host) OVERRIDE;
670 virtual void LoadStateChanged(const GURL& url,
671 const net::LoadStateWithParam& load_state,
672 uint64 upload_position,
673 uint64 upload_size) OVERRIDE;
674 virtual void WorkerCrashed() OVERRIDE;
675 virtual void Activate() OVERRIDE;
676 virtual void Deactivate() OVERRIDE;
677 virtual void LostCapture() OVERRIDE;
678 virtual bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event,
679 bool* is_keyboard_shortcut) OVERRIDE;
680 virtual void HandleKeyboardEvent(
681 const NativeWebKeyboardEvent& event) OVERRIDE;
682 virtual void HandleMouseUp() OVERRIDE;
683 virtual void HandleMouseActivate() OVERRIDE;
684 virtual bool OnMessageReceived(const IPC::Message& message);
685 virtual void RunFileChooser(RenderViewHost* render_view_host,
686 const ViewHostMsg_RunFileChooser_Params& params);
687 virtual void ToggleFullscreenMode(bool enter_fullscreen) OVERRIDE;
688 virtual bool IsFullscreenForCurrentTab() const OVERRIDE;
689 virtual void UpdatePreferredSize(const gfx::Size& pref_size) OVERRIDE;
690 virtual void RequestToLockMouse() OVERRIDE;
691 virtual void LostMouseLock() OVERRIDE;
692
693 // RenderViewHostManager::Delegate ------------------------------------------- 696 // RenderViewHostManager::Delegate -------------------------------------------
694 697
695 virtual void BeforeUnloadFiredFromRenderManager( 698 virtual void BeforeUnloadFiredFromRenderManager(
696 bool proceed, 699 bool proceed,
697 bool* proceed_to_fire_unload); 700 bool* proceed_to_fire_unload);
698 virtual void DidStartLoadingFromRenderManager( 701 virtual void DidStartLoadingFromRenderManager(
699 RenderViewHost* render_view_host); 702 RenderViewHost* render_view_host);
700 virtual void RenderViewGoneFromRenderManager( 703 virtual void RenderViewGoneFromRenderManager(
701 RenderViewHost* render_view_host); 704 RenderViewHost* render_view_host);
702 virtual void UpdateRenderViewSizeForRenderManager(); 705 virtual void UpdateRenderViewSizeForRenderManager();
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 // remember it. 848 // remember it.
846 bool temporary_zoom_settings_; 849 bool temporary_zoom_settings_;
847 850
848 // A list of observers notified when page state changes. Weak references. 851 // A list of observers notified when page state changes. Weak references.
849 ObserverList<TabContentsObserver> observers_; 852 ObserverList<TabContentsObserver> observers_;
850 853
851 // Content restrictions, used to disable print/copy etc based on content's 854 // Content restrictions, used to disable print/copy etc based on content's
852 // (full-page plugins for now only) permissions. 855 // (full-page plugins for now only) permissions.
853 int content_restrictions_; 856 int content_restrictions_;
854 857
858 // Our view type. Default is VIEW_TYPE_TAB_CONTENTS.
859 content::ViewType view_type_;
860
855 DISALLOW_COPY_AND_ASSIGN(TabContents); 861 DISALLOW_COPY_AND_ASSIGN(TabContents);
856 }; 862 };
857 863
858 #endif // CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ 864 #endif // CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698