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

Unified Diff: chrome/browser/chromeos/cros/network_ip_config.cc

Issue 10827283: This updates the StaticIP configuration UI to match new mocks. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix unit test Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chromeos/cros/network_ip_config.h ('k') | chrome/browser/chromeos/cros/network_library.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/cros/network_ip_config.cc
diff --git a/chrome/browser/chromeos/cros/network_ip_config.cc b/chrome/browser/chromeos/cros/network_ip_config.cc
index 44f6c4f9cd4309809d9baf6e038dcb377ccd9c31..4dd105e0f369a319a5fe08946193c6458099e930 100644
--- a/chrome/browser/chromeos/cros/network_ip_config.cc
+++ b/chrome/browser/chromeos/cros/network_ip_config.cc
@@ -5,7 +5,6 @@
#include "chrome/browser/chromeos/cros/network_ip_config.h"
#include "base/logging.h"
-#include "base/string_tokenizer.h"
namespace chromeos {
@@ -51,49 +50,4 @@ std::string NetworkIPConfig::ToString() const {
+ " name_servers: " + name_servers;
}
-int32 NetworkIPConfig::GetPrefixLength() const {
- int count = 0;
- int prefixlen = 0;
- StringTokenizer t(netmask, ".");
- while (t.GetNext()) {
- // If there are more than 4 numbers, then it's invalid.
- if (count == 4) {
- return -1;
- }
- std::string token = t.token();
- // If we already found the last mask and the current one is not
- // "0" then the netmask is invalid. For example, 255.224.255.0
- if (prefixlen / 8 != count) {
- if (token != "0") {
- return -1;
- }
- } else if (token == "255") {
- prefixlen += 8;
- } else if (token == "254") {
- prefixlen += 7;
- } else if (token == "252") {
- prefixlen += 6;
- } else if (token == "248") {
- prefixlen += 5;
- } else if (token == "240") {
- prefixlen += 4;
- } else if (token == "224") {
- prefixlen += 3;
- } else if (token == "192") {
- prefixlen += 2;
- } else if (token == "128") {
- prefixlen += 1;
- } else if (token == "0") {
- prefixlen += 0;
- } else {
- // mask is not a valid number.
- return -1;
- }
- count++;
- }
- if (count < 4)
- return -1;
- return prefixlen;
-}
-
} // namespace chromeos
« no previous file with comments | « chrome/browser/chromeos/cros/network_ip_config.h ('k') | chrome/browser/chromeos/cros/network_library.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698