| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_WEB_CONTENTS_RENDER_VIEW_HOST_MANAGER_H_ | 5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_RENDER_VIEW_HOST_MANAGER_H_ |
| 6 #define CONTENT_BROWSER_WEB_CONTENTS_RENDER_VIEW_HOST_MANAGER_H_ | 6 #define CONTENT_BROWSER_WEB_CONTENTS_RENDER_VIEW_HOST_MANAGER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 namespace content { | 22 namespace content { |
| 23 class BrowserContext; | 23 class BrowserContext; |
| 24 class NavigationEntry; | 24 class NavigationEntry; |
| 25 class NavigationEntryImpl; | 25 class NavigationEntryImpl; |
| 26 class RenderViewHost; | 26 class RenderViewHost; |
| 27 class RenderViewHostImpl; | 27 class RenderViewHostImpl; |
| 28 class RenderWidgetHostView; | 28 class RenderWidgetHostView; |
| 29 class TestWebContents; | 29 class TestWebContents; |
| 30 } | 30 } |
| 31 | 31 |
| 32 // Manages RenderViewHosts for a TabContents. Normally there is only one and | 32 // Manages RenderViewHosts for a WebContentsImpl. Normally there is only one and |
| 33 // it is easy to do. But we can also have transitions of processes (and hence | 33 // it is easy to do. But we can also have transitions of processes (and hence |
| 34 // RenderViewHosts) that can get complex. | 34 // RenderViewHosts) that can get complex. |
| 35 class CONTENT_EXPORT RenderViewHostManager | 35 class CONTENT_EXPORT RenderViewHostManager |
| 36 : public content::RenderViewHostDelegate::RendererManagement, | 36 : public content::RenderViewHostDelegate::RendererManagement, |
| 37 public content::NotificationObserver { | 37 public content::NotificationObserver { |
| 38 public: | 38 public: |
| 39 // Functions implemented by our owner that we need. | 39 // Functions implemented by our owner that we need. |
| 40 // | 40 // |
| 41 // TODO(brettw) Clean this up! These are all the functions in TabContents that | 41 // TODO(brettw) Clean this up! These are all the functions in WebContentsImpl |
| 42 // are required to run this class. The design should probably be better such | 42 // that are required to run this class. The design should probably be better |
| 43 // that these are more clear. | 43 // such that these are more clear. |
| 44 // | 44 // |
| 45 // There is additional complexity that some of the functions we need in | 45 // There is additional complexity that some of the functions we need in |
| 46 // TabContents are inherited and non-virtual. These are named with | 46 // WebContentsImpl are inherited and non-virtual. These are named with |
| 47 // "RenderManager" so that the duplicate implementation of them will be clear. | 47 // "RenderManager" so that the duplicate implementation of them will be clear. |
| 48 class CONTENT_EXPORT Delegate { | 48 class CONTENT_EXPORT Delegate { |
| 49 public: | 49 public: |
| 50 // Initializes the given renderer if necessary and creates the view ID | 50 // Initializes the given renderer if necessary and creates the view ID |
| 51 // corresponding to this view host. If this method is not called and the | 51 // corresponding to this view host. If this method is not called and the |
| 52 // process is not shared, then the TabContents will act as though the | 52 // process is not shared, then the WebContentsImpl will act as though the |
| 53 // renderer is not running (i.e., it will render "sad tab"). This method is | 53 // renderer is not running (i.e., it will render "sad tab"). This method is |
| 54 // automatically called from LoadURL. | 54 // automatically called from LoadURL. |
| 55 // | 55 // |
| 56 // If you are attaching to an already-existing RenderView, you should call | 56 // If you are attaching to an already-existing RenderView, you should call |
| 57 // InitWithExistingID. | 57 // InitWithExistingID. |
| 58 virtual bool CreateRenderViewForRenderManager( | 58 virtual bool CreateRenderViewForRenderManager( |
| 59 content::RenderViewHost* render_view_host) = 0; | 59 content::RenderViewHost* render_view_host) = 0; |
| 60 virtual void BeforeUnloadFiredFromRenderManager( | 60 virtual void BeforeUnloadFiredFromRenderManager( |
| 61 bool proceed, bool* proceed_to_fire_unload) = 0; | 61 bool proceed, bool* proceed_to_fire_unload) = 0; |
| 62 virtual void DidStartLoadingFromRenderManager( | 62 virtual void DidStartLoadingFromRenderManager( |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 | 94 |
| 95 // Both delegate pointers must be non-NULL and are not owned by this class. | 95 // Both delegate pointers must be non-NULL and are not owned by this class. |
| 96 // They must outlive this class. The RenderViewHostDelegate is what will be | 96 // They must outlive this class. The RenderViewHostDelegate is what will be |
| 97 // installed into all RenderViewHosts that are created. | 97 // installed into all RenderViewHosts that are created. |
| 98 // | 98 // |
| 99 // You must call Init() before using this class. | 99 // You must call Init() before using this class. |
| 100 RenderViewHostManager(content::RenderViewHostDelegate* render_view_delegate, | 100 RenderViewHostManager(content::RenderViewHostDelegate* render_view_delegate, |
| 101 Delegate* delegate); | 101 Delegate* delegate); |
| 102 virtual ~RenderViewHostManager(); | 102 virtual ~RenderViewHostManager(); |
| 103 | 103 |
| 104 // For arguments, see TabContents constructor. | 104 // For arguments, see WebContentsImpl constructor. |
| 105 void Init(content::BrowserContext* browser_context, | 105 void Init(content::BrowserContext* browser_context, |
| 106 content::SiteInstance* site_instance, | 106 content::SiteInstance* site_instance, |
| 107 int routing_id); | 107 int routing_id); |
| 108 | 108 |
| 109 // Returns the currently active RenderViewHost. | 109 // Returns the currently active RenderViewHost. |
| 110 // | 110 // |
| 111 // This will be non-NULL between Init() and Shutdown(). You may want to NULL | 111 // This will be non-NULL between Init() and Shutdown(). You may want to NULL |
| 112 // check it in many cases, however. Windows can send us messages during the | 112 // check it in many cases, however. Windows can send us messages during the |
| 113 // destruction process after it has been shut down. | 113 // destruction process after it has been shut down. |
| 114 content::RenderViewHostImpl* current_host() const; | 114 content::RenderViewHostImpl* current_host() const; |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 // The intersitial page currently shown if any, not own by this class | 288 // The intersitial page currently shown if any, not own by this class |
| 289 // (the InterstitialPage is self-owned, it deletes itself when hidden). | 289 // (the InterstitialPage is self-owned, it deletes itself when hidden). |
| 290 InterstitialPageImpl* interstitial_page_; | 290 InterstitialPageImpl* interstitial_page_; |
| 291 | 291 |
| 292 content::NotificationRegistrar registrar_; | 292 content::NotificationRegistrar registrar_; |
| 293 | 293 |
| 294 DISALLOW_COPY_AND_ASSIGN(RenderViewHostManager); | 294 DISALLOW_COPY_AND_ASSIGN(RenderViewHostManager); |
| 295 }; | 295 }; |
| 296 | 296 |
| 297 #endif // CONTENT_BROWSER_WEB_CONTENTS_RENDER_VIEW_HOST_MANAGER_H_ | 297 #endif // CONTENT_BROWSER_WEB_CONTENTS_RENDER_VIEW_HOST_MANAGER_H_ |
| OLD | NEW |