Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 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. | |
| 4 | |
| 5 #ifndef IOS_CHROME_BROWSER_DOM_DISTILLER_FAVICON_WEB_STATE_DISPATCHER_IMPL_H_ | |
| 6 #define IOS_CHROME_BROWSER_DOM_DISTILLER_FAVICON_WEB_STATE_DISPATCHER_IMPL_H_ | |
| 7 | |
| 8 #include <map> | |
| 9 #include <memory> | |
| 10 | |
| 11 #include "base/memory/weak_ptr.h" | |
| 12 #include "components/dom_distiller/ios/favicon_web_state_dispatcher.h" | |
| 13 | |
| 14 namespace web { | |
| 15 class BrowserState; | |
| 16 } | |
| 17 | |
| 18 namespace dom_distiller { | |
| 19 | |
| 20 // Implementation of the FaviconWebStateDispatcher. | |
| 21 class FaviconWebStateDispatcherImpl : public FaviconWebStateDispatcher { | |
| 22 public: | |
| 23 // Constructor with default delay for keeping the WebStates alive. | |
| 24 explicit FaviconWebStateDispatcherImpl(web::BrowserState* browser_state); | |
| 25 // Constructor for keeping the WebStates alive for |keep_alive_time|. | |
|
sdefresne
2016/12/20 15:41:00
Can you add as comment that -1 means to use the de
gambard
2016/12/20 17:11:42
Done.
| |
| 26 explicit FaviconWebStateDispatcherImpl(web::BrowserState* browser_state, | |
|
sdefresne
2016/12/20 15:41:00
Remove explicit here, it is only for constructor t
gambard
2016/12/20 17:11:42
Done.
| |
| 27 int keep_alive_time); | |
| 28 ~FaviconWebStateDispatcherImpl() override; | |
| 29 | |
| 30 // FaviconWebStateDispatcher implementation. | |
| 31 web::WebState* RequestWebState() override; | |
| 32 void ReturnWebState(web::WebState* web_state) override; | |
| 33 | |
| 34 private: | |
| 35 web::BrowserState* browser_state_; | |
| 36 // Map of the WebStates currently alive. | |
| 37 std::map<web::WebState*, std::unique_ptr<web::WebState>> web_states_; | |
|
sdefresne
2016/12/20 15:41:00
I think it would be simpler to use a std::vector<s
gambard
2016/12/20 17:11:42
Done.
| |
| 38 // Time during which the WebState will be kept alive after being returned. | |
| 39 int keep_alive_time_; | |
| 40 base::WeakPtrFactory<FaviconWebStateDispatcherImpl> weak_ptr_factory_; | |
| 41 }; | |
| 42 | |
| 43 } // namespace dom_distiller | |
| 44 | |
| 45 #endif // IOS_CHROME_BROWSER_DOM_DISTILLER_FAVICON_WEB_STATE_DISPATCHER_IMPL_H_ | |
| OLD | NEW |