diff options
-rw-r--r-- | chrome/browser/gtk/status_icons/status_icon_gtk.cc | 44 | ||||
-rw-r--r-- | chrome/browser/gtk/status_icons/status_icon_gtk.h | 34 | ||||
-rw-r--r-- | chrome/browser/gtk/status_icons/status_tray_gtk.cc | 21 | ||||
-rw-r--r-- | chrome/browser/gtk/status_icons/status_tray_gtk.h | 23 | ||||
-rw-r--r-- | chrome/browser/gtk/status_icons/status_tray_gtk_unittest.cc | 50 | ||||
-rw-r--r-- | chrome/browser/status_icons/status_tray_manager.cc | 2 | ||||
-rwxr-xr-x | chrome/chrome_browser.gypi | 4 | ||||
-rw-r--r-- | chrome/chrome_tests.gypi | 6 |
8 files changed, 3 insertions, 181 deletions
diff --git a/chrome/browser/gtk/status_icons/status_icon_gtk.cc b/chrome/browser/gtk/status_icons/status_icon_gtk.cc deleted file mode 100644 index c42b761..0000000 --- a/chrome/browser/gtk/status_icons/status_icon_gtk.cc +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) 2010 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/gtk/status_icons/status_icon_gtk.h" - -#include "base/string16.h" -#include "base/logging.h" -#include "base/utf_string_conversions.h" -#include "gfx/gtk_util.h" -#include "third_party/skia/include/core/SkBitmap.h" - -StatusIconGtk::StatusIconGtk() { - icon_ = gtk_status_icon_new(); - gtk_status_icon_set_visible(icon_, TRUE); - - g_signal_connect(icon_, "activate", - G_CALLBACK(OnClick), this); -} - -StatusIconGtk::~StatusIconGtk() { - g_object_unref(icon_); -} - -void StatusIconGtk::SetImage(const SkBitmap& image) { - if (image.isNull()) - return; - - GdkPixbuf* pixbuf = gfx::GdkPixbufFromSkBitmap(&image); - gtk_status_icon_set_from_pixbuf(icon_, pixbuf); -} - -void StatusIconGtk::SetPressedImage(const SkBitmap& image) { - // Ignore pressed images, since the standard on Linux is to not highlight - // pressed status icons. -} - -void StatusIconGtk::SetToolTip(const string16& tool_tip) { - gtk_status_icon_set_tooltip(icon_, UTF16ToUTF8(tool_tip).c_str()); -} - -void StatusIconGtk::OnClick(GtkWidget* widget, StatusIconGtk* status_icon) { - status_icon->DispatchClickEvent(); -} diff --git a/chrome/browser/gtk/status_icons/status_icon_gtk.h b/chrome/browser/gtk/status_icons/status_icon_gtk.h deleted file mode 100644 index 7ce1df2..0000000 --- a/chrome/browser/gtk/status_icons/status_icon_gtk.h +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) 2010 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. - -#ifndef CHROME_BROWSER_GTK_STATUS_ICONS_STATUS_ICON_GTK_H_ -#define CHROME_BROWSER_GTK_STATUS_ICONS_STATUS_ICON_GTK_H_ - -#include <gtk/gtk.h> - -#include "chrome/browser/status_icons/status_icon.h" - -class SkBitmap; - -class StatusIconGtk : public StatusIcon { - public: - StatusIconGtk(); - virtual ~StatusIconGtk(); - - // Overridden from StatusIcon: - virtual void SetImage(const SkBitmap& image); - virtual void SetPressedImage(const SkBitmap& image); - virtual void SetToolTip(const string16& tool_tip); - - // Exposed for testing. - static void OnClick(GtkWidget* widget, StatusIconGtk* status_icon); - - private: - // The currently-displayed icon for the window. - GtkStatusIcon* icon_; - - DISALLOW_COPY_AND_ASSIGN(StatusIconGtk); -}; - -#endif // CHROME_BROWSER_GTK_STATUS_ICONS_STATUS_ICON_GTK_H_ diff --git a/chrome/browser/gtk/status_icons/status_tray_gtk.cc b/chrome/browser/gtk/status_icons/status_tray_gtk.cc deleted file mode 100644 index 6b2764e..0000000 --- a/chrome/browser/gtk/status_icons/status_tray_gtk.cc +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) 2010 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/gtk/status_icons/status_tray_gtk.h" - -#include "chrome/browser/gtk/status_icons/status_icon_gtk.h" - -StatusTrayGtk::StatusTrayGtk() { -} - -StatusTrayGtk::~StatusTrayGtk() { -} - -StatusIcon* StatusTrayGtk::CreateStatusIcon() { - return new StatusIconGtk(); -} - -StatusTray* StatusTray::Create() { - return new StatusTrayGtk(); -} diff --git a/chrome/browser/gtk/status_icons/status_tray_gtk.h b/chrome/browser/gtk/status_icons/status_tray_gtk.h deleted file mode 100644 index a41e5df0..0000000 --- a/chrome/browser/gtk/status_icons/status_tray_gtk.h +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) 2010 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. - -#ifndef CHROME_BROWSER_GTK_STATUS_ICONS_STATUS_TRAY_GTK_H_ -#define CHROME_BROWSER_GTK_STATUS_ICONS_STATUS_TRAY_GTK_H_ - -#include "chrome/browser/status_icons/status_tray.h" - -class StatusTrayGtk : public StatusTray { - public: - StatusTrayGtk(); - ~StatusTrayGtk(); - - protected: - // Overriden from StatusTray: - virtual StatusIcon* CreateStatusIcon(); - - private: - DISALLOW_COPY_AND_ASSIGN(StatusTrayGtk); -}; - -#endif // CHROME_BROWSER_GTK_STATUS_ICONS_STATUS_TRAY_GTK_H_ diff --git a/chrome/browser/gtk/status_icons/status_tray_gtk_unittest.cc b/chrome/browser/gtk/status_icons/status_tray_gtk_unittest.cc deleted file mode 100644 index 58b2616..0000000 --- a/chrome/browser/gtk/status_icons/status_tray_gtk_unittest.cc +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) 2010 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 "app/resource_bundle.h" -#include "base/string_util.h" -#include "chrome/browser/gtk/status_icons/status_icon_gtk.h" -#include "chrome/browser/gtk/status_icons/status_tray_gtk.h" -#include "grit/browser_resources.h" -#include "grit/theme_resources.h" -#include "testing/gmock/include/gmock/gmock.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace { - -class MockStatusIconObserver : public StatusIcon::Observer { - public: - MOCK_METHOD0(OnClicked, void()); -}; - -TEST(StatusTrayGtkTest, CreateTray) { - // Just tests creation/destruction. - StatusTrayGtk tray; -} - -TEST(StatusTrayGtkTest, CreateIcon) { - // Create an icon, set the images and tooltip, then shut it down. - StatusTrayGtk tray; - StatusIcon* icon = tray.GetStatusIcon(ASCIIToUTF16("test")); - SkBitmap* bitmap = ResourceBundle::GetSharedInstance().GetBitmapNamed( - IDR_STATUS_TRAY_ICON); - icon->SetImage(*bitmap); - icon->SetPressedImage(*bitmap); - icon->SetToolTip(ASCIIToUTF16("tool tip")); -} - -TEST(StatusTrayGtkTest, ClickOnIcon) { - // Create an icon, send a fake click event, make sure observer is called. - StatusTrayGtk tray; - StatusIconGtk* icon = static_cast<StatusIconGtk*>( - tray.GetStatusIcon(ASCIIToUTF16("test"))); - MockStatusIconObserver observer; - icon->AddObserver(&observer); - EXPECT_CALL(observer, OnClicked()); - // Mimic a click. - icon->OnClick(NULL, icon); - icon->RemoveObserver(&observer); -} - -} // namespace diff --git a/chrome/browser/status_icons/status_tray_manager.cc b/chrome/browser/status_icons/status_tray_manager.cc index 4040a51..b5465c3 100644 --- a/chrome/browser/status_icons/status_tray_manager.cc +++ b/chrome/browser/status_icons/status_tray_manager.cc @@ -23,7 +23,7 @@ StatusTrayManager::~StatusTrayManager() { } void StatusTrayManager::Init(Profile* profile) { -#if !defined(OS_CHROMEOS) +#if !defined(OS_LINUX) DCHECK(profile); profile_ = profile; status_tray_.reset(StatusTray::Create()); diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index 5cf5560..78e26c1 100755 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -1332,10 +1332,6 @@ 'browser/gtk/standard_menus.h', 'browser/gtk/status_bubble_gtk.cc', 'browser/gtk/status_bubble_gtk.h', - 'browser/gtk/status_icons/status_icon_gtk.h', - 'browser/gtk/status_icons/status_icon_gtk.cc', - 'browser/gtk/status_icons/status_tray_gtk.h', - 'browser/gtk/status_icons/status_tray_gtk.cc', 'browser/gtk/tab_contents_container_gtk.cc', 'browser/gtk/tab_contents_container_gtk.h', 'browser/gtk/tab_contents_drag_source.cc', diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index a7ae90b..6b7228e 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -771,7 +771,6 @@ 'browser/gtk/keyword_editor_view_unittest.cc', 'browser/gtk/options/cookies_view_unittest.cc', 'browser/gtk/options/languages_page_gtk_unittest.cc', - 'browser/gtk/status_icons/status_tray_gtk_unittest.cc', 'browser/gtk/tabs/tab_renderer_gtk_unittest.cc', 'browser/history/expire_history_backend_unittest.cc', 'browser/history/history_backend_unittest.cc', @@ -1030,11 +1029,10 @@ ['exclude', 'browser/gtk/go_button_gtk_unittest\\.cc$'], ['exclude', 'browser/gtk/gtk_chrome_shrinkable_hbox_unittest\\.cc$'], ['exclude', 'browser/gtk/gtk_expanded_container_unittest\\.cc$'], - ['exclude', 'browser/gtk/gtk_theme_provider_unittest\\.cc$'], + ['exclude', 'browser/gtk/tabs/tab_renderer_gtk_unittest\\.cc$'], ['exclude', 'browser/gtk/options/cookies_view_unittest\\.cc$'], ['exclude', 'browser/gtk/options/languages_page_gtk_unittest\\.cc$'], - ['exclude', 'browser/gtk/status_icons/status_tray_gtk_unittest\\.cc$'], - ['exclude', 'browser/gtk/tabs/tab_renderer_gtk_unittest\\.cc$'], + ['exclude', 'browser/gtk/gtk_theme_provider_unittest\\.cc$'], ['include', 'browser/views/bookmark_context_menu_test.cc$'], ], }], |