Index: ios/chrome/browser/dom_distiller/web_state_dispatcher_impl.h |
diff --git a/ios/chrome/browser/dom_distiller/web_state_dispatcher_impl.h b/ios/chrome/browser/dom_distiller/web_state_dispatcher_impl.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..bfbceb74f1773ba403ffff25cfed3807fb59ece0 |
--- /dev/null |
+++ b/ios/chrome/browser/dom_distiller/web_state_dispatcher_impl.h |
@@ -0,0 +1,39 @@ |
+// Copyright 2016 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 IOS_CHROME_BROWSER_DOM_DISTILLER_WEB_STATE_DISPATCHER_IMPL_H_ |
+#define IOS_CHROME_BROWSER_DOM_DISTILLER_WEB_STATE_DISPATCHER_IMPL_H_ |
+ |
+#include <map> |
+#include <memory> |
+ |
+#include "base/memory/weak_ptr.h" |
+#include "components/dom_distiller/ios/web_state_dispatcher.h" |
+ |
+namespace web { |
+class BrowserState; |
+} |
+ |
+namespace dom_distiller { |
+ |
+// Implementation of the WebStateDispatcher. |
+class WebStateDispatcherImpl : public WebStateDispatcher { |
+ public: |
+ WebStateDispatcherImpl(web::BrowserState* browser_state); |
+ virtual ~WebStateDispatcherImpl(); |
+ |
+ // WebStateDispatcher implementation. |
+ web::WebState* RequestWebState() override; |
+ void ReturnWebState(web::WebState* web_state) override; |
+ |
+ private: |
+ web::BrowserState* browser_state_; |
+ // Map of the WebStates currently alive. |
+ std::map<web::WebState*, std::unique_ptr<web::WebState>> web_states_; |
+ base::WeakPtrFactory<WebStateDispatcherImpl> weak_ptr_factory_; |
+}; |
+ |
+} // namespace dom_distiller |
+ |
+#endif // IOS_CHROME_BROWSER_DOM_DISTILLER_WEB_STATE_DISPATCHER_IMPL_H_ |