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

Side by Side Diff: chrome/browser/devtools/devtools_network_conditions.cc

Issue 319133002: DevToolsManagerDelegate: parse all "emulateNetworkConditions" parameters (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 6 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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/devtools/devtools_network_conditions.h" 5 #include "chrome/browser/devtools/devtools_network_conditions.h"
6 6
7 #include "url/gurl.h" 7 #include "url/gurl.h"
8 8
9 DevToolsNetworkConditions::DevToolsNetworkConditions( 9 DevToolsNetworkConditions::DevToolsNetworkConditions(
10 const std::vector<std::string>& domains) 10 const std::vector<std::string>& domains,
11 : domains_(domains){ 11 double maximal_throughput)
12 : domains_(domains),
13 maximal_throughput_(maximal_throughput) {
12 } 14 }
13 15
14 DevToolsNetworkConditions::~DevToolsNetworkConditions() { 16 DevToolsNetworkConditions::~DevToolsNetworkConditions() {
15 } 17 }
16 18
17 bool DevToolsNetworkConditions::HasMatchingDomain(const GURL& url) const { 19 bool DevToolsNetworkConditions::HasMatchingDomain(const GURL& url) const {
18 Domains::const_iterator domain = domains_.begin(); 20 Domains::const_iterator domain = domains_.begin();
19 if (domain == domains_.end()) 21 if (domain == domains_.end())
20 return true; 22 return true;
21 for (; domain != domains_.end(); ++domain) { 23 for (; domain != domains_.end(); ++domain) {
22 if (url.DomainIs(domain->data())) 24 if (url.DomainIs(domain->data()))
23 return true; 25 return true;
24 } 26 }
25 return false; 27 return false;
26 } 28 }
27 29
28 bool DevToolsNetworkConditions::IsOffline() const { 30 bool DevToolsNetworkConditions::IsOffline() const {
29 return true; 31 return maximal_throughput_ == 0.0;
30 } 32 }
33
34 bool DevToolsNetworkConditions::IsThrottling() const {
35 return maximal_throughput_ != 0.0;
36 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698