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

Side by Side Diff: chrome/browser/android/offline_pages/offline_page_tab_helper.cc

Issue 2183153002: NQE: Move ECT to net:: namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased, also fixed comnpilation error Created 4 years, 4 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
« no previous file with comments | « no previous file | chrome/browser/android/offline_pages/offline_page_tab_helper_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 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/android/offline_pages/offline_page_tab_helper.h" 5 #include "chrome/browser/android/offline_pages/offline_page_tab_helper.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 // Whether using offline pages for slow networks is allowed and the network is 47 // Whether using offline pages for slow networks is allowed and the network is
48 // currently estimated to be prohibitively slow. 48 // currently estimated to be prohibitively slow.
49 bool ShouldUseOfflineForSlowNetwork(content::BrowserContext* context) { 49 bool ShouldUseOfflineForSlowNetwork(content::BrowserContext* context) {
50 if (!previews::IsOfflinePreviewsEnabled()) 50 if (!previews::IsOfflinePreviewsEnabled())
51 return false; 51 return false;
52 Profile* profile = Profile::FromBrowserContext(context); 52 Profile* profile = Profile::FromBrowserContext(context);
53 UINetworkQualityEstimatorService* nqe_service = 53 UINetworkQualityEstimatorService* nqe_service =
54 UINetworkQualityEstimatorServiceFactory::GetForProfile(profile); 54 UINetworkQualityEstimatorServiceFactory::GetForProfile(profile);
55 if (!nqe_service) 55 if (!nqe_service)
56 return false; 56 return false;
57 net::NetworkQualityEstimator::EffectiveConnectionType 57 net::EffectiveConnectionType effective_connection_type =
58 effective_connection_type = nqe_service->GetEffectiveConnectionType(); 58 nqe_service->GetEffectiveConnectionType();
59 return effective_connection_type >= 59 return effective_connection_type >= net::EFFECTIVE_CONNECTION_TYPE_OFFLINE &&
60 net::NetworkQualityEstimator::EFFECTIVE_CONNECTION_TYPE_OFFLINE && 60 effective_connection_type <= net::EFFECTIVE_CONNECTION_TYPE_SLOW_2G;
61 effective_connection_type <=
62 net::NetworkQualityEstimator::EFFECTIVE_CONNECTION_TYPE_SLOW_2G;
63 } 61 }
64 62
65 class DefaultDelegate : public OfflinePageTabHelper::Delegate { 63 class DefaultDelegate : public OfflinePageTabHelper::Delegate {
66 public: 64 public:
67 DefaultDelegate() {} 65 DefaultDelegate() {}
68 // offline_pages::OfflinePageTabHelper::Delegate implementation: 66 // offline_pages::OfflinePageTabHelper::Delegate implementation:
69 bool GetTabId(content::WebContents* web_contents, 67 bool GetTabId(content::WebContents* web_contents,
70 std::string* tab_id) const override { 68 std::string* tab_id) const override {
71 int temp_tab_id; 69 int temp_tab_id;
72 if (!OfflinePageUtils::GetTabId(web_contents, &temp_tab_id)) 70 if (!OfflinePageUtils::GetTabId(web_contents, &temp_tab_id))
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 entry->GetRedirectChain().back() == to_url; 321 entry->GetRedirectChain().back() == to_url;
324 } 322 }
325 323
326 void OfflinePageTabHelper::ReportRedirectResultUMA(RedirectResult result) { 324 void OfflinePageTabHelper::ReportRedirectResultUMA(RedirectResult result) {
327 UMA_HISTOGRAM_ENUMERATION("OfflinePages.RedirectResult", 325 UMA_HISTOGRAM_ENUMERATION("OfflinePages.RedirectResult",
328 static_cast<int>(result), 326 static_cast<int>(result),
329 static_cast<int>(RedirectResult::REDIRECT_RESULT_MAX)); 327 static_cast<int>(RedirectResult::REDIRECT_RESULT_MAX));
330 } 328 }
331 329
332 } // namespace offline_pages 330 } // namespace offline_pages
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/android/offline_pages/offline_page_tab_helper_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698