| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/gtk/status_icons/status_icon_gtk.h" | 5 #include "chrome/browser/ui/gtk/status_icons/status_icon_gtk.h" |
| 6 | 6 |
| 7 #include "base/string16.h" | 7 #include "base/string16.h" |
| 8 #include "base/logging.h" | |
| 9 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/ui/gtk/menu_gtk.h" | 9 #include "chrome/browser/ui/gtk/menu_gtk.h" |
| 11 #include "third_party/skia/include/core/SkBitmap.h" | 10 #include "third_party/skia/include/core/SkBitmap.h" |
| 12 #include "ui/gfx/gtk_util.h" | 11 #include "ui/gfx/gtk_util.h" |
| 13 | 12 |
| 14 StatusIconGtk::StatusIconGtk() { | 13 StatusIconGtk::StatusIconGtk() { |
| 15 icon_ = gtk_status_icon_new(); | 14 icon_ = gtk_status_icon_new(); |
| 16 gtk_status_icon_set_visible(icon_, TRUE); | 15 gtk_status_icon_set_visible(icon_, TRUE); |
| 17 | 16 |
| 18 g_signal_connect(icon_, "activate", | 17 g_signal_connect(icon_, "activate", |
| (...skipping 17 matching lines...) Expand all Loading... |
| 36 | 35 |
| 37 void StatusIconGtk::SetPressedImage(const SkBitmap& image) { | 36 void StatusIconGtk::SetPressedImage(const SkBitmap& image) { |
| 38 // Ignore pressed images, since the standard on Linux is to not highlight | 37 // Ignore pressed images, since the standard on Linux is to not highlight |
| 39 // pressed status icons. | 38 // pressed status icons. |
| 40 } | 39 } |
| 41 | 40 |
| 42 void StatusIconGtk::SetToolTip(const string16& tool_tip) { | 41 void StatusIconGtk::SetToolTip(const string16& tool_tip) { |
| 43 gtk_status_icon_set_tooltip(icon_, UTF16ToUTF8(tool_tip).c_str()); | 42 gtk_status_icon_set_tooltip(icon_, UTF16ToUTF8(tool_tip).c_str()); |
| 44 } | 43 } |
| 45 | 44 |
| 46 void StatusIconGtk::DisplayBalloon(const string16& title, | 45 void StatusIconGtk::DisplayBalloon(const SkBitmap& icon, |
| 46 const string16& title, |
| 47 const string16& contents) { | 47 const string16& contents) { |
| 48 // TODO(atwilson): Figure out the right thing to do here. | 48 // TODO(atwilson): Figure out the right thing to do here. |
| 49 // http://crbug.com/74970 | 49 // http://crbug.com/74970 |
| 50 } | 50 } |
| 51 | 51 |
| 52 void StatusIconGtk::OnClick(GtkWidget* widget) { | 52 void StatusIconGtk::OnClick(GtkWidget* widget) { |
| 53 DispatchClickEvent(); | 53 DispatchClickEvent(); |
| 54 } | 54 } |
| 55 | 55 |
| 56 void StatusIconGtk::UpdatePlatformContextMenu(ui::MenuModel* model) { | 56 void StatusIconGtk::UpdatePlatformContextMenu(ui::MenuModel* model) { |
| 57 if (!model) | 57 if (!model) |
| 58 menu_.reset(); | 58 menu_.reset(); |
| 59 else | 59 else |
| 60 menu_.reset(new MenuGtk(NULL, model)); | 60 menu_.reset(new MenuGtk(NULL, model)); |
| 61 } | 61 } |
| 62 | 62 |
| 63 void StatusIconGtk::OnPopupMenu(GtkWidget* widget, guint button, guint time) { | 63 void StatusIconGtk::OnPopupMenu(GtkWidget* widget, guint button, guint time) { |
| 64 // If we have a menu - display it. | 64 // If we have a menu - display it. |
| 65 if (menu_.get()) | 65 if (menu_.get()) |
| 66 menu_->PopupAsContextForStatusIcon(time, button, icon_); | 66 menu_->PopupAsContextForStatusIcon(time, button, icon_); |
| 67 } | 67 } |
| OLD | NEW |