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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/chromeos/profile_startup.cc ('k') | chromeos/network/network_sms_handler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
8 #include "ash/shell.h"
9 #include "ash/system/network/sms_observer.h"
10 #include "ash/system/tray/system_tray.h"
11 #include "base/command_line.h"
7 #include "base/utf_string_conversions.h" 12 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/chromeos/cros/cros_library.h" 13 #include "chrome/browser/chromeos/cros/cros_library.h"
9 #include "chrome/browser/chromeos/notifications/system_notification.h" 14 #include "chrome/browser/chromeos/notifications/system_notification.h"
10 #include "grit/generated_resources.h" 15 #include "grit/generated_resources.h"
11 #include "grit/theme_resources.h" 16 #include "grit/theme_resources.h"
12 #include "ui/base/l10n/l10n_util.h" 17 #include "ui/base/l10n/l10n_util.h"
13 18
14 namespace chromeos { 19 namespace chromeos {
15 20
16 SmsObserver::SmsObserver(Profile* profile) 21 SmsObserver::SmsObserver(Profile* profile)
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 << " text: " << message->text; 108 << " text: " << message->text;
104 109
105 // Don't show empty messages. Such messages most probably "Message Waiting 110 // Don't show empty messages. Such messages most probably "Message Waiting
106 // Indication" and it should be determined by data-coding-scheme, 111 // Indication" and it should be determined by data-coding-scheme,
107 // 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.
108 // TODO(dpokuhin): when libcros refactoring done, implement check for 113 // TODO(dpokuhin): when libcros refactoring done, implement check for
109 // "Message Waiting Indication" to filter out such messages. 114 // "Message Waiting Indication" to filter out such messages.
110 if (!*message->text) 115 if (!*message->text)
111 return; 116 return;
112 117
113 SystemNotification note( 118 if (CommandLine::ForCurrentProcess()->HasSwitch(
114 profile_, 119 ash::switches::kAshNotifyDisabled)) {
115 "incoming _sms.chromeos", 120 SystemNotification note(
116 IDR_NOTIFICATION_SMS, 121 profile_,
117 l10n_util::GetStringFUTF16( 122 "incoming _sms.chromeos",
118 IDS_SMS_NOTIFICATION_TITLE, UTF8ToUTF16(message->number))); 123 IDR_NOTIFICATION_SMS,
124 l10n_util::GetStringFUTF16(
125 IDS_SMS_NOTIFICATION_TITLE, UTF8ToUTF16(message->number)));
119 126
120 note.Show(UTF8ToUTF16(message->text), true, false); 127 note.Show(UTF8ToUTF16(message->text), true, false);
128 return;
129 }
130
131 // Add an Ash SMS notification. TODO(stevenjb): Replace this code with
132 // NetworkSmsHandler when fixed: crbug.com/133416.
133 base::DictionaryValue dict;
134 dict.SetString(ash::kSmsNumberKey, message->number);
135 dict.SetString(ash::kSmsTextKey, message->text);
136 ash::Shell::GetInstance()->system_tray()->sms_observer()->AddMessage(dict);
121 } 137 }
122 138
123 } // namespace chromeos 139 } // namespace chromeos
OLDNEW
« 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