blob: 458fb35c870a252a1db1fc890a5d6341126a0762 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/status_icons/status_icon.h"
#include "chrome/browser/status_icons/status_icon_observer.h"
StatusIcon::StatusIcon() {
}
StatusIcon::~StatusIcon() {
}
void StatusIcon::AddObserver(StatusIconObserver* observer) {
observers_.AddObserver(observer);
}
void StatusIcon::RemoveObserver(StatusIconObserver* observer) {
observers_.RemoveObserver(observer);
}
bool StatusIcon::HasObservers() const {
return observers_.might_have_observers();
}
void StatusIcon::DispatchClickEvent() {
FOR_EACH_OBSERVER(StatusIconObserver, observers_, OnStatusIconClicked());
}
#if defined(OS_WIN)
void StatusIcon::DispatchBalloonClickEvent() {
FOR_EACH_OBSERVER(StatusIconObserver, observers_, OnBalloonClicked());
}
#endif
void StatusIcon::SetContextMenu(scoped_ptr<StatusIconMenuModel> menu) {
// The UI may been showing a menu for the current model, don't destroy it
// until we've notified the UI of the change.
scoped_ptr<StatusIconMenuModel> old_menu = context_menu_contents_.Pass();
context_menu_contents_ = menu.Pass();
UpdatePlatformContextMenu(context_menu_contents_.get());
}
|