Chromium Code Reviews| Index: chrome/browser/resource_coordinator/resource_coordinator_web_contents_observer.h |
| diff --git a/chrome/browser/resource_coordinator/resource_coordinator_web_contents_observer.h b/chrome/browser/resource_coordinator/resource_coordinator_web_contents_observer.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..f8e9872f3a045d6d52e1e0116a50fc258d144284 |
| --- /dev/null |
| +++ b/chrome/browser/resource_coordinator/resource_coordinator_web_contents_observer.h |
| @@ -0,0 +1,43 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_RESOURCE_COORDINATOR_RESOURCE_COORDINATOR_WEB_CONTENTS_OBSERVER_H_ |
| +#define CHROME_BROWSER_RESOURCE_COORDINATOR_RESOURCE_COORDINATOR_WEB_CONTENTS_OBSERVER_H_ |
| + |
| +#include "base/macros.h" |
| +#include "content/public/browser/web_contents_observer.h" |
| +#include "content/public/browser/web_contents_user_data.h" |
| +#include "services/resource_coordinator/public/cpp/resource_coordinator_interface.h" |
| + |
| +class ResourceCoordinatorWebContentsObserver |
| + : public content::WebContentsObserver, |
| + public content::WebContentsUserData< |
| + ResourceCoordinatorWebContentsObserver> { |
| + public: |
| + ~ResourceCoordinatorWebContentsObserver() override; |
| + |
| + static bool IsEnabled(); |
| + |
| + resource_coordinator::ResourceCoordinatorInterface* |
| + tab_resource_coordinator() { |
| + return tab_resource_coordinator_.get(); |
| + } |
| + |
| + // WebContentsObserver implementation. |
| + void WasShown() override; |
| + void WasHidden() override; |
| + |
| + private: |
| + explicit ResourceCoordinatorWebContentsObserver( |
| + content::WebContents* web_contents); |
| + |
| + friend class content::WebContentsUserData< |
| + ResourceCoordinatorWebContentsObserver>; |
| + |
| + std::unique_ptr<resource_coordinator::ResourceCoordinatorInterface> |
| + tab_resource_coordinator_; |
| + DISALLOW_COPY_AND_ASSIGN(ResourceCoordinatorWebContentsObserver); |
|
Lei Zhang
2017/05/10 23:59:00
nit: blank line above.
oystein (OOO til 10th of July)
2017/05/11 22:52:47
Done.
|
| +}; |
| + |
| +#endif // CHROME_BROWSER_RESOURCE_COORDINATOR_RESOURCE_COORDINATOR_WEB_CONTENTS_OBSERVER_H_ |