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 <utility> |
| 8 |
7 #include "base/memory/linked_ptr.h" | 9 #include "base/memory/linked_ptr.h" |
8 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/extensions/extension_action.h" | 11 #include "chrome/browser/extensions/extension_action.h" |
10 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
11 #include "chrome/browser/status_icons/status_icon.h" | 13 #include "chrome/browser/status_icons/status_icon.h" |
12 #include "chrome/browser/status_icons/status_icon_observer.h" | 14 #include "chrome/browser/status_icons/status_icon_observer.h" |
13 #include "chrome/browser/status_icons/status_tray.h" | 15 #include "chrome/browser/status_icons/status_tray.h" |
14 #include "chrome/common/extensions/api/system_indicator.h" | 16 #include "chrome/common/extensions/api/system_indicator.h" |
15 #include "content/public/browser/web_contents.h" | 17 #include "content/public/browser/web_contents.h" |
16 #include "extensions/browser/event_router.h" | 18 #include "extensions/browser/event_router.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 } | 79 } |
78 } | 80 } |
79 | 81 |
80 void ExtensionIndicatorIcon::OnStatusIconClicked() { | 82 void ExtensionIndicatorIcon::OnStatusIconClicked() { |
81 scoped_ptr<base::ListValue> params( | 83 scoped_ptr<base::ListValue> params( |
82 api::system_indicator::OnClicked::Create()); | 84 api::system_indicator::OnClicked::Create()); |
83 | 85 |
84 EventRouter* event_router = EventRouter::Get(profile_); | 86 EventRouter* event_router = EventRouter::Get(profile_); |
85 scoped_ptr<Event> event(new Event(events::SYSTEM_INDICATOR_ON_CLICKED, | 87 scoped_ptr<Event> event(new Event(events::SYSTEM_INDICATOR_ON_CLICKED, |
86 system_indicator::OnClicked::kEventName, | 88 system_indicator::OnClicked::kEventName, |
87 params.Pass(), profile_)); | 89 std::move(params), profile_)); |
88 event_router->DispatchEventToExtension( | 90 event_router->DispatchEventToExtension(extension_->id(), std::move(event)); |
89 extension_->id(), event.Pass()); | |
90 } | 91 } |
91 | 92 |
92 void ExtensionIndicatorIcon::OnIconUpdated() { | 93 void ExtensionIndicatorIcon::OnIconUpdated() { |
93 icon_->SetImage( | 94 icon_->SetImage( |
94 icon_factory_.GetIcon(ExtensionAction::kDefaultTabId).AsImageSkia()); | 95 icon_factory_.GetIcon(ExtensionAction::kDefaultTabId).AsImageSkia()); |
95 } | 96 } |
96 | 97 |
97 ExtensionIndicatorIcon::ExtensionIndicatorIcon(const Extension* extension, | 98 ExtensionIndicatorIcon::ExtensionIndicatorIcon(const Extension* extension, |
98 ExtensionAction* action, | 99 ExtensionAction* action, |
99 Profile* profile, | 100 Profile* profile, |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 if (extension_icon) | 188 if (extension_icon) |
188 system_indicators_[extension->id()] = make_linked_ptr(extension_icon); | 189 system_indicators_[extension->id()] = make_linked_ptr(extension_icon); |
189 } | 190 } |
190 | 191 |
191 void SystemIndicatorManager::RemoveIndicator(const std::string& extension_id) { | 192 void SystemIndicatorManager::RemoveIndicator(const std::string& extension_id) { |
192 DCHECK(thread_checker_.CalledOnValidThread()); | 193 DCHECK(thread_checker_.CalledOnValidThread()); |
193 system_indicators_.erase(extension_id); | 194 system_indicators_.erase(extension_id); |
194 } | 195 } |
195 | 196 |
196 } // namespace extensions | 197 } // namespace extensions |
OLD | NEW |