OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ui/views/status_icons/status_icon_linux_wrapper.h" | 5 #include "chrome/browser/ui/views/status_icons/status_icon_linux_wrapper.h" |
6 | 6 |
7 #include "ui/message_center/notifier_settings.h" | 7 #include "ui/message_center/notifier_settings.h" |
8 #include "ui/views/linux_ui/linux_ui.h" | 8 #include "ui/views/linux_ui/linux_ui.h" |
9 | 9 |
10 StatusIconLinuxWrapper::StatusIconLinuxWrapper( | 10 StatusIconLinuxWrapper::StatusIconLinuxWrapper( |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 void StatusIconLinuxWrapper::OnMenuStateChanged() { | 46 void StatusIconLinuxWrapper::OnMenuStateChanged() { |
47 status_icon_->RefreshPlatformContextMenu(); | 47 status_icon_->RefreshPlatformContextMenu(); |
48 } | 48 } |
49 | 49 |
50 StatusIconLinuxWrapper* StatusIconLinuxWrapper::CreateWrappedStatusIcon( | 50 StatusIconLinuxWrapper* StatusIconLinuxWrapper::CreateWrappedStatusIcon( |
51 const gfx::ImageSkia& image, | 51 const gfx::ImageSkia& image, |
52 const base::string16& tool_tip) { | 52 const base::string16& tool_tip) { |
53 const views::LinuxUI* linux_ui = views::LinuxUI::instance(); | 53 const views::LinuxUI* linux_ui = views::LinuxUI::instance(); |
54 if (linux_ui) { | 54 if (linux_ui) { |
55 scoped_ptr<views::StatusIconLinux> status_icon = | 55 std::unique_ptr<views::StatusIconLinux> status_icon = |
56 linux_ui->CreateLinuxStatusIcon(image, tool_tip); | 56 linux_ui->CreateLinuxStatusIcon(image, tool_tip); |
57 if (status_icon.get()) | 57 if (status_icon.get()) |
58 return new StatusIconLinuxWrapper(status_icon.release()); | 58 return new StatusIconLinuxWrapper(status_icon.release()); |
59 } | 59 } |
60 return NULL; | 60 return NULL; |
61 } | 61 } |
62 | 62 |
63 void StatusIconLinuxWrapper::UpdatePlatformContextMenu( | 63 void StatusIconLinuxWrapper::UpdatePlatformContextMenu( |
64 StatusIconMenuModel* model) { | 64 StatusIconMenuModel* model) { |
65 // If a menu already exists, remove ourself from its oberver list. | 65 // If a menu already exists, remove ourself from its oberver list. |
66 if (menu_model_) | 66 if (menu_model_) |
67 menu_model_->RemoveObserver(this); | 67 menu_model_->RemoveObserver(this); |
68 | 68 |
69 status_icon_->UpdatePlatformContextMenu(model); | 69 status_icon_->UpdatePlatformContextMenu(model); |
70 menu_model_ = model; | 70 menu_model_ = model; |
71 | 71 |
72 if (model) | 72 if (model) |
73 model->AddObserver(this); | 73 model->AddObserver(this); |
74 } | 74 } |
OLD | NEW |