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

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

Issue 11312139: Add SystemTrayObservers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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
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/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_delegate.h"
11 #include "ash/system/tray/system_tray_observers.h"
10 #include "base/utf_string_conversions.h" 12 #include "base/utf_string_conversions.h"
11 #include "chrome/browser/chromeos/cros/cros_library.h" 13 #include "chrome/browser/chromeos/cros/cros_library.h"
12 #include "grit/generated_resources.h" 14 #include "grit/generated_resources.h"
13 #include "grit/theme_resources.h" 15 #include "grit/theme_resources.h"
14 #include "ui/base/l10n/l10n_util.h" 16 #include "ui/base/l10n/l10n_util.h"
15 17
16 namespace chromeos { 18 namespace chromeos {
17 19
18 SmsObserver::SmsObserver(Profile* profile) 20 SmsObserver::SmsObserver(Profile* profile)
19 : profile_(profile) { 21 : profile_(profile) {
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 // TODO(dpokuhin): when libcros refactoring done, implement check for 106 // TODO(dpokuhin): when libcros refactoring done, implement check for
105 // "Message Waiting Indication" to filter out such messages. 107 // "Message Waiting Indication" to filter out such messages.
106 if (message.text.empty()) 108 if (message.text.empty())
107 return; 109 return;
108 110
109 // Add an Ash SMS notification. TODO(stevenjb): Replace this code with 111 // Add an Ash SMS notification. TODO(stevenjb): Replace this code with
110 // NetworkSmsHandler when fixed: crbug.com/133416. 112 // NetworkSmsHandler when fixed: crbug.com/133416.
111 base::DictionaryValue dict; 113 base::DictionaryValue dict;
112 dict.SetString(ash::kSmsNumberKey, message.number); 114 dict.SetString(ash::kSmsNumberKey, message.number);
113 dict.SetString(ash::kSmsTextKey, message.text); 115 dict.SetString(ash::kSmsTextKey, message.text);
114 if (ash::Shell::GetInstance()->status_area_widget()) 116 ash::SystemTrayObservers* observers =
115 ash::Shell::GetInstance()->system_tray()->sms_observer()->AddMessage(dict); 117 ash::Shell::GetInstance()->tray_delegate()->GetSystemTrayObservers();
118 if (observers) {
119 FOR_EACH_OBSERVER(ash::SmsObserver,
120 observers->sms_observers(),
121 AddMessage(dict));
122 }
116 } 123 }
117 124
118 } // namespace chromeos 125 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698