| 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/network_message_observer.h" | 5 #include "chrome/browser/chromeos/network_message_observer.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/stl_util-inl.h" | 8 #include "base/stl_util-inl.h" |
| 9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 return; | 223 return; |
| 224 } | 224 } |
| 225 | 225 |
| 226 const CellularNetwork* cellular = cros->cellular_network(); | 226 const CellularNetwork* cellular = cros->cellular_network(); |
| 227 if (!cellular) | 227 if (!cellular) |
| 228 return; | 228 return; |
| 229 const CellularDataPlanVector* plans = | 229 const CellularDataPlanVector* plans = |
| 230 cros->GetDataPlans(cellular->service_path()); | 230 cros->GetDataPlans(cellular->service_path()); |
| 231 | 231 |
| 232 // If no plans available, check to see if we need a new plan. | 232 // If no plans available, check to see if we need a new plan. |
| 233 if (!plans || plans->size() == 0) { | 233 if (!plans || plans->empty()) { |
| 234 // If previously, we had a low data notification, we know that a plan was | 234 // If previously, we had a low data notification, we know that a plan was |
| 235 // near expiring. In that case, because the plan has disappeared, we assume | 235 // near expiring. In that case, because the plan has disappeared, we assume |
| 236 // that it expired. | 236 // that it expired. |
| 237 // Note: even if a user dismissed the notification, it's still visible. | 237 // Note: even if a user dismissed the notification, it's still visible. |
| 238 if (notification_low_data_.visible()) { | 238 if (notification_low_data_.visible()) { |
| 239 ShowNoDataNotification(cellular_data_plan_type_); | 239 ShowNoDataNotification(cellular_data_plan_type_); |
| 240 } else if (cellular->needs_new_plan()) { | 240 } else if (cellular->needs_new_plan()) { |
| 241 ShowNeedsPlanNotification(cellular); | 241 ShowNeedsPlanNotification(cellular); |
| 242 } | 242 } |
| 243 return; | 243 return; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 cellular_data_plan_type_ = current_plan->plan_type; | 275 cellular_data_plan_type_ = current_plan->plan_type; |
| 276 } | 276 } |
| 277 | 277 |
| 278 void NetworkMessageObserver::OnConnectionInitiated(NetworkLibrary* obj, | 278 void NetworkMessageObserver::OnConnectionInitiated(NetworkLibrary* obj, |
| 279 const Network* network) { | 279 const Network* network) { |
| 280 // If user initiated any network connection, we hide the error notification. | 280 // If user initiated any network connection, we hide the error notification. |
| 281 notification_connection_error_.Hide(); | 281 notification_connection_error_.Hide(); |
| 282 } | 282 } |
| 283 | 283 |
| 284 } // namespace chromeos | 284 } // namespace chromeos |
| OLD | NEW |