OLD | NEW |
1 | |
2 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
3 // 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 |
4 // found in the LICENSE file. | 3 // found in the LICENSE file. |
5 | 4 |
6 #include "chrome/browser/ui/views/status_icons/status_icon_linux_wrapper.h" | 5 #include "chrome/browser/ui/views/status_icons/status_icon_linux_wrapper.h" |
7 | 6 |
8 StatusIconLinuxWrapper::StatusIconLinuxWrapper(StatusIconLinux* status_icon) | 7 #include "ui/views/linux_ui/linux_ui.h" |
| 8 |
| 9 StatusIconLinuxWrapper::StatusIconLinuxWrapper( |
| 10 views::StatusIconLinux* status_icon) |
9 : menu_model_(NULL) { | 11 : menu_model_(NULL) { |
10 status_icon_.reset(status_icon); | 12 status_icon_.reset(status_icon); |
11 status_icon_->set_delegate(this); | 13 status_icon_->set_delegate(this); |
12 } | 14 } |
13 | 15 |
14 StatusIconLinuxWrapper::~StatusIconLinuxWrapper() { | 16 StatusIconLinuxWrapper::~StatusIconLinuxWrapper() { |
15 if (menu_model_) | 17 if (menu_model_) |
16 menu_model_->RemoveObserver(this); | 18 menu_model_->RemoveObserver(this); |
17 } | 19 } |
18 | 20 |
(...skipping 23 matching lines...) Expand all Loading... |
42 return HasObservers(); | 44 return HasObservers(); |
43 } | 45 } |
44 | 46 |
45 void StatusIconLinuxWrapper::OnMenuStateChanged() { | 47 void StatusIconLinuxWrapper::OnMenuStateChanged() { |
46 status_icon_->RefreshPlatformContextMenu(); | 48 status_icon_->RefreshPlatformContextMenu(); |
47 } | 49 } |
48 | 50 |
49 StatusIconLinuxWrapper* StatusIconLinuxWrapper::CreateWrappedStatusIcon( | 51 StatusIconLinuxWrapper* StatusIconLinuxWrapper::CreateWrappedStatusIcon( |
50 const gfx::ImageSkia& image, | 52 const gfx::ImageSkia& image, |
51 const string16& tool_tip) { | 53 const string16& tool_tip) { |
52 const ui::LinuxUI* linux_ui = ui::LinuxUI::instance(); | 54 const views::LinuxUI* linux_ui = views::LinuxUI::instance(); |
53 if (linux_ui) { | 55 if (linux_ui) { |
54 scoped_ptr<StatusIconLinux> status_icon = | 56 scoped_ptr<views::StatusIconLinux> status_icon = |
55 linux_ui->CreateLinuxStatusIcon(image, tool_tip); | 57 linux_ui->CreateLinuxStatusIcon(image, tool_tip); |
56 if (status_icon.get()) | 58 if (status_icon.get()) |
57 return new StatusIconLinuxWrapper(status_icon.release()); | 59 return new StatusIconLinuxWrapper(status_icon.release()); |
58 } | 60 } |
59 return NULL; | 61 return NULL; |
60 } | 62 } |
61 | 63 |
62 void StatusIconLinuxWrapper::UpdatePlatformContextMenu( | 64 void StatusIconLinuxWrapper::UpdatePlatformContextMenu( |
63 StatusIconMenuModel* model) { | 65 StatusIconMenuModel* model) { |
64 // If a menu already exists, remove ourself from its oberver list. | 66 // If a menu already exists, remove ourself from its oberver list. |
65 if (menu_model_) | 67 if (menu_model_) |
66 menu_model_->RemoveObserver(this); | 68 menu_model_->RemoveObserver(this); |
67 | 69 |
68 status_icon_->UpdatePlatformContextMenu(model); | 70 status_icon_->UpdatePlatformContextMenu(model); |
69 menu_model_ = model; | 71 menu_model_ = model; |
70 | 72 |
71 if (model) | 73 if (model) |
72 model->AddObserver(this); | 74 model->AddObserver(this); |
73 } | 75 } |
OLD | NEW |