Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(109)

Unified Diff: chrome/browser/chromeos/sms_observer.cc

Issue 10668026: Merge 143291 - Re-factor TraySms to use ash::SmsObserver instead of NetoworkSmsHandler. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1180/src/
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chromeos/profile_startup.cc ('k') | chromeos/network/network_sms_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/sms_observer.cc
===================================================================
--- chrome/browser/chromeos/sms_observer.cc (revision 143914)
+++ chrome/browser/chromeos/sms_observer.cc (working copy)
@@ -4,6 +4,11 @@
#include "chrome/browser/chromeos/sms_observer.h"
+#include "ash/ash_switches.h"
+#include "ash/shell.h"
+#include "ash/system/network/sms_observer.h"
+#include "ash/system/tray/system_tray.h"
+#include "base/command_line.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/chromeos/cros/cros_library.h"
#include "chrome/browser/chromeos/notifications/system_notification.h"
@@ -110,14 +115,25 @@
if (!*message->text)
return;
- SystemNotification note(
- profile_,
- "incoming _sms.chromeos",
- IDR_NOTIFICATION_SMS,
- l10n_util::GetStringFUTF16(
- IDS_SMS_NOTIFICATION_TITLE, UTF8ToUTF16(message->number)));
+ if (CommandLine::ForCurrentProcess()->HasSwitch(
+ ash::switches::kAshNotifyDisabled)) {
+ SystemNotification note(
+ profile_,
+ "incoming _sms.chromeos",
+ IDR_NOTIFICATION_SMS,
+ l10n_util::GetStringFUTF16(
+ IDS_SMS_NOTIFICATION_TITLE, UTF8ToUTF16(message->number)));
- note.Show(UTF8ToUTF16(message->text), true, false);
+ note.Show(UTF8ToUTF16(message->text), true, false);
+ return;
+ }
+
+ // Add an Ash SMS notification. TODO(stevenjb): Replace this code with
+ // NetworkSmsHandler when fixed: crbug.com/133416.
+ base::DictionaryValue dict;
+ dict.SetString(ash::kSmsNumberKey, message->number);
+ dict.SetString(ash::kSmsTextKey, message->text);
+ ash::Shell::GetInstance()->system_tray()->sms_observer()->AddMessage(dict);
}
} // namespace chromeos
« no previous file with comments | « chrome/browser/chromeos/profile_startup.cc ('k') | chromeos/network/network_sms_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698