OLD | NEW |
---|---|
(Empty) | |
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. | |
4 | |
5 #ifndef COMPONENTS_DATA_REDUCTION_PROXY_CONTENT_BROWSER_CONTENT_LOFI_UI_SERVICE_ H_ | |
6 #define COMPONENTS_DATA_REDUCTION_PROXY_CONTENT_BROWSER_CONTENT_LOFI_UI_SERVICE_ H_ | |
7 | |
8 #include "base/callback.h" | |
9 #include "base/macros.h" | |
10 #include "base/memory/ref_counted.h" | |
11 #include "components/data_reduction_proxy/core/common/lofi_ui_service.h" | |
12 | |
13 namespace base { | |
14 class SingleThreadTaskRunner; | |
15 } | |
16 | |
17 namespace content { | |
18 class WebContents; | |
19 } | |
20 | |
21 namespace net { | |
22 class URLRequest; | |
23 } | |
24 | |
25 namespace data_reduction_proxy { | |
26 | |
27 // Passes notifications to the UI thread that a Lo-Fi response has been | |
28 // received. These notifications are used to show Lo-Fi UI in Android. | |
tbansal1
2016/01/05 03:10:59
Please comment on whether this class is thread saf
megjablon
2016/01/05 20:13:03
Done.
| |
29 class ContentLoFiUIService : public LoFiUIService { | |
30 public: | |
31 typedef base::Callback<void(content::WebContents* web_contents)> | |
32 NotifyLoFiResponseReceivedCallback; | |
33 | |
34 ContentLoFiUIService( | |
35 const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner, | |
36 const NotifyLoFiResponseReceivedCallback& | |
37 notify_lofi_response_received_callback); | |
38 ~ContentLoFiUIService() override; | |
39 | |
40 // Using the |render_process_id| and |render_frame_id|, gets the associated | |
41 // WebContents if it exists and runs the | |
42 // |notify_lofi_response_received_callback_|. | |
43 void NotifyLoFiResponseReceivedOnUI(int render_process_id, | |
44 int render_frame_id) const; | |
45 | |
46 // LoFiUIService implementation: | |
47 void NotifyLoFiReponseReceived(const net::URLRequest& request) const override; | |
48 | |
49 private: | |
50 // A task runner to post calls to NotifyLoFiReponseReceivedOnUI on the UI | |
51 // thread. | |
52 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; | |
tbansal1
2016/01/05 03:10:59
add const qualifier to these two variables.
megjablon
2016/01/05 20:13:03
Done.
| |
53 NotifyLoFiResponseReceivedCallback notify_lofi_response_received_callback_; | |
54 | |
55 DISALLOW_COPY_AND_ASSIGN(ContentLoFiUIService); | |
56 }; | |
57 | |
58 } // namespace data_reduction_proxy | |
59 | |
60 #endif // COMPONENTS_DATA_REDUCTION_PROXY_CONTENT_BROWSER_CONTENT_LOFI_UI_SERVI CE_H_ | |
OLD | NEW |