Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: components/data_reduction_proxy/content/browser/content_lofi_ui_service.h

Issue 1558553002: Lo-Fi snackbar should only be shown for the first q=low response of a page (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tbansal comments Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 typedef base::Callback<void(content::WebContents* web_contents)>
28 NotifyLoFiResponseReceivedCallback;
29
30 // Passes notifications to the UI thread that a Lo-Fi response has been
31 // received. These notifications may be used to show Lo-Fi UI. This object lives
32 // on the IO thread and NotifyLoFiReponseReceived should be called from there.
33 class ContentLoFiUIService : public LoFiUIService {
34 public:
35 ContentLoFiUIService(
36 const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner,
37 const NotifyLoFiResponseReceivedCallback&
38 notify_lofi_response_received_callback);
39 ~ContentLoFiUIService() override;
40
41 // LoFiUIService implementation:
42 void NotifyLoFiReponseReceived(const net::URLRequest& request) override;
43
44 private:
45 // Using the |render_process_id| and |render_frame_id|, gets the associated
46 // WebContents if it exists and runs the
47 // |notify_lofi_response_received_callback_|.
48 void NotifyLoFiResponseReceivedOnUI(int render_process_id,
49 int render_frame_id);
50
51 // A task runner to post calls to NotifyLoFiReponseReceivedOnUI on the UI
52 // thread.
53 const scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_;
54 const NotifyLoFiResponseReceivedCallback
55 notify_lofi_response_received_callback_;
56
57 DISALLOW_COPY_AND_ASSIGN(ContentLoFiUIService);
58 };
59
60 } // namespace data_reduction_proxy
61
62 #endif // COMPONENTS_DATA_REDUCTION_PROXY_CONTENT_BROWSER_CONTENT_LOFI_UI_SERVI CE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698