summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-24 03:17:52 +0000
committerthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-24 03:17:52 +0000
commit1056eea144b6c89fd43a66985fe52101ed6966c7 (patch)
tree6552b8c670ee28e2acaff999f94a1fd921ae5ff8
parent1ade21db4634b0e18c2a020cf0818d254e314888 (diff)
downloadchromium_src-1056eea144b6c89fd43a66985fe52101ed6966c7.zip
chromium_src-1056eea144b6c89fd43a66985fe52101ed6966c7.tar.gz
chromium_src-1056eea144b6c89fd43a66985fe52101ed6966c7.tar.bz2
Revert of Moves the notification icon out of the status area overflow. (https://codereview.chromium.org/110693004/)
Reason for revert: From Vista Tests 1: StatusTrayStateChangerWinTest.TraySizeApiTest (run #1): [ RUN ] StatusTrayStateChangerWinTest.TraySizeApiTest c:\b\build\slave\cr-win-rel\build\src\chrome\browser\ui\views\status_icons\status_tray_state_changer_interactive_uitest_win.cc(149): error: Expected: (new_width) > (width), actual: 241 vs 241 [ FAILED ] StatusTrayStateChangerWinTest.TraySizeApiTest (94 ms) Original issue's description: > Moves the notification icon out of the status area overflow. > > This only happens the first time it is created per data dir, > so that the user can change back their setting if desired. > > This approach uses COM to talk with Windows Explorer to > change the user's notification area preferences. > > R=dimich@chromium.org > BUG=347693 > > Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=265807 TBR=dimich@chromium.org,atwilson@chromium.org,sky@chromium.org,cpu@chromium.org,dewittj@chromium.org NOTREECHECKS=true NOTRY=true BUG=347693 Review URL: https://codereview.chromium.org/256443004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@265828 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/notifications/message_center_notification_manager.cc1
-rw-r--r--chrome/browser/status_icons/status_icon.cc2
-rw-r--r--chrome/browser/status_icons/status_icon.h7
-rw-r--r--chrome/browser/ui/views/message_center/web_notification_tray.cc21
-rw-r--r--chrome/browser/ui/views/message_center/web_notification_tray.h17
-rw-r--r--chrome/browser/ui/views/message_center/web_notification_tray_browsertest.cc6
-rw-r--r--chrome/browser/ui/views/message_center/web_notification_tray_win.cc7
-rw-r--r--chrome/browser/ui/views/status_icons/status_icon_win.cc13
-rw-r--r--chrome/browser/ui/views/status_icons/status_icon_win.h12
-rw-r--r--chrome/browser/ui/views/status_icons/status_tray_state_changer_interactive_uitest_win.cc155
-rw-r--r--chrome/browser/ui/views/status_icons/status_tray_state_changer_win.cc235
-rw-r--r--chrome/browser/ui/views/status_icons/status_tray_state_changer_win.h133
-rw-r--r--chrome/browser/ui/views/status_icons/status_tray_win.cc96
-rw-r--r--chrome/browser/ui/views/status_icons/status_tray_win.h44
-rw-r--r--chrome/browser/ui/views/status_icons/status_tray_win_unittest.cc41
-rw-r--r--chrome/chrome_browser_ui.gypi2
-rw-r--r--chrome/chrome_tests.gypi1
-rw-r--r--chrome/common/pref_names.cc3
-rw-r--r--chrome/common/pref_names.h1
19 files changed, 33 insertions, 764 deletions
diff --git a/chrome/browser/notifications/message_center_notification_manager.cc b/chrome/browser/notifications/message_center_notification_manager.cc
index c233986..98eb386 100644
--- a/chrome/browser/notifications/message_center_notification_manager.cc
+++ b/chrome/browser/notifications/message_center_notification_manager.cc
@@ -95,7 +95,6 @@ void MessageCenterNotificationManager::RegisterPrefs(
PrefRegistrySimple* registry) {
registry->RegisterBooleanPref(prefs::kMessageCenterShowedFirstRunBalloon,
false);
- registry->RegisterBooleanPref(prefs::kMessageCenterForcedOnTaskbar, false);
}
////////////////////////////////////////////////////////////////////////////////
diff --git a/chrome/browser/status_icons/status_icon.cc b/chrome/browser/status_icons/status_icon.cc
index bc52001..458fb35 100644
--- a/chrome/browser/status_icons/status_icon.cc
+++ b/chrome/browser/status_icons/status_icon.cc
@@ -34,8 +34,6 @@ void StatusIcon::DispatchBalloonClickEvent() {
}
#endif
-void StatusIcon::ForceVisible() {}
-
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.
diff --git a/chrome/browser/status_icons/status_icon.h b/chrome/browser/status_icons/status_icon.h
index b0f28a3..7cb8899 100644
--- a/chrome/browser/status_icons/status_icon.h
+++ b/chrome/browser/status_icons/status_icon.h
@@ -60,13 +60,6 @@ class StatusIcon {
void DispatchBalloonClickEvent();
#endif
- // Attempts to make the status icon directly visible on system UI. Currently
- // this only applies to Windows, where status icons are hidden by default
- // inside an overflow window.
- // WARNING: This currently uses undocumented Windows APIs and spawns a worker
- // thread to do it. Use sparingly.
- virtual void ForceVisible();
-
protected:
// Invoked after a call to SetContextMenu() to let the platform-specific
// subclass update the native context menu based on the new model. If NULL is
diff --git a/chrome/browser/ui/views/message_center/web_notification_tray.cc b/chrome/browser/ui/views/message_center/web_notification_tray.cc
index ace33fd..3db0229 100644
--- a/chrome/browser/ui/views/message_center/web_notification_tray.cc
+++ b/chrome/browser/ui/views/message_center/web_notification_tray.cc
@@ -5,14 +5,12 @@
#include "chrome/browser/ui/views/message_center/web_notification_tray.h"
#include "base/i18n/number_formatting.h"
-#include "base/prefs/pref_service.h"
#include "base/strings/string16.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/status_icons/status_icon.h"
#include "chrome/browser/status_icons/status_icon_menu_model.h"
#include "chrome/browser/status_icons/status_tray.h"
-#include "chrome/common/pref_names.h"
#include "content/public/browser/notification_service.h"
#include "grit/chromium_strings.h"
#include "grit/theme_resources.h"
@@ -123,10 +121,10 @@ Alignment GetAnchorAlignment(const gfx::Rect& work_area, gfx::Point corner) {
} // namespace internal
MessageCenterTrayDelegate* CreateMessageCenterTray() {
- return new WebNotificationTray(g_browser_process->local_state());
+ return new WebNotificationTray();
}
-WebNotificationTray::WebNotificationTray(PrefService* local_state)
+WebNotificationTray::WebNotificationTray()
: message_center_delegate_(NULL),
status_icon_(NULL),
status_icon_menu_(NULL),
@@ -136,15 +134,6 @@ WebNotificationTray::WebNotificationTray(PrefService* local_state)
last_quiet_mode_state_ = message_center()->IsQuietMode();
popup_collection_.reset(new message_center::MessagePopupCollection(
NULL, message_center(), message_center_tray_.get(), false));
-
-#if defined(OS_WIN)
- // |local_state| can be NULL in tests.
- if (local_state) {
- did_force_tray_visible_.reset(new BooleanPrefMember());
- did_force_tray_visible_->Init(prefs::kMessageCenterForcedOnTaskbar,
- local_state);
- }
-#endif
}
WebNotificationTray::~WebNotificationTray() {
@@ -351,12 +340,6 @@ void WebNotificationTray::CreateStatusIcon(const gfx::ImageSkia& image,
status_icon_->AddObserver(this);
AddQuietModeMenu(status_icon_);
-#if defined(OS_WIN)
- if (did_force_tray_visible_.get() && !did_force_tray_visible_->GetValue()) {
- EnforceStatusIconVisible();
- did_force_tray_visible_->SetValue(true);
- }
-#endif
}
void WebNotificationTray::DestroyStatusIcon() {
diff --git a/chrome/browser/ui/views/message_center/web_notification_tray.h b/chrome/browser/ui/views/message_center/web_notification_tray.h
index 9ff2492..24dfe52 100644
--- a/chrome/browser/ui/views/message_center/web_notification_tray.h
+++ b/chrome/browser/ui/views/message_center/web_notification_tray.h
@@ -6,7 +6,6 @@
#define CHROME_BROWSER_UI_VIEWS_MESSAGE_CENTER_WEB_NOTIFICATION_TRAY_H_
#include "base/memory/weak_ptr.h"
-#include "base/prefs/pref_member.h"
#include "chrome/browser/status_icons/status_icon_menu_model.h"
#include "chrome/browser/status_icons/status_icon_observer.h"
#include "chrome/browser/ui/views/message_center/message_center_widget_delegate.h"
@@ -18,11 +17,6 @@
#include "ui/message_center/message_center_tray_delegate.h"
#include "ui/views/widget/widget_observer.h"
-#if defined(OS_WIN)
-#include "base/threading/thread.h"
-#endif
-
-class PrefService;
class StatusIcon;
namespace message_center {
@@ -49,7 +43,7 @@ class WebNotificationTray : public message_center::MessageCenterTrayDelegate,
public base::SupportsWeakPtr<WebNotificationTray>,
public StatusIconMenuModel::Delegate {
public:
- explicit WebNotificationTray(PrefService* local_state);
+ WebNotificationTray();
virtual ~WebNotificationTray();
message_center::MessageCenter* message_center();
@@ -71,8 +65,6 @@ class WebNotificationTray : public message_center::MessageCenterTrayDelegate,
// This shows a platform-specific balloon informing the user of the existence
// of the message center in the status tray area.
void DisplayFirstRunBalloon();
-
- void EnforceStatusIconVisible();
#endif
// StatusIconMenuModel::Delegate implementation.
@@ -103,13 +95,6 @@ class WebNotificationTray : public message_center::MessageCenterTrayDelegate,
void AddQuietModeMenu(StatusIcon* status_icon);
MessageCenterWidgetDelegate* GetMessageCenterWidgetDelegateForTest();
-#if defined(OS_WIN)
- // This member variable keeps track of whether EnforceStatusIconVisible has
- // been invoked on this machine, so the user still has control after we try
- // promoting it the first time.
- scoped_ptr<BooleanPrefMember> did_force_tray_visible_;
-#endif
-
MessageCenterWidgetDelegate* message_center_delegate_;
scoped_ptr<message_center::MessagePopupCollection> popup_collection_;
diff --git a/chrome/browser/ui/views/message_center/web_notification_tray_browsertest.cc b/chrome/browser/ui/views/message_center/web_notification_tray_browsertest.cc
index 1a1889c..6e95b0b 100644
--- a/chrome/browser/ui/views/message_center/web_notification_tray_browsertest.cc
+++ b/chrome/browser/ui/views/message_center/web_notification_tray_browsertest.cc
@@ -136,7 +136,7 @@ IN_PROC_BROWSER_TEST_F(WebNotificationTrayTest, WebNotifications) {
}
IN_PROC_BROWSER_TEST_F(WebNotificationTrayTest, WebNotificationPopupBubble) {
- scoped_ptr<WebNotificationTray> tray(new WebNotificationTray(NULL));
+ scoped_ptr<WebNotificationTray> tray(new WebNotificationTray());
tray->message_center();
// Adding a notification should show the popup bubble.
@@ -162,7 +162,7 @@ using message_center::NotificationList;
// Flaky, see http://crbug.com/222500 .
IN_PROC_BROWSER_TEST_F(WebNotificationTrayTest,
DISABLED_ManyMessageCenterNotifications) {
- scoped_ptr<WebNotificationTray> tray(new WebNotificationTray(NULL));
+ scoped_ptr<WebNotificationTray> tray(new WebNotificationTray());
message_center::MessageCenter* message_center = tray->message_center();
// Add the max visible notifications +1, ensure the correct visible number.
@@ -183,7 +183,7 @@ IN_PROC_BROWSER_TEST_F(WebNotificationTrayTest,
}
IN_PROC_BROWSER_TEST_F(WebNotificationTrayTest, ManyPopupNotifications) {
- scoped_ptr<WebNotificationTray> tray(new WebNotificationTray(NULL));
+ scoped_ptr<WebNotificationTray> tray(new WebNotificationTray());
message_center::MessageCenter* message_center = tray->message_center();
// Add the max visible popup notifications +1, ensure the correct num visible.
diff --git a/chrome/browser/ui/views/message_center/web_notification_tray_win.cc b/chrome/browser/ui/views/message_center/web_notification_tray_win.cc
index 72d9f30..8df1bec 100644
--- a/chrome/browser/ui/views/message_center/web_notification_tray_win.cc
+++ b/chrome/browser/ui/views/message_center/web_notification_tray_win.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/ui/views/message_center/web_notification_tray.h"
#include <windows.h>
+
#include "base/win/windows_version.h"
#include "chrome/browser/app_icon_win.h"
#include "chrome/browser/profiles/profile_manager.h"
@@ -55,10 +56,4 @@ void WebNotificationTray::DisplayFirstRunBalloon() {
l10n_util::GetStringUTF16(IDS_MESSAGE_CENTER_BALLOON_TITLE),
l10n_util::GetStringUTF16(IDS_MESSAGE_CENTER_BALLOON_TEXT));
}
-
-void WebNotificationTray::EnforceStatusIconVisible() {
- DCHECK(status_icon_);
- status_icon_->ForceVisible();
-}
-
} // namespace message_center
diff --git a/chrome/browser/ui/views/status_icons/status_icon_win.cc b/chrome/browser/ui/views/status_icons/status_icon_win.cc
index 6dd0f84..2bbbdae 100644
--- a/chrome/browser/ui/views/status_icons/status_icon_win.cc
+++ b/chrome/browser/ui/views/status_icons/status_icon_win.cc
@@ -6,7 +6,6 @@
#include "base/strings/string_number_conversions.h"
#include "base/win/windows_version.h"
-#include "chrome/browser/ui/views/status_icons/status_tray_win.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/gfx/icon_util.h"
#include "ui/gfx/point.h"
@@ -16,12 +15,8 @@
////////////////////////////////////////////////////////////////////////////////
// StatusIconWin, public:
-StatusIconWin::StatusIconWin(StatusTrayWin* tray,
- UINT id,
- HWND window,
- UINT message)
- : tray_(tray),
- icon_id_(id),
+StatusIconWin::StatusIconWin(UINT id, HWND window, UINT message)
+ : icon_id_(id),
window_(window),
message_id_(message),
menu_model_(NULL) {
@@ -147,10 +142,6 @@ void StatusIconWin::DisplayBalloon(const gfx::ImageSkia& icon,
LOG(WARNING) << "Unable to create status tray balloon.";
}
-void StatusIconWin::ForceVisible() {
- tray_->UpdateIconVisibilityInBackground(this);
-}
-
////////////////////////////////////////////////////////////////////////////////
// StatusIconWin, private:
diff --git a/chrome/browser/ui/views/status_icons/status_icon_win.h b/chrome/browser/ui/views/status_icons/status_icon_win.h
index 77abd9f..f6d5bb9 100644
--- a/chrome/browser/ui/views/status_icons/status_icon_win.h
+++ b/chrome/browser/ui/views/status_icons/status_icon_win.h
@@ -22,12 +22,10 @@ namespace views {
class MenuRunner;
}
-class StatusTrayWin;
-
class StatusIconWin : public StatusIcon {
public:
// Constructor which provides this icon's unique ID and messaging window.
- StatusIconWin(StatusTrayWin* tray, UINT id, HWND window, UINT message);
+ StatusIconWin(UINT id, HWND window, UINT message);
virtual ~StatusIconWin();
// Handles a click event from the user - if |left_button_click| is true and
@@ -42,7 +40,6 @@ class StatusIconWin : public StatusIcon {
void ResetIcon();
UINT icon_id() const { return icon_id_; }
- HWND window() const { return window_; }
UINT message_id() const { return message_id_; }
// Overridden from StatusIcon:
@@ -52,18 +49,15 @@ class StatusIconWin : public StatusIcon {
virtual void DisplayBalloon(const gfx::ImageSkia& icon,
const base::string16& title,
const base::string16& contents) OVERRIDE;
- virtual void ForceVisible() OVERRIDE;
protected:
// Overridden from StatusIcon:
- virtual void UpdatePlatformContextMenu(StatusIconMenuModel* menu) OVERRIDE;
+ virtual void UpdatePlatformContextMenu(
+ StatusIconMenuModel* menu) OVERRIDE;
private:
void InitIconData(NOTIFYICONDATA* icon_data);
- // The tray that owns us. Weak.
- StatusTrayWin* tray_;
-
// The unique ID corresponding to this icon.
UINT icon_id_;
diff --git a/chrome/browser/ui/views/status_icons/status_tray_state_changer_interactive_uitest_win.cc b/chrome/browser/ui/views/status_icons/status_tray_state_changer_interactive_uitest_win.cc
deleted file mode 100644
index 63c215c..0000000
--- a/chrome/browser/ui/views/status_icons/status_tray_state_changer_interactive_uitest_win.cc
+++ /dev/null
@@ -1,155 +0,0 @@
-// Copyright 2014 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/ui/views/status_icons/status_tray_state_changer_win.h"
-
-#include "base/memory/scoped_ptr.h"
-#include "base/win/scoped_com_initializer.h"
-#include "chrome/browser/status_icons/status_icon.h"
-#include "chrome/browser/ui/views/status_icons/status_icon_win.h"
-#include "chrome/browser/ui/views/status_icons/status_tray_win.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/skia/include/core/SkBitmap.h"
-#include "ui/gfx/image/image_skia.h"
-
-class StatusTrayStateChangerWinTest : public testing::Test {
- public:
- StatusTrayStateChangerWinTest() {}
-
- void SetUp() OVERRIDE {
- testing::Test::SetUp();
- com_.reset(new base::win::ScopedCOMInitializer());
- status_tray_.reset(new StatusTrayWin());
- SkBitmap bitmap;
-
- // Put a real bitmap into "bitmap". 2x2 bitmap of green 32 bit pixels.
- bitmap.setConfig(SkBitmap::kARGB_8888_Config, 16, 16);
- bitmap.allocPixels();
- bitmap.eraseColor(SK_ColorGREEN);
- status_icon_win_ = (StatusIconWin*)status_tray_->CreateStatusIcon(
- StatusTray::OTHER_ICON,
- gfx::ImageSkia::CreateFrom1xBitmap(bitmap),
- base::string16());
- tray_watcher_ = new StatusTrayStateChangerWin(status_icon_win_->icon_id(),
- status_icon_win_->window());
- }
-
- void TearDown() OVERRIDE {
- tray_watcher_ = NULL;
- status_tray_.reset();
- com_.reset();
- testing::Test::TearDown();
- }
-
- protected:
- HWND icon_window() { return status_icon_win_->window(); }
- UINT icon_id() { return status_icon_win_->icon_id(); }
-
- scoped_ptr<NOTIFYITEM> SetupAndGetCurrentNotifyItem() {
- EXPECT_TRUE(CallCreateTrayNotify());
-
- EXPECT_TRUE(IsInterfaceKnown());
-
- scoped_ptr<NOTIFYITEM> notify_item = GetNotifyItem();
- EXPECT_TRUE(notify_item.get() != NULL);
- DCHECK_EQ(notify_item->hwnd, icon_window());
- DCHECK_EQ(notify_item->id, icon_id());
-
- return notify_item.Pass();
- }
-
- bool CallCreateTrayNotify() { return tray_watcher_->CreateTrayNotify(); }
-
- bool IsInterfaceKnown() {
- return StatusTrayStateChangerWin::INTERFACE_VERSION_UNKNOWN !=
- tray_watcher_->interface_version_;
- }
-
- void SendNotifyItemUpdate(scoped_ptr<NOTIFYITEM> notify_item) {
- tray_watcher_->SendNotifyItemUpdate(notify_item.Pass());
- }
-
- scoped_ptr<NOTIFYITEM> GetNotifyItem() {
- return tray_watcher_->RegisterCallback();
- }
-
- scoped_ptr<base::win::ScopedCOMInitializer> com_;
- scoped_ptr<StatusTrayWin> status_tray_;
- scoped_refptr<StatusTrayStateChangerWin> tray_watcher_;
-
- StatusIconWin* status_icon_win_;
-
- DISALLOW_COPY_AND_ASSIGN(StatusTrayStateChangerWinTest);
-};
-
-TEST_F(StatusTrayStateChangerWinTest, Setup) {
- // This tests the code path that will read the NOTIFYITEM data structure for
- // use in future tests.
- scoped_ptr<NOTIFYITEM> notify_item = SetupAndGetCurrentNotifyItem();
- EXPECT_FALSE(notify_item.get() == NULL);
-}
-
-TEST_F(StatusTrayStateChangerWinTest, ComApiTest) {
-
- // Setup code to read the current preference.
- scoped_ptr<NOTIFYITEM> notify_item = SetupAndGetCurrentNotifyItem();
- ASSERT_TRUE(notify_item.get() != NULL);
-
- // Store the current pref.
- DWORD current_preference = notify_item->preference;
-
- // Ensure that running our code will do something.
- if (notify_item->preference != PREFERENCE_SHOW_WHEN_ACTIVE) {
- scoped_ptr<NOTIFYITEM> notify_item_copy(new NOTIFYITEM(*notify_item));
- notify_item_copy->preference = PREFERENCE_SHOW_WHEN_ACTIVE;
- SendNotifyItemUpdate(notify_item_copy.Pass());
- }
-
- // Run the interesting code.
- tray_watcher_->EnsureTrayIconVisible();
-
- EXPECT_EQ(PREFERENCE_SHOW_ALWAYS, GetNotifyItem()->preference);
- SendNotifyItemUpdate(notify_item.Pass());
- notify_item = GetNotifyItem();
-
- EXPECT_EQ(notify_item->preference, current_preference);
-};
-
-TEST_F(StatusTrayStateChangerWinTest, TraySizeApiTest) {
- // Used to reset operating system state afterwards.
- scoped_ptr<NOTIFYITEM> notify_item = SetupAndGetCurrentNotifyItem();
- // We can't actually run this test if we're already showing the icon.
- if (notify_item->preference == PREFERENCE_SHOW_ALWAYS)
- return;
-
- // This test can only run if the tray window structure conforms to what I've
- // seen in Win7 and Win8.
- HWND shell_tray_hwnd = ::FindWindow(L"Shell_TrayWnd", NULL);
- if (shell_tray_hwnd == NULL)
- return;
-
- HWND tray_notify_hwnd =
- ::FindWindowEx(shell_tray_hwnd, NULL, L"TrayNotifyWnd", NULL);
- ASSERT_TRUE(tray_notify_hwnd != NULL);
-
- RECT original_tray_notify_rect;
- ::GetWindowRect(tray_notify_hwnd, &original_tray_notify_rect);
-
- LONG width = original_tray_notify_rect.right - original_tray_notify_rect.left;
- ASSERT_GT(width, 0);
-
- tray_watcher_->EnsureTrayIconVisible();
-
- RECT new_tray_notify_rect;
- ::GetWindowRect(tray_notify_hwnd, &new_tray_notify_rect);
-
- LONG new_width = new_tray_notify_rect.right - new_tray_notify_rect.left;
-
- EXPECT_GT(new_width, width);
-
- SendNotifyItemUpdate(notify_item.Pass());
- ::GetWindowRect(tray_notify_hwnd, &new_tray_notify_rect);
- new_width = new_tray_notify_rect.right - new_tray_notify_rect.left;
- EXPECT_EQ(width, new_width);
-}
diff --git a/chrome/browser/ui/views/status_icons/status_tray_state_changer_win.cc b/chrome/browser/ui/views/status_icons/status_tray_state_changer_win.cc
deleted file mode 100644
index 5be4f73..0000000
--- a/chrome/browser/ui/views/status_icons/status_tray_state_changer_win.cc
+++ /dev/null
@@ -1,235 +0,0 @@
-// Copyright 2014 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/ui/views/status_icons/status_tray_state_changer_win.h"
-
-namespace {
-
-////////////////////////////////////////////////////////////////////////////////
-// Status Tray API
-
-// The folowing describes the interface to the undocumented Windows Exporer APIs
-// for manipulating with the status tray area. This code should be used with
-// care as it can change with versions (even minor versions) of Windows.
-
-// ITrayNotify is an interface describing the API for manipulating the state of
-// the Windows notification area, as well as for registering for change
-// notifications.
-class __declspec(uuid("FB852B2C-6BAD-4605-9551-F15F87830935")) ITrayNotify
- : public IUnknown {
- public:
- virtual HRESULT STDMETHODCALLTYPE
- RegisterCallback(INotificationCB* callback) = 0;
- virtual HRESULT STDMETHODCALLTYPE
- SetPreference(const NOTIFYITEM* notify_item) = 0;
- virtual HRESULT STDMETHODCALLTYPE EnableAutoTray(BOOL enabled) = 0;
-};
-
-// ITrayNotifyWin8 is the interface that replaces ITrayNotify for newer versions
-// of Windows.
-class __declspec(uuid("D133CE13-3537-48BA-93A7-AFCD5D2053B4")) ITrayNotifyWin8
- : public IUnknown {
- public:
- virtual HRESULT STDMETHODCALLTYPE
- RegisterCallback(INotificationCB* callback, unsigned long*) = 0;
- virtual HRESULT STDMETHODCALLTYPE UnregisterCallback(unsigned long*) = 0;
- virtual HRESULT STDMETHODCALLTYPE SetPreference(NOTIFYITEM const*) = 0;
- virtual HRESULT STDMETHODCALLTYPE EnableAutoTray(BOOL) = 0;
- virtual HRESULT STDMETHODCALLTYPE DoAction(BOOL) = 0;
-};
-
-const CLSID CLSID_TrayNotify = {
- 0x25DEAD04,
- 0x1EAC,
- 0x4911,
- {0x9E, 0x3A, 0xAD, 0x0A, 0x4A, 0xB5, 0x60, 0xFD}};
-
-} // namespace
-
-StatusTrayStateChangerWin::StatusTrayStateChangerWin(UINT icon_id, HWND window)
- : interface_version_(INTERFACE_VERSION_UNKNOWN),
- icon_id_(icon_id),
- window_(window) {
- wchar_t module_name[MAX_PATH];
- ::GetModuleFileName(NULL, module_name, MAX_PATH);
-
- file_name_ = module_name;
-}
-
-void StatusTrayStateChangerWin::EnsureTrayIconVisible() {
- DCHECK(CalledOnValidThread());
-
- if (!CreateTrayNotify()) {
- VLOG(1) << "Unable to create COM object for ITrayNotify.";
- return;
- }
-
- scoped_ptr<NOTIFYITEM> notify_item = RegisterCallback();
-
- // If the user has already hidden us explicitly, try to honor their choice by
- // not changing anything.
- if (notify_item->preference == PREFERENCE_SHOW_NEVER)
- return;
-
- // If we are already on the taskbar, return since nothing needs to be done.
- if (notify_item->preference == PREFERENCE_SHOW_ALWAYS)
- return;
-
- notify_item->preference = PREFERENCE_SHOW_ALWAYS;
-
- SendNotifyItemUpdate(notify_item.Pass());
-}
-
-STDMETHODIMP_(ULONG) StatusTrayStateChangerWin::AddRef() {
- DCHECK(CalledOnValidThread());
- return base::win::IUnknownImpl::AddRef();
-}
-
-STDMETHODIMP_(ULONG) StatusTrayStateChangerWin::Release() {
- DCHECK(CalledOnValidThread());
- return base::win::IUnknownImpl::Release();
-}
-
-STDMETHODIMP StatusTrayStateChangerWin::QueryInterface(REFIID riid,
- PVOID* ptr_void) {
- DCHECK(CalledOnValidThread());
- if (riid == __uuidof(INotificationCB)) {
- *ptr_void = static_cast<INotificationCB*>(this);
- AddRef();
- return S_OK;
- }
-
- return base::win::IUnknownImpl::QueryInterface(riid, ptr_void);
-}
-
-STDMETHODIMP StatusTrayStateChangerWin::Notify(ULONG event,
- NOTIFYITEM* notify_item) {
- DCHECK(CalledOnValidThread());
- DCHECK(notify_item);
- if (notify_item->hwnd != window_ || notify_item->id != icon_id_ ||
- base::string16(notify_item->exe_name) != file_name_) {
- return S_OK;
- }
-
- notify_item_.reset(new NOTIFYITEM(*notify_item));
- return S_OK;
-}
-
-StatusTrayStateChangerWin::~StatusTrayStateChangerWin() {
- DCHECK(CalledOnValidThread());
-}
-
-bool StatusTrayStateChangerWin::CreateTrayNotify() {
- DCHECK(CalledOnValidThread());
-
- tray_notify_.Release(); // Release so this method can be called more than
- // once.
-
- HRESULT hr = tray_notify_.CreateInstance(CLSID_TrayNotify);
- if (FAILED(hr))
- return false;
-
- base::win::ScopedComPtr<ITrayNotifyWin8> tray_notify_win8;
- hr = tray_notify_win8.QueryFrom(tray_notify_);
- if (SUCCEEDED(hr)) {
- interface_version_ = INTERFACE_VERSION_WIN8;
- return true;
- }
-
- base::win::ScopedComPtr<ITrayNotify> tray_notify_legacy;
- hr = tray_notify_legacy.QueryFrom(tray_notify_);
- if (SUCCEEDED(hr)) {
- interface_version_ = INTERFACE_VERSION_LEGACY;
- return true;
- }
-
- return false;
-}
-
-scoped_ptr<NOTIFYITEM> StatusTrayStateChangerWin::RegisterCallback() {
- // |notify_item_| is used to store the result of the callback from
- // Explorer.exe, which happens synchronously during
- // RegisterCallbackWin8 or RegisterCallbackLegacy.
- DCHECK(notify_item_.get() == NULL);
-
- // TODO(dewittj): Add UMA logging here to report if either of our strategies
- // has a tendency to fail on particular versions of Windows.
- switch (interface_version_) {
- case INTERFACE_VERSION_WIN8:
- if (!RegisterCallbackWin8())
- VLOG(1) << "Unable to successfully run RegisterCallbackWin8.";
- break;
- case INTERFACE_VERSION_LEGACY:
- if (!RegisterCallbackLegacy())
- VLOG(1) << "Unable to successfully run RegisterCallbackLegacy.";
- break;
- default:
- NOTREACHED();
- }
-
- // Adding an intermediate scoped pointer here so that |notify_item_| is reset
- // to NULL.
- scoped_ptr<NOTIFYITEM> rv(notify_item_.release());
- return rv.Pass();
-}
-
-bool StatusTrayStateChangerWin::RegisterCallbackWin8() {
- base::win::ScopedComPtr<ITrayNotifyWin8> tray_notify_win8;
- HRESULT hr = tray_notify_win8.QueryFrom(tray_notify_);
- if (FAILED(hr))
- return false;
-
- // The following two lines cause Windows Explorer to call us back with all the
- // existing tray icons and their preference. It would also presumably notify
- // us if changes were made in realtime while we registered as a callback, but
- // we just want to modify our own entry so we immediately unregister.
- unsigned long callback_id = 0;
- hr = tray_notify_win8->RegisterCallback(this, &callback_id);
- tray_notify_win8->UnregisterCallback(&callback_id);
- if (FAILED(hr)) {
- return false;
- }
-
- return true;
-}
-
-bool StatusTrayStateChangerWin::RegisterCallbackLegacy() {
- base::win::ScopedComPtr<ITrayNotify> tray_notify;
- HRESULT hr = tray_notify.QueryFrom(tray_notify_);
- if (FAILED(hr)) {
- return false;
- }
-
- // The following two lines cause Windows Explorer to call us back with all the
- // existing tray icons and their preference. It would also presumably notify
- // us if changes were made in realtime while we registered as a callback. In
- // this version of the API, there can be only one registered callback so it is
- // better to unregister as soon as possible.
- // TODO(dewittj): Try to notice if the notification area icon customization
- // window is open and postpone this call until the user closes it;
- // registering the callback while the window is open can cause stale data to
- // be displayed to the user.
- hr = tray_notify->RegisterCallback(this);
- tray_notify->RegisterCallback(NULL);
- if (FAILED(hr)) {
- return false;
- }
-
- return true;
-}
-
-void StatusTrayStateChangerWin::SendNotifyItemUpdate(
- scoped_ptr<NOTIFYITEM> notify_item) {
- if (interface_version_ == INTERFACE_VERSION_LEGACY) {
- base::win::ScopedComPtr<ITrayNotify> tray_notify;
- HRESULT hr = tray_notify.QueryFrom(tray_notify_);
- if (SUCCEEDED(hr))
- tray_notify->SetPreference(notify_item.get());
- } else if (interface_version_ == INTERFACE_VERSION_WIN8) {
- base::win::ScopedComPtr<ITrayNotifyWin8> tray_notify;
- HRESULT hr = tray_notify.QueryFrom(tray_notify_);
- if (SUCCEEDED(hr))
- tray_notify->SetPreference(notify_item.get());
- }
-}
diff --git a/chrome/browser/ui/views/status_icons/status_tray_state_changer_win.h b/chrome/browser/ui/views/status_icons/status_tray_state_changer_win.h
deleted file mode 100644
index 43ef7e3..0000000
--- a/chrome/browser/ui/views/status_icons/status_tray_state_changer_win.h
+++ /dev/null
@@ -1,133 +0,0 @@
-// Copyright 2014 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_UI_VIEWS_STATUS_ICONS_STATUS_TRAY_STATE_CHANGER_WIN_H_
-#define CHROME_BROWSER_UI_VIEWS_STATUS_ICONS_STATUS_TRAY_STATE_CHANGER_WIN_H_
-
-#include "base/memory/scoped_ptr.h"
-#include "base/strings/string16.h"
-#include "base/threading/non_thread_safe.h"
-#include "base/win/iunknown_impl.h"
-#include "base/win/scoped_comptr.h"
-
-// The known values for NOTIFYITEM's dwPreference member.
-enum NOTIFYITEM_PREFERENCE {
- // In Windows UI: "Only show notifications."
- PREFERENCE_SHOW_WHEN_ACTIVE = 0,
- // In Windows UI: "Hide icon and notifications."
- PREFERENCE_SHOW_NEVER = 1,
- // In Windows UI: "Show icon and notifications."
- PREFERENCE_SHOW_ALWAYS = 2
-};
-
-// NOTIFYITEM describes an entry in Explorer's registry of status icons.
-// Explorer keeps entries around for a process even after it exits.
-struct NOTIFYITEM {
- PWSTR exe_name; // The file name of the creating executable.
- PWSTR tip; // The last hover-text value associated with this status
- // item.
- HICON icon; // The icon associated with this status item.
- HWND hwnd; // The HWND associated with the status item.
- DWORD preference; // Determines the behavior of the icon with respect to
- // the taskbar. Values taken from NOTIFYITEM_PREFERENCE.
- UINT id; // The ID specified by the application. (hWnd, uID) is
- // unique.
- GUID guid; // The GUID specified by the application, alternative to
- // uID.
-};
-
-// INotificationCB is an interface that applications can implement in order to
-// receive notifications about the state of the notification area manager.
-class __declspec(uuid("D782CCBA-AFB0-43F1-94DB-FDA3779EACCB")) INotificationCB
- : public IUnknown {
- public:
- virtual HRESULT STDMETHODCALLTYPE
- Notify(ULONG event, NOTIFYITEM* notify_item) = 0;
-};
-
-// A class that is capable of reading and writing the state of the notification
-// area in the Windows taskbar. It is used to promote a tray icon from the
-// overflow area to the taskbar, and refuses to do anything if the user has
-// explicitly marked an icon to be always hidden.
-class StatusTrayStateChangerWin : public INotificationCB,
- public base::win::IUnknownImpl,
- public base::NonThreadSafe {
- public:
- StatusTrayStateChangerWin(UINT icon_id, HWND window);
-
- // Call this method to move the icon matching |icon_id| and |window| to the
- // taskbar from the overflow area. This will not make any changes if the
- // icon has been set to |PREFERENCE_SHOW_NEVER|, in order to comply with
- // the explicit wishes/configuration of the user.
- void EnsureTrayIconVisible();
-
- // IUnknown.
- virtual ULONG STDMETHODCALLTYPE AddRef() OVERRIDE;
- virtual ULONG STDMETHODCALLTYPE Release() OVERRIDE;
- virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID, PVOID*) OVERRIDE;
-
- // INotificationCB.
- // Notify is called in response to RegisterCallback for each current
- // entry in Explorer's list of notification area icons, and ever time
- // one of them changes, until UnregisterCallback is called or |this|
- // is destroyed.
- virtual HRESULT STDMETHODCALLTYPE Notify(ULONG, NOTIFYITEM*);
-
- protected:
- virtual ~StatusTrayStateChangerWin();
-
- private:
- friend class StatusTrayStateChangerWinTest;
-
- enum InterfaceVersion {
- INTERFACE_VERSION_LEGACY = 0,
- INTERFACE_VERSION_WIN8,
- INTERFACE_VERSION_UNKNOWN
- };
-
- // Creates an instance of TrayNotify, and ensures that it supports either
- // ITrayNotify or ITrayNotifyWin8. Returns true on success.
- bool CreateTrayNotify();
-
- // Returns the NOTIFYITEM that corresponds to this executable and the
- // HWND/ID pair that were used to create the StatusTrayStateChangerWin.
- // Internally it calls the appropriate RegisterCallback{Win8,Legacy}.
- scoped_ptr<NOTIFYITEM> RegisterCallback();
-
- // Calls RegisterCallback with the appropriate interface required by
- // different versions of Windows. This will result in |notify_item_| being
- // updated when a matching item is passed into
- // StatusTrayStateChangerWin::Notify.
- bool RegisterCallbackWin8();
- bool RegisterCallbackLegacy();
-
- // Sends an update to Explorer with the passed NOTIFYITEM.
- void SendNotifyItemUpdate(scoped_ptr<NOTIFYITEM> notify_item);
-
- // Storing IUnknown since we will need to use different interfaces
- // for different versions of Windows.
- base::win::ScopedComPtr<IUnknown> tray_notify_;
- InterfaceVersion interface_version_;
-
- // The ID assigned to the notification area icon that we want to manipulate.
- const UINT icon_id_;
- // The HWND associated with the notification area icon that we want to
- // manipulate. This is an unretained pointer, do not dereference.
- const HWND window_;
- // Executable name of the current program. Along with |icon_id_| and
- // |window_|, this uniquely identifies a notification area entry to Explorer.
- base::string16 file_name_;
-
- // Temporary storage for the matched NOTIFYITEM. This is necessary because
- // Notify doesn't return anything. The call flow looks like this:
- // TrayNotify->RegisterCallback()
- // ... other COM stack frames ..
- // StatusTrayStateChangerWin->Notify(NOTIFYITEM);
- // so we can't just return the notifyitem we're looking for.
- scoped_ptr<NOTIFYITEM> notify_item_;
-
- DISALLOW_COPY_AND_ASSIGN(StatusTrayStateChangerWin);
-};
-
-#endif // CHROME_BROWSER_UI_VIEWS_STATUS_ICONS_STATUS_TRAY_STATE_CHANGER_WIN_H_
diff --git a/chrome/browser/ui/views/status_icons/status_tray_win.cc b/chrome/browser/ui/views/status_icons/status_tray_win.cc
index 18830d3..bcbe8e6 100644
--- a/chrome/browser/ui/views/status_icons/status_tray_win.cc
+++ b/chrome/browser/ui/views/status_icons/status_tray_win.cc
@@ -6,12 +6,8 @@
#include <commctrl.h>
-#include "base/bind.h"
-#include "base/threading/non_thread_safe.h"
-#include "base/threading/thread.h"
#include "base/win/wrapped_window_proc.h"
#include "chrome/browser/ui/views/status_icons/status_icon_win.h"
-#include "chrome/browser/ui/views/status_icons/status_tray_state_changer_win.h"
#include "chrome/common/chrome_constants.h"
#include "ui/gfx/screen.h"
#include "ui/gfx/win/hwnd_util.h"
@@ -27,66 +23,6 @@ UINT ReservedIconId(StatusTray::StatusIconType type) {
}
} // namespace
-// Default implementation for StatusTrayStateChanger that communicates to
-// Exporer.exe via COM. It spawns a background thread with a fresh COM
-// apartment and requests that the visibility be increased unless the user
-// has explicitly set the icon to be hidden.
-class StatusTrayStateChangerProxyImpl : public StatusTrayStateChangerProxy,
- public base::NonThreadSafe {
- public:
- StatusTrayStateChangerProxyImpl()
- : pending_requests_(0),
- worker_thread_("StatusIconCOMWorkerThread"),
- weak_factory_(this) {
- worker_thread_.init_com_with_mta(false);
- }
-
- virtual void EnqueueChange(UINT icon_id, HWND window) OVERRIDE {
- DCHECK(CalledOnValidThread());
- if (pending_requests_ == 0)
- worker_thread_.Start();
-
- ++pending_requests_;
- worker_thread_.message_loop_proxy()->PostTaskAndReply(
- FROM_HERE,
- base::Bind(
- &StatusTrayStateChangerProxyImpl::EnqueueChangeOnWorkerThread,
- icon_id,
- window),
- base::Bind(&StatusTrayStateChangerProxyImpl::ChangeDone,
- weak_factory_.GetWeakPtr()));
- }
-
- private:
- // Must be called only on |worker_thread_|, to ensure the correct COM
- // apartment.
- static void EnqueueChangeOnWorkerThread(UINT icon_id, HWND window) {
- // It appears that IUnknowns are coincidentally compatible with
- // scoped_refptr. Normally I wouldn't depend on that but it seems that
- // base::win::IUnknownImpl itself depends on that coincidence so it's
- // already being assumed elsewhere.
- scoped_refptr<StatusTrayStateChangerWin> status_tray_state_changer(
- new StatusTrayStateChangerWin(icon_id, window));
- status_tray_state_changer->EnsureTrayIconVisible();
- }
-
- // Called on UI thread.
- void ChangeDone() {
- DCHECK(CalledOnValidThread());
- DCHECK_GT(pending_requests_, 0);
-
- if (--pending_requests_ == 0)
- worker_thread_.Stop();
- }
-
- private:
- int pending_requests_;
- base::Thread worker_thread_;
- base::WeakPtrFactory<StatusTrayStateChangerProxyImpl> weak_factory_;
-
- DISALLOW_COPY_AND_ASSIGN(StatusTrayStateChangerProxyImpl);
-};
-
StatusTrayWin::StatusTrayWin()
: next_icon_id_(1),
atom_(0),
@@ -117,23 +53,6 @@ StatusTrayWin::StatusTrayWin()
gfx::SetWindowUserData(window_, this);
}
-StatusTrayWin::~StatusTrayWin() {
- if (window_)
- DestroyWindow(window_);
-
- if (atom_)
- UnregisterClass(MAKEINTATOM(atom_), instance_);
-}
-
-void StatusTrayWin::UpdateIconVisibilityInBackground(
- StatusIconWin* status_icon) {
- if (!state_changer_proxy_.get())
- state_changer_proxy_.reset(new StatusTrayStateChangerProxyImpl);
-
- state_changer_proxy_->EnqueueChange(status_icon->icon_id(),
- status_icon->window());
-}
-
LRESULT CALLBACK StatusTrayWin::WndProcStatic(HWND hwnd,
UINT message,
WPARAM wparam,
@@ -197,6 +116,14 @@ LRESULT CALLBACK StatusTrayWin::WndProc(HWND hwnd,
return ::DefWindowProc(hwnd, message, wparam, lparam);
}
+StatusTrayWin::~StatusTrayWin() {
+ if (window_)
+ DestroyWindow(window_);
+
+ if (atom_)
+ UnregisterClass(MAKEINTATOM(atom_), instance_);
+}
+
StatusIcon* StatusTrayWin::CreatePlatformStatusIcon(
StatusTray::StatusIconType type,
const gfx::ImageSkia& image,
@@ -208,7 +135,7 @@ StatusIcon* StatusTrayWin::CreatePlatformStatusIcon(
next_icon_id = ReservedIconId(type);
StatusIcon* icon =
- new StatusIconWin(this, next_icon_id, window_, kStatusIconMessage);
+ new StatusIconWin(next_icon_id, window_, kStatusIconMessage);
icon->SetImage(image);
icon->SetToolTip(tool_tip);
@@ -220,11 +147,6 @@ UINT StatusTrayWin::NextIconId() {
return kBaseIconId + static_cast<UINT>(NAMED_STATUS_ICON_COUNT) + icon_id;
}
-void StatusTrayWin::SetStatusTrayStateChangerProxyForTest(
- scoped_ptr<StatusTrayStateChangerProxy> proxy) {
- state_changer_proxy_ = proxy.Pass();
-}
-
StatusTray* StatusTray::Create() {
return new StatusTrayWin();
}
diff --git a/chrome/browser/ui/views/status_icons/status_tray_win.h b/chrome/browser/ui/views/status_icons/status_tray_win.h
index 08a05e8..d624e55 100644
--- a/chrome/browser/ui/views/status_icons/status_tray_win.h
+++ b/chrome/browser/ui/views/status_icons/status_tray_win.h
@@ -8,51 +8,35 @@
#include <windows.h>
#include "base/compiler_specific.h"
-#include "base/memory/scoped_ptr.h"
#include "chrome/browser/status_icons/status_tray.h"
-class StatusIconWin;
-
-// A class that's responsible for increasing, if possible, the visibility
-// of a status tray icon on the taskbar. The default implementation sends
-// a task to a worker thread each time EnqueueChange is called.
-class StatusTrayStateChangerProxy {
- public:
- // Called by StatusTrayWin to request upgraded visibility on the icon
- // represented by the |icon_id|, |window| pair.
- virtual void EnqueueChange(UINT icon_id, HWND window) = 0;
-};
-
class StatusTrayWin : public StatusTray {
public:
StatusTrayWin();
~StatusTrayWin();
- void UpdateIconVisibilityInBackground(StatusIconWin* status_icon);
-
// Exposed for testing.
- LRESULT CALLBACK
- WndProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam);
+ LRESULT CALLBACK WndProc(HWND hwnd,
+ UINT message,
+ WPARAM wparam,
+ LPARAM lparam);
protected:
// Overriden from StatusTray:
- virtual StatusIcon* CreatePlatformStatusIcon(StatusIconType type,
- const gfx::ImageSkia& image,
- const base::string16& tool_tip)
- OVERRIDE;
+ virtual StatusIcon* CreatePlatformStatusIcon(
+ StatusIconType type,
+ const gfx::ImageSkia& image,
+ const base::string16& tool_tip) OVERRIDE;
private:
- FRIEND_TEST_ALL_PREFIXES(StatusTrayWinTest, EnsureVisibleTest);
-
// Static callback invoked when a message comes in to our messaging window.
- static LRESULT CALLBACK
- WndProcStatic(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam);
+ static LRESULT CALLBACK WndProcStatic(HWND hwnd,
+ UINT message,
+ WPARAM wparam,
+ LPARAM lparam);
UINT NextIconId();
- void SetStatusTrayStateChangerProxyForTest(
- scoped_ptr<StatusTrayStateChangerProxy> proxy);
-
// The unique icon ID we will assign to the next icon.
UINT next_icon_id_;
@@ -69,10 +53,6 @@ class StatusTrayWin : public StatusTray {
// reset our status icons.
UINT taskbar_created_message_;
- // Manages changes performed on a background thread to manipulate visibility
- // of notification icons.
- scoped_ptr<StatusTrayStateChangerProxy> state_changer_proxy_;
-
DISALLOW_COPY_AND_ASSIGN(StatusTrayWin);
};
diff --git a/chrome/browser/ui/views/status_icons/status_tray_win_unittest.cc b/chrome/browser/ui/views/status_icons/status_tray_win_unittest.cc
index d302690..5502430 100644
--- a/chrome/browser/ui/views/status_icons/status_tray_win_unittest.cc
+++ b/chrome/browser/ui/views/status_icons/status_tray_win_unittest.cc
@@ -16,29 +16,6 @@
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/image/image_skia.h"
-class FakeStatusTrayStateChangerProxy : public StatusTrayStateChangerProxy {
- public:
- FakeStatusTrayStateChangerProxy()
- : enqueue_called_(false), icon_id_(0), window_(NULL) {}
-
- virtual void EnqueueChange(UINT icon_id, HWND window) {
- enqueue_called_ = true;
- icon_id_ = icon_id;
- window_ = window;
- }
-
- bool enqueue_called() { return enqueue_called_; }
- UINT icon_id() { return icon_id_; }
- HWND window() { return window_; }
-
- private:
- bool enqueue_called_;
- UINT icon_id_;
- HWND window_;
-
- DISALLOW_COPY_AND_ASSIGN(FakeStatusTrayStateChangerProxy);
-};
-
class FakeStatusIconObserver : public StatusIconObserver {
public:
FakeStatusIconObserver()
@@ -127,21 +104,3 @@ TEST(StatusTrayWinTest, HandleOldIconId) {
tray.WndProc(NULL, message_id, icon_id, WM_LBUTTONDOWN);
}
#endif // !defined(USE_AURA)
-
-TEST(StatusTrayWinTest, EnsureVisibleTest) {
- StatusTrayWin tray;
- ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
- gfx::ImageSkia* image = rb.GetImageSkiaNamed(IDR_STATUS_TRAY_ICON);
-
- FakeStatusTrayStateChangerProxy* proxy =
- new FakeStatusTrayStateChangerProxy();
- tray.SetStatusTrayStateChangerProxyForTest(make_scoped_ptr(proxy));
-
- StatusIconWin* icon = static_cast<StatusIconWin*>(tray.CreateStatusIcon(
- StatusTray::OTHER_ICON, *image, base::ASCIIToUTF16("tool tip")));
-
- icon->ForceVisible();
- EXPECT_TRUE(proxy->enqueue_called());
- EXPECT_EQ(proxy->window(), icon->window());
- EXPECT_EQ(proxy->icon_id(), icon->icon_id());
-}
diff --git a/chrome/chrome_browser_ui.gypi b/chrome/chrome_browser_ui.gypi
index 6452651..81dde9f 100644
--- a/chrome/chrome_browser_ui.gypi
+++ b/chrome/chrome_browser_ui.gypi
@@ -1863,8 +1863,6 @@
'browser/ui/views/status_icons/status_tray_linux.h',
'browser/ui/views/status_icons/status_tray_win.cc',
'browser/ui/views/status_icons/status_tray_win.h',
- 'browser/ui/views/status_icons/status_tray_state_changer_win.cc',
- 'browser/ui/views/status_icons/status_tray_state_changer_win.h',
'browser/ui/views/stubs_aura.cc',
'browser/ui/views/sync/one_click_signin_bubble_view.cc',
'browser/ui/views/sync/one_click_signin_bubble_view.h',
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi
index 568a451..14e3b1a 100644
--- a/chrome/chrome_tests.gypi
+++ b/chrome/chrome_tests.gypi
@@ -128,7 +128,6 @@
'browser/ui/views/omnibox/omnibox_view_views_browsertest.cc',
'browser/ui/views/panels/panel_view_browsertest.cc',
'browser/ui/views/ssl_client_certificate_selector_browsertest.cc',
- 'browser/ui/views/status_icons/status_tray_state_changer_interactive_uitest_win.cc',
'browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc',
'browser/ui/views/tabs/tab_drag_controller_interactive_uitest.h',
'browser/ui/views/tabs/tab_drag_controller_interactive_uitest_win.cc',
diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc
index e88a356..45f64b4 100644
--- a/chrome/common/pref_names.cc
+++ b/chrome/common/pref_names.cc
@@ -2125,9 +2125,6 @@ const char kRollbackRequested[] = "RollbackRequested";
const char kMessageCenterShowedFirstRunBalloon[] =
"message_center.showed_first_run_balloon";
-const char kMessageCenterForcedOnTaskbar[] =
- "message_center.was_forced_on_taskbar";
-
// *************** SERVICE PREFS ***************
// These are attached to the service process.
diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h
index 8bc19e1..bc4ff73 100644
--- a/chrome/common/pref_names.h
+++ b/chrome/common/pref_names.h
@@ -766,7 +766,6 @@ extern const char kFactoryResetRequested[];
extern const char kRollbackRequested[];
extern const char kMessageCenterShowedFirstRunBalloon[];
-extern const char kMessageCenterForcedOnTaskbar[];
extern const char kRecoveryComponentVersion[];
extern const char kComponentUpdaterState[];