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

Side by Side Diff: chrome/browser/extensions/api/system_indicator/system_indicator_manager.cc

Issue 1201063002: Set up the infrastructure for Extension event metrics. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebaaaaase Created 5 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
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/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/extensions/extension_action.h" 9 #include "chrome/browser/extensions/extension_action.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 icon_->RemoveObserver(this); 75 icon_->RemoveObserver(this);
76 status_tray_->RemoveStatusIcon(icon_); 76 status_tray_->RemoveStatusIcon(icon_);
77 } 77 }
78 } 78 }
79 79
80 void ExtensionIndicatorIcon::OnStatusIconClicked() { 80 void ExtensionIndicatorIcon::OnStatusIconClicked() {
81 scoped_ptr<base::ListValue> params( 81 scoped_ptr<base::ListValue> params(
82 api::system_indicator::OnClicked::Create()); 82 api::system_indicator::OnClicked::Create());
83 83
84 EventRouter* event_router = EventRouter::Get(profile_); 84 EventRouter* event_router = EventRouter::Get(profile_);
85 scoped_ptr<Event> event(new Event( 85 scoped_ptr<Event> event(new Event(events::UNKNOWN,
86 system_indicator::OnClicked::kEventName, 86 system_indicator::OnClicked::kEventName,
87 params.Pass(), 87 params.Pass(), profile_));
88 profile_));
89 event_router->DispatchEventToExtension( 88 event_router->DispatchEventToExtension(
90 extension_->id(), event.Pass()); 89 extension_->id(), event.Pass());
91 } 90 }
92 91
93 void ExtensionIndicatorIcon::OnIconUpdated() { 92 void ExtensionIndicatorIcon::OnIconUpdated() {
94 icon_->SetImage( 93 icon_->SetImage(
95 icon_factory_.GetIcon(ExtensionAction::kDefaultTabId).AsImageSkia()); 94 icon_factory_.GetIcon(ExtensionAction::kDefaultTabId).AsImageSkia());
96 } 95 }
97 96
98 ExtensionIndicatorIcon::ExtensionIndicatorIcon(const Extension* extension, 97 ExtensionIndicatorIcon::ExtensionIndicatorIcon(const Extension* extension,
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 if (extension_icon) 188 if (extension_icon)
190 system_indicators_[extension->id()] = make_linked_ptr(extension_icon); 189 system_indicators_[extension->id()] = make_linked_ptr(extension_icon);
191 } 190 }
192 191
193 void SystemIndicatorManager::RemoveIndicator(const std::string& extension_id) { 192 void SystemIndicatorManager::RemoveIndicator(const std::string& extension_id) {
194 DCHECK(thread_checker_.CalledOnValidThread()); 193 DCHECK(thread_checker_.CalledOnValidThread());
195 system_indicators_.erase(extension_id); 194 system_indicators_.erase(extension_id);
196 } 195 }
197 196
198 } // namespace extensions 197 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698