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 "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
12 #include "base/string_number_conversions.h" | 12 #include "base/string_number_conversions.h" |
13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
14 #include "chrome/browser/chromeos/cros/cros_library.h" | 14 #include "chrome/browser/chromeos/cros/cros_library.h" |
15 #include "chrome/browser/chromeos/cros/network_library.h" | 15 #include "chrome/browser/chromeos/cros/network_library.h" |
16 #include "chrome/browser/chromeos/notifications/balloon_view_host_chromeos.h" | 16 #include "chrome/browser/chromeos/notifications/balloon_view_host_chromeos.h" |
17 #include "chrome/browser/prefs/pref_service.h" | 17 #include "chrome/browser/prefs/pref_service.h" |
18 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
19 #include "chrome/browser/profiles/profile_manager.h" | 19 #include "chrome/browser/profiles/profile_manager.h" |
20 #include "chrome/browser/ui/browser.h" | 20 #include "chrome/browser/ui/browser.h" |
21 #include "chrome/browser/ui/browser_list.h" | 21 #include "chrome/browser/ui/browser_finder.h" |
22 #include "chrome/common/pref_names.h" | 22 #include "chrome/common/pref_names.h" |
23 #include "chrome/common/time_format.h" | 23 #include "chrome/common/time_format.h" |
24 #include "grit/generated_resources.h" | 24 #include "grit/generated_resources.h" |
25 #include "grit/theme_resources.h" | 25 #include "grit/theme_resources.h" |
26 #include "ui/base/l10n/l10n_util.h" | 26 #include "ui/base/l10n/l10n_util.h" |
27 | 27 |
28 namespace { | 28 namespace { |
29 | 29 |
30 // Returns prefs::kShowPlanNotifications in the profile of the last active | 30 // Returns prefs::kShowPlanNotifications in the profile of the last active |
31 // browser. If there is no active browser, returns true. | 31 // browser. If there is no active browser, returns true. |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 bool will_apply = | 79 bool will_apply = |
80 (other_plan->plan_start_time - plan->plan_end_time).InSeconds() <= 1; | 80 (other_plan->plan_start_time - plan->plan_end_time).InSeconds() <= 1; |
81 return has_data && will_apply; | 81 return has_data && will_apply; |
82 } | 82 } |
83 | 83 |
84 void NetworkMessageObserver::OpenMobileSetupPage(const ListValue* args) { | 84 void NetworkMessageObserver::OpenMobileSetupPage(const ListValue* args) { |
85 ash::Shell::GetInstance()->delegate()->OpenMobileSetup(); | 85 ash::Shell::GetInstance()->delegate()->OpenMobileSetup(); |
86 } | 86 } |
87 | 87 |
88 void NetworkMessageObserver::OpenMoreInfoPage(const ListValue* args) { | 88 void NetworkMessageObserver::OpenMoreInfoPage(const ListValue* args) { |
89 Browser* browser = Browser::GetOrCreateTabbedBrowser( | 89 Browser* browser = browser::FindOrCreateTabbedBrowser( |
90 ProfileManager::GetDefaultProfileOrOffTheRecord()); | 90 ProfileManager::GetDefaultProfileOrOffTheRecord()); |
91 chromeos::NetworkLibrary* lib = | 91 chromeos::NetworkLibrary* lib = |
92 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); | 92 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); |
93 const chromeos::CellularNetwork* cellular = lib->cellular_network(); | 93 const chromeos::CellularNetwork* cellular = lib->cellular_network(); |
94 if (!cellular) | 94 if (!cellular) |
95 return; | 95 return; |
96 browser->ShowSingletonTab(GURL(cellular->payment_url())); | 96 browser->ShowSingletonTab(GURL(cellular->payment_url())); |
97 } | 97 } |
98 | 98 |
99 void NetworkMessageObserver::InitNewPlan(const CellularDataPlan* plan) { | 99 void NetworkMessageObserver::InitNewPlan(const CellularDataPlan* plan) { |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 if (plan) { | 278 if (plan) { |
279 cellular_data_plan_unique_id_ = plan->GetUniqueIdentifier(); | 279 cellular_data_plan_unique_id_ = plan->GetUniqueIdentifier(); |
280 cellular_data_plan_type_ = plan->plan_type; | 280 cellular_data_plan_type_ = plan->plan_type; |
281 } else { | 281 } else { |
282 cellular_data_plan_unique_id_ = std::string(); | 282 cellular_data_plan_unique_id_ = std::string(); |
283 cellular_data_plan_type_ = CELLULAR_DATA_PLAN_UNKNOWN; | 283 cellular_data_plan_type_ = CELLULAR_DATA_PLAN_UNKNOWN; |
284 } | 284 } |
285 } | 285 } |
286 | 286 |
287 } // namespace chromeos | 287 } // namespace chromeos |
OLD | NEW |