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

Side by Side Diff: chrome/browser/chromeos/sms_observer.cc

Issue 10947046: Eliminate kAshNotifyDisabled and SystemNotification (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix nit Created 8 years, 3 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') | chrome/browser/feedback/feedback_data.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" 7 #include "ash/shell.h"
9 #include "ash/system/network/sms_observer.h" 8 #include "ash/system/network/sms_observer.h"
10 #include "ash/system/tray/system_tray.h" 9 #include "ash/system/tray/system_tray.h"
11 #include "base/command_line.h"
12 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
13 #include "chrome/browser/chromeos/cros/cros_library.h" 11 #include "chrome/browser/chromeos/cros/cros_library.h"
14 #include "chrome/browser/chromeos/notifications/system_notification.h"
15 #include "grit/generated_resources.h" 12 #include "grit/generated_resources.h"
16 #include "grit/theme_resources.h" 13 #include "grit/theme_resources.h"
17 #include "ui/base/l10n/l10n_util.h" 14 #include "ui/base/l10n/l10n_util.h"
18 15
19 namespace chromeos { 16 namespace chromeos {
20 17
21 SmsObserver::SmsObserver(Profile* profile) 18 SmsObserver::SmsObserver(Profile* profile)
22 : profile_(profile) { 19 : profile_(profile) {
23 DCHECK(profile_); 20 DCHECK(profile_);
24 UpdateObservers(chromeos::CrosLibrary::Get()->GetNetworkLibrary()); 21 UpdateObservers(chromeos::CrosLibrary::Get()->GetNetworkLibrary());
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 << " text: " << message.text; 99 << " text: " << message.text;
103 100
104 // Don't show empty messages. Such messages most probably "Message Waiting 101 // Don't show empty messages. Such messages most probably "Message Waiting
105 // Indication" and it should be determined by data-coding-scheme, 102 // Indication" and it should be determined by data-coding-scheme,
106 // see crosbug.com/27883. But this field is not exposed from libcros. 103 // see crosbug.com/27883. But this field is not exposed from libcros.
107 // TODO(dpokuhin): when libcros refactoring done, implement check for 104 // TODO(dpokuhin): when libcros refactoring done, implement check for
108 // "Message Waiting Indication" to filter out such messages. 105 // "Message Waiting Indication" to filter out such messages.
109 if (message.text.empty()) 106 if (message.text.empty())
110 return; 107 return;
111 108
112 if (CommandLine::ForCurrentProcess()->HasSwitch(
113 ash::switches::kAshNotifyDisabled)) {
114 SystemNotification note(
115 profile_,
116 "incoming _sms.chromeos",
117 IDR_NOTIFICATION_SMS,
118 l10n_util::GetStringFUTF16(
119 IDS_SMS_NOTIFICATION_TITLE, UTF8ToUTF16(message.number)));
120
121 note.Show(UTF8ToUTF16(message.text), true, false);
122 return;
123 }
124
125 // Add an Ash SMS notification. TODO(stevenjb): Replace this code with 109 // Add an Ash SMS notification. TODO(stevenjb): Replace this code with
126 // NetworkSmsHandler when fixed: crbug.com/133416. 110 // NetworkSmsHandler when fixed: crbug.com/133416.
127 base::DictionaryValue dict; 111 base::DictionaryValue dict;
128 dict.SetString(ash::kSmsNumberKey, message.number); 112 dict.SetString(ash::kSmsNumberKey, message.number);
129 dict.SetString(ash::kSmsTextKey, message.text); 113 dict.SetString(ash::kSmsTextKey, message.text);
130 ash::Shell::GetInstance()->system_tray()->sms_observer()->AddMessage(dict); 114 ash::Shell::GetInstance()->system_tray()->sms_observer()->AddMessage(dict);
131 } 115 }
132 116
133 } // namespace chromeos 117 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/profile_startup.cc ('k') | chrome/browser/feedback/feedback_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698