OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_io_data.h" | 5 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_io_data.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 previews_service->previews_ui_service()->AddPreviewNavigation(url, type, | 53 previews_service->previews_ui_service()->AddPreviewNavigation(url, type, |
54 opt_out); | 54 opt_out); |
55 } | 55 } |
56 } | 56 } |
57 | 57 |
58 // If this is the first Lo-Fi response for a page load, a | 58 // If this is the first Lo-Fi response for a page load, a |
59 // PreviewsInfoBarDelegate is created, which handles showing Lo-Fi UI. | 59 // PreviewsInfoBarDelegate is created, which handles showing Lo-Fi UI. |
60 void OnLoFiResponseReceivedOnUI(content::WebContents* web_contents) { | 60 void OnLoFiResponseReceivedOnUI(content::WebContents* web_contents) { |
61 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 61 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
62 PreviewsInfoBarDelegate::Create( | 62 PreviewsInfoBarDelegate::Create( |
63 web_contents, previews::PreviewsType::LOFI, true /* is_data_saver_user */, | 63 web_contents, previews::PreviewsType::LOFI, |
| 64 base::Time() /* previews_freshness */, true /* is_data_saver_user */, |
64 base::Bind(&AddPreviewNavigationToBlackListCallback, | 65 base::Bind(&AddPreviewNavigationToBlackListCallback, |
65 web_contents->GetBrowserContext(), | 66 web_contents->GetBrowserContext(), |
66 web_contents->GetController() | 67 web_contents->GetController() |
67 .GetLastCommittedEntry() | 68 .GetLastCommittedEntry() |
68 ->GetRedirectChain()[0], | 69 ->GetRedirectChain()[0], |
69 previews::PreviewsType::LOFI)); | 70 previews::PreviewsType::LOFI)); |
70 } | 71 } |
71 | 72 |
72 } // namespace | 73 } // namespace |
73 | 74 |
(...skipping 19 matching lines...) Expand all Loading... |
93 data_reduction_proxy_io_data->set_lofi_decider( | 94 data_reduction_proxy_io_data->set_lofi_decider( |
94 base::MakeUnique<data_reduction_proxy::ContentLoFiDecider>()); | 95 base::MakeUnique<data_reduction_proxy::ContentLoFiDecider>()); |
95 data_reduction_proxy_io_data->set_resource_type_provider( | 96 data_reduction_proxy_io_data->set_resource_type_provider( |
96 base::MakeUnique<data_reduction_proxy::ContentResourceTypeProvider>()); | 97 base::MakeUnique<data_reduction_proxy::ContentResourceTypeProvider>()); |
97 data_reduction_proxy_io_data->set_lofi_ui_service( | 98 data_reduction_proxy_io_data->set_lofi_ui_service( |
98 base::MakeUnique<data_reduction_proxy::ContentLoFiUIService>( | 99 base::MakeUnique<data_reduction_proxy::ContentLoFiUIService>( |
99 ui_task_runner, base::Bind(&OnLoFiResponseReceivedOnUI))); | 100 ui_task_runner, base::Bind(&OnLoFiResponseReceivedOnUI))); |
100 | 101 |
101 return data_reduction_proxy_io_data; | 102 return data_reduction_proxy_io_data; |
102 } | 103 } |
OLD | NEW |