| 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/ash_switches.h" | 7 #include "ash/ash_switches.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "ash/system/network/sms_observer.h" | 9 #include "ash/system/network/sms_observer.h" |
| 10 #include "ash/system/tray/system_tray.h" | 10 #include "ash/system/tray/system_tray.h" |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 << " text: " << message->text; | 108 << " text: " << message->text; |
| 109 | 109 |
| 110 // Don't show empty messages. Such messages most probably "Message Waiting | 110 // Don't show empty messages. Such messages most probably "Message Waiting |
| 111 // Indication" and it should be determined by data-coding-scheme, | 111 // Indication" and it should be determined by data-coding-scheme, |
| 112 // see crosbug.com/27883. But this field is not exposed from libcros. | 112 // see crosbug.com/27883. But this field is not exposed from libcros. |
| 113 // TODO(dpokuhin): when libcros refactoring done, implement check for | 113 // TODO(dpokuhin): when libcros refactoring done, implement check for |
| 114 // "Message Waiting Indication" to filter out such messages. | 114 // "Message Waiting Indication" to filter out such messages. |
| 115 if (!*message->text) | 115 if (!*message->text) |
| 116 return; | 116 return; |
| 117 | 117 |
| 118 if (CommandLine::ForCurrentProcess()->HasSwitch( | 118 if (!CommandLine::ForCurrentProcess()->HasSwitch(ash::switches::kAshNotify)) { |
| 119 ash::switches::kAshNotifyDisabled)) { | |
| 120 SystemNotification note( | 119 SystemNotification note( |
| 121 profile_, | 120 profile_, |
| 122 "incoming _sms.chromeos", | 121 "incoming _sms.chromeos", |
| 123 IDR_NOTIFICATION_SMS, | 122 IDR_NOTIFICATION_SMS, |
| 124 l10n_util::GetStringFUTF16( | 123 l10n_util::GetStringFUTF16( |
| 125 IDS_SMS_NOTIFICATION_TITLE, UTF8ToUTF16(message->number))); | 124 IDS_SMS_NOTIFICATION_TITLE, UTF8ToUTF16(message->number))); |
| 126 | 125 |
| 127 note.Show(UTF8ToUTF16(message->text), true, false); | 126 note.Show(UTF8ToUTF16(message->text), true, false); |
| 128 return; | 127 return; |
| 129 } | 128 } |
| 130 | 129 |
| 131 // Add an Ash SMS notification. TODO(stevenjb): Replace this code with | 130 // Add an Ash SMS notification. TODO(stevenjb): Replace this code with |
| 132 // NetworkSmsHandler when fixed: crbug.com/133416. | 131 // NetworkSmsHandler when fixed: crbug.com/133416. |
| 133 base::DictionaryValue dict; | 132 base::DictionaryValue dict; |
| 134 dict.SetString(ash::kSmsNumberKey, message->number); | 133 dict.SetString(ash::kSmsNumberKey, message->number); |
| 135 dict.SetString(ash::kSmsTextKey, message->text); | 134 dict.SetString(ash::kSmsTextKey, message->text); |
| 136 ash::Shell::GetInstance()->system_tray()->sms_observer()->AddMessage(dict); | 135 ash::Shell::GetInstance()->system_tray()->sms_observer()->AddMessage(dict); |
| 137 } | 136 } |
| 138 | 137 |
| 139 } // namespace chromeos | 138 } // namespace chromeos |
| OLD | NEW |