OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/cros/network_library.h" | 5 #include "chrome/browser/chromeos/cros/network_library.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
608 } | 608 } |
609 return significant; | 609 return significant; |
610 } | 610 } |
611 | 611 |
612 CellularNetwork::DataLeft CellularNetwork::GetDataLeft() const { | 612 CellularNetwork::DataLeft CellularNetwork::GetDataLeft() const { |
613 // If we need a new plan, then there's no data. | 613 // If we need a new plan, then there's no data. |
614 if (needs_new_plan()) | 614 if (needs_new_plan()) |
615 return DATA_NONE; | 615 return DATA_NONE; |
616 const CellularDataPlan* plan = GetSignificantDataPlan(); | 616 const CellularDataPlan* plan = GetSignificantDataPlan(); |
617 if (!plan) | 617 if (!plan) |
618 return DATA_NORMAL; | 618 return DATA_UNKNOWN; |
619 if (plan->plan_type == CELLULAR_DATA_PLAN_UNLIMITED) { | 619 if (plan->plan_type == CELLULAR_DATA_PLAN_UNLIMITED) { |
620 base::TimeDelta remaining = plan->remaining_time(); | 620 base::TimeDelta remaining = plan->remaining_time(); |
621 if (remaining <= base::TimeDelta::FromSeconds(0)) | 621 if (remaining <= base::TimeDelta::FromSeconds(0)) |
622 return DATA_NONE; | 622 return DATA_NONE; |
623 if (remaining <= base::TimeDelta::FromSeconds(kCellularDataVeryLowSecs)) | 623 if (remaining <= base::TimeDelta::FromSeconds(kCellularDataVeryLowSecs)) |
624 return DATA_VERY_LOW; | 624 return DATA_VERY_LOW; |
625 if (remaining <= base::TimeDelta::FromSeconds(kCellularDataLowSecs)) | 625 if (remaining <= base::TimeDelta::FromSeconds(kCellularDataLowSecs)) |
626 return DATA_LOW; | 626 return DATA_LOW; |
627 } else if (plan->plan_type == CELLULAR_DATA_PLAN_METERED_PAID || | 627 } else if (plan->plan_type == CELLULAR_DATA_PLAN_METERED_PAID || |
628 plan->plan_type == CELLULAR_DATA_PLAN_METERED_BASE) { | 628 plan->plan_type == CELLULAR_DATA_PLAN_METERED_BASE) { |
(...skipping 1415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2044 return new NetworkLibraryStubImpl(); | 2044 return new NetworkLibraryStubImpl(); |
2045 else | 2045 else |
2046 return new NetworkLibraryImpl(); | 2046 return new NetworkLibraryImpl(); |
2047 } | 2047 } |
2048 | 2048 |
2049 } // namespace chromeos | 2049 } // namespace chromeos |
2050 | 2050 |
2051 // Allows InvokeLater without adding refcounting. This class is a Singleton and | 2051 // Allows InvokeLater without adding refcounting. This class is a Singleton and |
2052 // won't be deleted until it's last InvokeLater is run. | 2052 // won't be deleted until it's last InvokeLater is run. |
2053 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::NetworkLibraryImpl); | 2053 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::NetworkLibraryImpl); |
OLD | NEW |