Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / ios / web / public / web_view_counter.h
blob280637181e388924cef509eb7c0cc6386d700c25
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef IOS_WEB_PUBLIC_WEB_VIEW_COUNTER_H_
6 #define IOS_WEB_PUBLIC_WEB_VIEW_COUNTER_H_
8 #include <stddef.h>
10 #include "base/macros.h"
12 namespace web {
14 class BrowserState;
16 // Maintains the count of web views associated with a particular BrowserState.
17 // Must be used only from the UI thread.
18 class WebViewCounter {
19 public:
20 // Returns the web::WebViewCounter for the given |browser_state|. Lazily
21 // attaches one if it does not exist. |browser_state| cannot be null.
22 static web::WebViewCounter* FromBrowserState(
23 web::BrowserState* browser_state);
25 // Returns the count of WKWebViews associated with a BrowserState.
26 virtual size_t GetWKWebViewCount() = 0;
28 protected:
29 WebViewCounter() {};
30 virtual ~WebViewCounter() {}
32 private:
33 DISALLOW_COPY_AND_ASSIGN(WebViewCounter);
36 } // namespace web
38 #endif // IOS_WEB_PUBLIC_WEB_VIEW_COUNTER_H_