OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 CHROME_BROWSER_RESOURCE_COORDINATOR_RESOURCE_COORDINATOR_WEB_CONTENTS_OB
SERVER_H_ | 5 #ifndef CHROME_BROWSER_RESOURCE_COORDINATOR_RESOURCE_COORDINATOR_WEB_CONTENTS_OB
SERVER_H_ |
6 #define CHROME_BROWSER_RESOURCE_COORDINATOR_RESOURCE_COORDINATOR_WEB_CONTENTS_OB
SERVER_H_ | 6 #define CHROME_BROWSER_RESOURCE_COORDINATOR_RESOURCE_COORDINATOR_WEB_CONTENTS_OB
SERVER_H_ |
7 | 7 |
| 8 #include <memory> |
| 9 |
8 #include "base/macros.h" | 10 #include "base/macros.h" |
9 #include "content/public/browser/web_contents_observer.h" | 11 #include "content/public/browser/web_contents_observer.h" |
10 #include "content/public/browser/web_contents_user_data.h" | 12 #include "content/public/browser/web_contents_user_data.h" |
11 #include "services/resource_coordinator/public/cpp/resource_coordinator_interfac
e.h" | 13 #include "services/resource_coordinator/public/cpp/resource_coordinator_interfac
e.h" |
12 | 14 |
13 class ResourceCoordinatorWebContentsObserver | 15 class ResourceCoordinatorWebContentsObserver |
14 : public content::WebContentsObserver, | 16 : public content::WebContentsObserver, |
15 public content::WebContentsUserData< | 17 public content::WebContentsUserData< |
16 ResourceCoordinatorWebContentsObserver> { | 18 ResourceCoordinatorWebContentsObserver> { |
17 public: | 19 public: |
18 ~ResourceCoordinatorWebContentsObserver() override; | 20 ~ResourceCoordinatorWebContentsObserver() override; |
19 | 21 |
20 static bool IsEnabled(); | 22 static bool IsEnabled(); |
21 | 23 |
22 resource_coordinator::ResourceCoordinatorInterface* | 24 resource_coordinator::ResourceCoordinatorInterface* |
23 tab_resource_coordinator() { | 25 tab_resource_coordinator() { |
24 return tab_resource_coordinator_.get(); | 26 return tab_resource_coordinator_.get(); |
25 } | 27 } |
26 | 28 |
27 // WebContentsObserver implementation. | 29 // WebContentsObserver implementation. |
28 void WasShown() override; | 30 void WasShown() override; |
29 void WasHidden() override; | 31 void WasHidden() override; |
| 32 void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override; |
| 33 void RenderFrameHostChanged(content::RenderFrameHost* old_host, |
| 34 content::RenderFrameHost* new_host) override; |
| 35 void FrameDeleted(content::RenderFrameHost* render_frame_host) override; |
30 void DidFinishNavigation( | 36 void DidFinishNavigation( |
31 content::NavigationHandle* navigation_handle) override; | 37 content::NavigationHandle* navigation_handle) override; |
| 38 void RemoveFrameFromParents(content::RenderFrameHost* render_frame_host); |
32 | 39 |
33 private: | 40 private: |
34 explicit ResourceCoordinatorWebContentsObserver( | 41 explicit ResourceCoordinatorWebContentsObserver( |
35 content::WebContents* web_contents); | 42 content::WebContents* web_contents); |
36 | 43 |
37 friend class content::WebContentsUserData< | 44 friend class content::WebContentsUserData< |
38 ResourceCoordinatorWebContentsObserver>; | 45 ResourceCoordinatorWebContentsObserver>; |
39 | 46 |
40 std::unique_ptr<resource_coordinator::ResourceCoordinatorInterface> | 47 std::unique_ptr<resource_coordinator::ResourceCoordinatorInterface> |
41 tab_resource_coordinator_; | 48 tab_resource_coordinator_; |
42 | 49 |
43 DISALLOW_COPY_AND_ASSIGN(ResourceCoordinatorWebContentsObserver); | 50 DISALLOW_COPY_AND_ASSIGN(ResourceCoordinatorWebContentsObserver); |
44 }; | 51 }; |
45 | 52 |
46 #endif // CHROME_BROWSER_RESOURCE_COORDINATOR_RESOURCE_COORDINATOR_WEB_CONTENTS
_OBSERVER_H_ | 53 #endif // CHROME_BROWSER_RESOURCE_COORDINATOR_RESOURCE_COORDINATOR_WEB_CONTENTS
_OBSERVER_H_ |
OLD | NEW |