| Index: chrome/browser/ui/views/message_center/web_notification_tray_win.cc
|
| 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
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..dcc6e259b2f0459a542b088a47e56aedfcf66568
|
| --- /dev/null
|
| +++ b/chrome/browser/ui/views/message_center/web_notification_tray_win.cc
|
| @@ -0,0 +1,61 @@
|
| +// Copyright 2013 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/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"
|
| +#include "chrome/browser/status_icons/status_icon.h"
|
| +#include "chrome/browser/ui/browser.h"
|
| +#include "chrome/browser/ui/browser_finder.h"
|
| +#include "chrome/browser/ui/host_desktop.h"
|
| +#include "chrome/browser/ui/singleton_tabs.h"
|
| +#include "chrome/common/url_constants.h"
|
| +#include "grit/chromium_strings.h"
|
| +#include "third_party/skia/include/core/SkBitmap.h"
|
| +#include "ui/base/l10n/l10n_util.h"
|
| +#include "ui/base/resource/resource_bundle.h"
|
| +#include "ui/gfx/image/image_skia.h"
|
| +
|
| +namespace message_center {
|
| +void WebNotificationTray::OnBalloonClicked() {
|
| + Browser* browser = chrome::FindOrCreateTabbedBrowser(
|
| + ProfileManager::GetLastUsedProfileAllowedByPolicy(),
|
| + chrome::GetActiveDesktop());
|
| + chrome::ShowSingletonTab(browser, GURL(chrome::kNotificationsHelpURL));
|
| +}
|
| +
|
| +void WebNotificationTray::DisplayFirstRunBalloon() {
|
| + StatusIcon* status_icon = GetStatusIcon();
|
| + if (!status_icon)
|
| + return;
|
| +
|
| + base::win::Version win_version = base::win::GetVersion();
|
| + if (win_version == base::win::VERSION_PRE_XP)
|
| + return;
|
| +
|
| + ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
|
| +
|
| + // StatusIconWin uses NIIF_LARGE_ICON if the version is >= vista. According
|
| + // to http://msdn.microsoft.com/en-us/library/windows/desktop/bb773352.aspx:
|
| + // This corresponds to the icon with dimensions SM_CXICON x SM_CYICON. If
|
| + // this flag is not set, the icon with dimensions SM_CXSMICON x SM_CYSMICON
|
| + // is used.
|
| + int icon_size = GetSystemMetrics(SM_CXICON);
|
| + if (win_version < base::win::VERSION_VISTA)
|
| + icon_size = GetSystemMetrics(SM_CXSMICON);
|
| +
|
| + scoped_ptr<SkBitmap> sized_app_icon_bitmap = GetAppIconForSize(icon_size);
|
| + gfx::ImageSkia sized_app_icon_skia =
|
| + gfx::ImageSkia::CreateFrom1xBitmap(*sized_app_icon_bitmap);
|
| + string16 product_name(l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME));
|
| + GetStatusIcon()->DisplayBalloon(
|
| + sized_app_icon_skia,
|
| + l10n_util::GetStringUTF16(IDS_MESSAGE_CENTER_BALLOON_TITLE),
|
| + l10n_util::GetStringUTF16(IDS_MESSAGE_CENTER_BALLOON_TEXT));
|
| +}
|
| +} // namespace message_center
|
|
|