| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/shell_delegate.h" | 8 #include "ash/shell_delegate.h" |
| 9 #include "ash/system/network/network_observer.h" | 9 #include "ash/system/network/network_observer.h" |
| 10 #include "ash/system/tray/system_tray.h" | 10 #include "ash/system/tray/system_tray.h" |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/stl_util.h" | 13 #include "base/stl_util.h" |
| 14 #include "base/string_number_conversions.h" | 14 #include "base/string_number_conversions.h" |
| 15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
| 16 #include "chrome/browser/chromeos/cros/cros_library.h" | 16 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 17 #include "chrome/browser/chromeos/cros/network_library.h" | 17 #include "chrome/browser/chromeos/cros/network_library.h" |
| 18 #include "chrome/browser/chromeos/notifications/balloon_view_host_chromeos.h" | 18 #include "chrome/browser/chromeos/notifications/balloon_view_host_chromeos.h" |
| 19 #include "chrome/browser/prefs/pref_service.h" | 19 #include "chrome/browser/prefs/pref_service.h" |
| 20 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
| 21 #include "chrome/browser/profiles/profile_manager.h" | 21 #include "chrome/browser/profiles/profile_manager.h" |
| 22 #include "chrome/browser/ui/browser.h" | 22 #include "chrome/browser/ui/browser.h" |
| 23 #include "chrome/browser/ui/browser_finder.h" | 23 #include "chrome/browser/ui/browser_finder.h" |
| 24 #include "chrome/browser/ui/host_desktop.h" |
| 24 #include "chrome/browser/ui/singleton_tabs.h" | 25 #include "chrome/browser/ui/singleton_tabs.h" |
| 25 #include "chrome/common/pref_names.h" | 26 #include "chrome/common/pref_names.h" |
| 26 #include "chrome/common/time_format.h" | 27 #include "chrome/common/time_format.h" |
| 27 #include "grit/generated_resources.h" | 28 #include "grit/generated_resources.h" |
| 28 #include "ui/base/l10n/l10n_util.h" | 29 #include "ui/base/l10n/l10n_util.h" |
| 29 | 30 |
| 30 namespace { | 31 namespace { |
| 31 | 32 |
| 32 // Returns prefs::kShowPlanNotifications in the profile of the last active | 33 // Returns prefs::kShowPlanNotifications in the profile of the last active |
| 33 // browser. If there is no active browser, returns true. | 34 // browser. If there is no active browser, returns true. |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 return has_data && will_apply; | 147 return has_data && will_apply; |
| 147 } | 148 } |
| 148 | 149 |
| 149 void NetworkMessageObserver::OpenMobileSetupPage( | 150 void NetworkMessageObserver::OpenMobileSetupPage( |
| 150 const std::string& service_path, const ListValue* args) { | 151 const std::string& service_path, const ListValue* args) { |
| 151 ash::Shell::GetInstance()->delegate()->OpenMobileSetup(service_path); | 152 ash::Shell::GetInstance()->delegate()->OpenMobileSetup(service_path); |
| 152 } | 153 } |
| 153 | 154 |
| 154 void NetworkMessageObserver::OpenMoreInfoPage(const ListValue* args) { | 155 void NetworkMessageObserver::OpenMoreInfoPage(const ListValue* args) { |
| 155 Browser* browser = browser::FindOrCreateTabbedBrowser( | 156 Browser* browser = browser::FindOrCreateTabbedBrowser( |
| 156 ProfileManager::GetDefaultProfileOrOffTheRecord()); | 157 ProfileManager::GetDefaultProfileOrOffTheRecord(), |
| 158 chrome::HOST_DESKTOP_TYPE_ASH); |
| 157 chromeos::NetworkLibrary* lib = | 159 chromeos::NetworkLibrary* lib = |
| 158 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); | 160 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); |
| 159 const chromeos::CellularNetwork* cellular = lib->cellular_network(); | 161 const chromeos::CellularNetwork* cellular = lib->cellular_network(); |
| 160 if (!cellular) | 162 if (!cellular) |
| 161 return; | 163 return; |
| 162 chrome::ShowSingletonTab(browser, GURL(cellular->payment_url())); | 164 chrome::ShowSingletonTab(browser, GURL(cellular->payment_url())); |
| 163 } | 165 } |
| 164 | 166 |
| 165 void NetworkMessageObserver::InitNewPlan(const CellularDataPlan* plan) { | 167 void NetworkMessageObserver::InitNewPlan(const CellularDataPlan* plan) { |
| 166 notification_low_data_->Hide(); | 168 notification_low_data_->Hide(); |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 if (plan) { | 361 if (plan) { |
| 360 cellular_data_plan_unique_id_ = plan->GetUniqueIdentifier(); | 362 cellular_data_plan_unique_id_ = plan->GetUniqueIdentifier(); |
| 361 cellular_data_plan_type_ = plan->plan_type; | 363 cellular_data_plan_type_ = plan->plan_type; |
| 362 } else { | 364 } else { |
| 363 cellular_data_plan_unique_id_ = std::string(); | 365 cellular_data_plan_unique_id_ = std::string(); |
| 364 cellular_data_plan_type_ = CELLULAR_DATA_PLAN_UNKNOWN; | 366 cellular_data_plan_type_ = CELLULAR_DATA_PLAN_UNKNOWN; |
| 365 } | 367 } |
| 366 } | 368 } |
| 367 | 369 |
| 368 } // namespace chromeos | 370 } // namespace chromeos |
| OLD | NEW |