OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/chromeos/prerender_condition_network.h" | 5 #include "chrome/browser/chromeos/prerender_condition_network.h" |
6 | 6 |
| 7 #include "chromeos/network/network_state.h" |
| 8 #include "chromeos/network/network_state_handler.h" |
| 9 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 10 |
7 namespace chromeos { | 11 namespace chromeos { |
8 | 12 |
9 PrerenderConditionNetwork::PrerenderConditionNetwork( | 13 PrerenderConditionNetwork::PrerenderConditionNetwork() { |
10 NetworkLibrary* network_library) : network_library_(network_library) { | |
11 DCHECK(network_library_); | |
12 } | 14 } |
13 | 15 |
14 PrerenderConditionNetwork::~PrerenderConditionNetwork() { | 16 PrerenderConditionNetwork::~PrerenderConditionNetwork() { |
15 } | 17 } |
16 | 18 |
17 bool PrerenderConditionNetwork::CanPrerender() const { | 19 bool PrerenderConditionNetwork::CanPrerender() const { |
18 const Network* active_network = network_library_->active_network(); | 20 const NetworkState* default_network = |
19 if (!active_network) | 21 NetworkHandler::Get()->network_state_handler()->DefaultNetwork(); |
| 22 if (!default_network) |
20 return false; | 23 return false; |
21 switch (active_network->type()) { | 24 const std::string& type = default_network->type(); |
22 case TYPE_ETHERNET: | 25 if (type == flimflam::kTypeEthernet || type == flimflam::kTypeWifi) |
23 case TYPE_WIFI: | 26 return true; |
24 return true; | 27 return false; |
25 default: | |
26 return false; | |
27 } | |
28 } | 28 } |
29 | 29 |
30 } // namespace chromeos | 30 } // namespace chromeos |
OLD | NEW |