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/extensions/api/system_indicator/system_indicator_manage
r.h" | 5 #include "chrome/browser/extensions/api/system_indicator/system_indicator_manage
r.h" |
6 | 6 |
7 #include "base/memory/linked_ptr.h" | 7 #include "base/memory/linked_ptr.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
10 #include "chrome/browser/extensions/extension_action.h" | 10 #include "chrome/browser/extensions/extension_action.h" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 | 116 |
117 icon_ = status_tray_->CreateStatusIcon( | 117 icon_ = status_tray_->CreateStatusIcon( |
118 StatusTray::OTHER_ICON, icon_image, tool_tip); | 118 StatusTray::OTHER_ICON, icon_image, tool_tip); |
119 if (icon_) | 119 if (icon_) |
120 icon_->AddObserver(this); | 120 icon_->AddObserver(this); |
121 } | 121 } |
122 | 122 |
123 SystemIndicatorManager::SystemIndicatorManager(Profile* profile, | 123 SystemIndicatorManager::SystemIndicatorManager(Profile* profile, |
124 StatusTray* status_tray) | 124 StatusTray* status_tray) |
125 : profile_(profile), status_tray_(status_tray) { | 125 : profile_(profile), status_tray_(status_tray) { |
126 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, | 126 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, |
127 content::Source<Profile>(profile_->GetOriginalProfile())); | 127 content::Source<Profile>(profile_->GetOriginalProfile())); |
128 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_SYSTEM_INDICATOR_UPDATED, | 128 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_SYSTEM_INDICATOR_UPDATED, |
129 content::Source<Profile>(profile_->GetOriginalProfile())); | 129 content::Source<Profile>(profile_->GetOriginalProfile())); |
130 } | 130 } |
131 | 131 |
132 SystemIndicatorManager::~SystemIndicatorManager() { | 132 SystemIndicatorManager::~SystemIndicatorManager() { |
133 DCHECK(thread_checker_.CalledOnValidThread()); | 133 DCHECK(thread_checker_.CalledOnValidThread()); |
134 } | 134 } |
135 | 135 |
136 void SystemIndicatorManager::Shutdown() { | 136 void SystemIndicatorManager::Shutdown() { |
137 DCHECK(thread_checker_.CalledOnValidThread()); | 137 DCHECK(thread_checker_.CalledOnValidThread()); |
138 } | 138 } |
139 | 139 |
140 void SystemIndicatorManager::Observe( | 140 void SystemIndicatorManager::Observe( |
141 int type, | 141 int type, |
142 const content::NotificationSource& source, | 142 const content::NotificationSource& source, |
143 const content::NotificationDetails& details) { | 143 const content::NotificationDetails& details) { |
144 DCHECK(thread_checker_.CalledOnValidThread()); | 144 DCHECK(thread_checker_.CalledOnValidThread()); |
145 | 145 |
146 switch (type) { | 146 switch (type) { |
147 case chrome::NOTIFICATION_EXTENSION_UNLOADED: | 147 case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: |
148 RemoveIndicator( | 148 RemoveIndicator( |
149 content::Details<UnloadedExtensionInfo>(details)->extension->id()); | 149 content::Details<UnloadedExtensionInfo>(details)->extension->id()); |
150 break; | 150 break; |
151 case chrome::NOTIFICATION_EXTENSION_SYSTEM_INDICATOR_UPDATED: | 151 case chrome::NOTIFICATION_EXTENSION_SYSTEM_INDICATOR_UPDATED: |
152 OnSystemIndicatorChanged( | 152 OnSystemIndicatorChanged( |
153 content::Details<ExtensionAction>(details).ptr()); | 153 content::Details<ExtensionAction>(details).ptr()); |
154 break; | 154 break; |
155 default: | 155 default: |
156 NOTREACHED(); | 156 NOTREACHED(); |
157 break; | 157 break; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 if (extension_icon) | 202 if (extension_icon) |
203 system_indicators_[extension->id()] = make_linked_ptr(extension_icon); | 203 system_indicators_[extension->id()] = make_linked_ptr(extension_icon); |
204 } | 204 } |
205 | 205 |
206 void SystemIndicatorManager::RemoveIndicator(const std::string& extension_id) { | 206 void SystemIndicatorManager::RemoveIndicator(const std::string& extension_id) { |
207 DCHECK(thread_checker_.CalledOnValidThread()); | 207 DCHECK(thread_checker_.CalledOnValidThread()); |
208 system_indicators_.erase(extension_id); | 208 system_indicators_.erase(extension_id); |
209 } | 209 } |
210 | 210 |
211 } // namespace extensions | 211 } // namespace extensions |
OLD | NEW |