Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(538)

Side by Side Diff: chrome/browser/ui/views/message_center/web_notification_tray_win.cc

Issue 17286015: Adds a first-run balloon to the Windows notification center. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 "grit/ui_strings.h"
14 #include "third_party/skia/include/core/SkBitmap.h"
15 #include "ui/base/l10n/l10n_util.h"
16 #include "ui/base/resource/resource_bundle.h"
17 #include "ui/gfx/image/image_skia.h"
18
19 namespace message_center {
20 void WebNotificationTray::DisplayFirstRunBalloon() {
21 StatusIcon* status_icon = GetStatusIcon();
22 if (!status_icon)
23 return;
24
25 base::win::Version win_version = base::win::GetVersion();
26 if (win_version == base::win::VERSION_PRE_XP)
27 return;
28
29 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
30
31 // StatusIconWin uses NIIF_LARGE_ICON if the version is >= vista. According
32 // to http://msdn.microsoft.com/en-us/library/windows/desktop/bb773352.aspx:
33 // This corresponds to the icon with dimensions SM_CXICON x SM_CYICON. If
34 // this flag is not set, the icon with dimensions SM_CXSMICON x SM_CYSMICON
35 // is used.
36 int icon_size = GetSystemMetrics(SM_CXICON);
37 if (win_version < base::win::VERSION_VISTA)
38 icon_size = GetSystemMetrics(SM_CXSMICON);
39
40 scoped_ptr<SkBitmap> sized_app_icon_bitmap = GetAppIconForSize(icon_size);
41 gfx::ImageSkia sized_app_icon_skia =
42 gfx::ImageSkia::CreateFrom1xBitmap(*sized_app_icon_bitmap);
43 string16 product_name(l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME));
44 GetStatusIcon()->DisplayBalloon(
45 sized_app_icon_skia,
46 l10n_util::GetStringFUTF16(IDS_MESSAGE_CENTER_BALLOON_TITLE,
47 product_name),
48 l10n_util::GetStringFUTF16(IDS_MESSAGE_CENTER_BALLOON_TEXT,
49 product_name));
50 }
51 } // namespace message_center
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698