OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/ui/views/message_center/web_notification_tray.h" |
| 6 |
| 7 #include <windows.h> |
| 8 |
| 9 #include "base/win/windows_version.h" |
| 10 #include "chrome/browser/app_icon_win.h" |
| 11 #include "chrome/browser/status_icons/status_icon.h" |
| 12 #include "grit/chromium_strings.h" |
| 13 #include "third_party/skia/include/core/SkBitmap.h" |
| 14 #include "ui/base/l10n/l10n_util.h" |
| 15 #include "ui/base/resource/resource_bundle.h" |
| 16 #include "ui/gfx/image/image_skia.h" |
| 17 |
| 18 namespace message_center { |
| 19 void WebNotificationTray::DisplayFirstRunBalloon() { |
| 20 StatusIcon* status_icon = GetStatusIcon(); |
| 21 if (!status_icon) |
| 22 return; |
| 23 |
| 24 base::win::Version win_version = base::win::GetVersion(); |
| 25 if (win_version == base::win::VERSION_PRE_XP) |
| 26 return; |
| 27 |
| 28 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 29 |
| 30 // StatusIconWin uses NIIF_LARGE_ICON if the version is >= vista. According |
| 31 // to http://msdn.microsoft.com/en-us/library/windows/desktop/bb773352.aspx: |
| 32 // This corresponds to the icon with dimensions SM_CXICON x SM_CYICON. If |
| 33 // this flag is not set, the icon with dimensions SM_CXSMICON x SM_CYSMICON |
| 34 // is used. |
| 35 int icon_size = GetSystemMetrics(SM_CXICON); |
| 36 if (win_version < base::win::VERSION_VISTA) |
| 37 icon_size = GetSystemMetrics(SM_CXSMICON); |
| 38 |
| 39 scoped_ptr<SkBitmap> sized_app_icon_bitmap = GetAppIconForSize(icon_size); |
| 40 gfx::ImageSkia sized_app_icon_skia = |
| 41 gfx::ImageSkia::CreateFrom1xBitmap(*sized_app_icon_bitmap); |
| 42 string16 product_name(l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME)); |
| 43 GetStatusIcon()->DisplayBalloon( |
| 44 sized_app_icon_skia, |
| 45 l10n_util::GetStringUTF16(IDS_MESSAGE_CENTER_BALLOON_TITLE), |
| 46 l10n_util::GetStringUTF16(IDS_MESSAGE_CENTER_BALLOON_TEXT)); |
| 47 } |
| 48 } // namespace message_center |
OLD | NEW |