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 <memory> | |
9 #include <vector> | |
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_second| | |
26 // seconds. If |keep_alive_time_second| < 0 then the default value is used. | |
sdefresne
2016/12/20 18:05:31
nit: I think |keep_alive_seconds| is better (using
gambard
2016/12/21 08:42:52
Done.
| |
27 FaviconWebStateDispatcherImpl(web::BrowserState* browser_state, | |
28 int keep_alive_time_second); | |
Eugene But (OOO till 7-30)
2016/12/20 17:36:18
Do you want to drop |FaviconWebStateDispatcherImpl
sdefresne
2016/12/20 18:05:31
Another option would be to have a default value fo
Eugene But (OOO till 7-30)
2016/12/20 18:59:02
Default values are somewhat discouraged by C++ Sty
gambard
2016/12/21 08:42:52
Done.
| |
29 ~FaviconWebStateDispatcherImpl() override; | |
30 | |
31 // FaviconWebStateDispatcher implementation. | |
32 web::WebState* RequestWebState() override; | |
33 void ReturnWebState(web::WebState* web_state) override; | |
34 | |
35 private: | |
36 web::BrowserState* browser_state_; | |
37 // Map of the WebStates currently alive. | |
38 std::vector<std::unique_ptr<web::WebState>> web_states_; | |
39 // Time during which the WebState will be kept alive after being returned. | |
40 int keep_alive_time_second_; | |
41 base::WeakPtrFactory<FaviconWebStateDispatcherImpl> weak_ptr_factory_; | |
42 }; | |
43 | |
44 } // namespace dom_distiller | |
45 | |
46 #endif // IOS_CHROME_BROWSER_DOM_DISTILLER_FAVICON_WEB_STATE_DISPATCHER_IMPL_H_ | |
OLD | NEW |