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/sms_observer.h" | 5 #include "chrome/browser/chromeos/sms_observer.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/system/chromeos/network/sms_observer.h" | 8 #include "ash/system/chromeos/network/sms_observer.h" |
9 #include "ash/system/tray/system_tray.h" | 9 #include "ash/system/tray/system_tray.h" |
10 #include "ash/system/tray/system_tray_notifier.h" | 10 #include "ash/system/tray/system_tray_notifier.h" |
11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
12 #include "chrome/browser/chromeos/cros/cros_library.h" | 12 #include "chrome/browser/chromeos/cros/cros_library.h" |
13 #include "chromeos/network/cros_network_functions.h" | 13 #include "chromeos/network/cros_network_functions.h" |
14 #include "grit/generated_resources.h" | 14 #include "grit/generated_resources.h" |
15 #include "grit/theme_resources.h" | 15 #include "grit/theme_resources.h" |
16 #include "ui/base/l10n/l10n_util.h" | 16 #include "ui/base/l10n/l10n_util.h" |
17 | 17 |
18 namespace chromeos { | 18 namespace chromeos { |
19 | 19 |
20 SmsObserver::SmsObserver(Profile* profile) | 20 SmsObserver::SmsObserver() { |
21 : profile_(profile) { | |
22 DCHECK(profile_); | |
23 UpdateObservers(chromeos::CrosLibrary::Get()->GetNetworkLibrary()); | 21 UpdateObservers(chromeos::CrosLibrary::Get()->GetNetworkLibrary()); |
24 } | 22 } |
25 | 23 |
26 SmsObserver::~SmsObserver() { | 24 SmsObserver::~SmsObserver() { |
27 NetworkLibrary* library = chromeos::CrosLibrary::Get()->GetNetworkLibrary(); | 25 NetworkLibrary* library = chromeos::CrosLibrary::Get()->GetNetworkLibrary(); |
28 library->RemoveNetworkManagerObserver(this); | 26 library->RemoveNetworkManagerObserver(this); |
29 DisconnectAll(); | 27 DisconnectAll(); |
30 } | 28 } |
31 | 29 |
32 void SmsObserver::UpdateObservers(NetworkLibrary* library) { | 30 void SmsObserver::UpdateObservers(NetworkLibrary* library) { |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 | 108 |
111 // Add an Ash SMS notification. TODO(stevenjb): Replace this code with | 109 // Add an Ash SMS notification. TODO(stevenjb): Replace this code with |
112 // NetworkSmsHandler when fixed: crbug.com/133416. | 110 // NetworkSmsHandler when fixed: crbug.com/133416. |
113 base::DictionaryValue dict; | 111 base::DictionaryValue dict; |
114 dict.SetString(ash::kSmsNumberKey, message.number); | 112 dict.SetString(ash::kSmsNumberKey, message.number); |
115 dict.SetString(ash::kSmsTextKey, message.text); | 113 dict.SetString(ash::kSmsTextKey, message.text); |
116 ash::Shell::GetInstance()->system_tray_notifier()->NotifyAddSmsMessage(dict); | 114 ash::Shell::GetInstance()->system_tray_notifier()->NotifyAddSmsMessage(dict); |
117 } | 115 } |
118 | 116 |
119 } // namespace chromeos | 117 } // namespace chromeos |
OLD | NEW |