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_WEB_VIEW_COUNTER_IMPL_H_
6 #define IOS_WEB_WEB_VIEW_COUNTER_IMPL_H_
8 #import <WebKit/WebKit.h>
10 #include "base/macros.h"
11 #include "base/supports_user_data.h"
12 #include "ios/web/public/web_view_counter.h"
13 #import "ios/web/weak_nsobject_counter.h"
17 class WebViewCounterImpl
: public WebViewCounter
,
18 public base::SupportsUserData::Data
{
21 ~WebViewCounterImpl() override
;
23 // Returns the WebViewCounterImpl for the given |browser_state|. Lazily
24 // attaches one if it does not exist. |browser_state| cannot be null.
25 static web::WebViewCounterImpl
* FromBrowserState(
26 web::BrowserState
* browser_state
);
28 // WebViewCounter methods.
29 size_t GetWKWebViewCount() override
;
31 // Inserts a WKWebView for tracking. |wk_web_view| cannot be null.
32 void InsertWKWebView(WKWebView
* wk_web_view
);
35 // The WeakNSObjectCounter that counts WKWebViews.
36 WeakNSObjectCounter wk_web_view_counter_
;
38 DISALLOW_COPY_AND_ASSIGN(WebViewCounterImpl
);
43 #endif // IOS_WEB_WEB_VIEW_COUNTER_IMPL_H_