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

Side by Side Diff: chrome/browser/ui/views/message_center/web_notification_tray.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: Moar fixes. 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
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/views/message_center/web_notification_tray.h" 5 #include "chrome/browser/ui/views/message_center/web_notification_tray.h"
6 6
7 #include "base/i18n/number_formatting.h" 7 #include "base/i18n/number_formatting.h"
8 #include "base/strings/string16.h" 8 #include "base/strings/string16.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
11 #include "chrome/browser/profiles/profile_manager.h"
11 #include "chrome/browser/status_icons/status_icon.h" 12 #include "chrome/browser/status_icons/status_icon.h"
12 #include "chrome/browser/status_icons/status_tray.h" 13 #include "chrome/browser/status_icons/status_tray.h"
14 #include "chrome/browser/ui/browser_finder.h"
15 #include "chrome/browser/ui/host_desktop.h"
16 #include "chrome/browser/ui/singleton_tabs.h"
13 #include "chrome/browser/ui/views/message_center/notification_bubble_wrapper.h" 17 #include "chrome/browser/ui/views/message_center/notification_bubble_wrapper.h"
18 #include "chrome/common/url_constants.h"
14 #include "content/public/browser/user_metrics.h" 19 #include "content/public/browser/user_metrics.h"
15 #include "grit/chromium_strings.h" 20 #include "grit/chromium_strings.h"
16 #include "grit/theme_resources.h" 21 #include "grit/theme_resources.h"
17 #include "grit/ui_strings.h" 22 #include "grit/ui_strings.h"
18 #include "ui/base/l10n/l10n_util.h" 23 #include "ui/base/l10n/l10n_util.h"
19 #include "ui/base/models/simple_menu_model.h" 24 #include "ui/base/models/simple_menu_model.h"
20 #include "ui/base/resource/resource_bundle.h" 25 #include "ui/base/resource/resource_bundle.h"
21 #include "ui/gfx/canvas.h" 26 #include "ui/gfx/canvas.h"
22 #include "ui/gfx/image/image_skia_operations.h" 27 #include "ui/gfx/image/image_skia_operations.h"
23 #include "ui/gfx/rect.h" 28 #include "ui/gfx/rect.h"
24 #include "ui/gfx/screen.h" 29 #include "ui/gfx/screen.h"
25 #include "ui/gfx/size.h" 30 #include "ui/gfx/size.h"
26 #include "ui/message_center/message_center_tray.h" 31 #include "ui/message_center/message_center_tray.h"
27 #include "ui/message_center/message_center_tray_delegate.h" 32 #include "ui/message_center/message_center_tray_delegate.h"
28 #include "ui/message_center/views/message_bubble_base.h" 33 #include "ui/message_center/views/message_bubble_base.h"
29 #include "ui/message_center/views/message_center_bubble.h" 34 #include "ui/message_center/views/message_center_bubble.h"
30 #include "ui/message_center/views/message_popup_collection.h" 35 #include "ui/message_center/views/message_popup_collection.h"
31 #include "ui/views/widget/widget.h" 36 #include "ui/views/widget/widget.h"
32 37
33 #if defined(OS_WIN)
34 #include "ui/base/win/hwnd_util.h"
35 #endif
36
37 namespace { 38 namespace {
38 39
39 // Tray constants 40 // Tray constants
40 const int kScreenEdgePadding = 2; 41 const int kScreenEdgePadding = 2;
41 42
42 const int kSystemTrayWidth = 16; 43 const int kSystemTrayWidth = 16;
43 const int kSystemTrayHeight = 16; 44 const int kSystemTrayHeight = 16;
44 const int kNumberOfSystemTraySprites = 10; 45 const int kNumberOfSystemTraySprites = 10;
45 46
46 gfx::Rect GetCornerAnchorRect() { 47 gfx::Rect GetCornerAnchorRect() {
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 } 287 }
287 } 288 }
288 289
289 void WebNotificationTray::OnStatusIconClicked() { 290 void WebNotificationTray::OnStatusIconClicked() {
290 // TODO(dewittj): It's possible GetNativeScreen is wrong for win-aura. 291 // TODO(dewittj): It's possible GetNativeScreen is wrong for win-aura.
291 gfx::Screen* screen = gfx::Screen::GetNativeScreen(); 292 gfx::Screen* screen = gfx::Screen::GetNativeScreen();
292 mouse_click_point_ = screen->GetCursorScreenPoint(); 293 mouse_click_point_ = screen->GetCursorScreenPoint();
293 message_center_tray_->ToggleMessageCenterBubble(); 294 message_center_tray_->ToggleMessageCenterBubble();
294 } 295 }
295 296
297 void WebNotificationTray::OnBalloonClicked() {
298 Browser* browser = chrome::FindOrCreateTabbedBrowser(
299 ProfileManager::GetLastUsedProfileAllowedByPolicy(),
300 chrome::GetActiveDesktop());
301 chrome::ShowSingletonTab(browser, GURL(chrome::kNotificationsHelpURL));
302 }
303
296 void WebNotificationTray::HideBubbleWithView( 304 void WebNotificationTray::HideBubbleWithView(
297 const views::TrayBubbleView* bubble_view) { 305 const views::TrayBubbleView* bubble_view) {
298 if (message_center_bubble_.get() && 306 if (message_center_bubble_.get() &&
299 bubble_view == message_center_bubble_->bubble_view()) { 307 bubble_view == message_center_bubble_->bubble_view()) {
300 message_center_tray_->HideMessageCenterBubble(); 308 message_center_tray_->HideMessageCenterBubble();
301 } 309 }
302 } 310 }
303 311
304 StatusIcon* WebNotificationTray::GetStatusIcon() { 312 StatusIcon* WebNotificationTray::GetStatusIcon() {
305 if (status_icon_) 313 if (status_icon_)
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 346
339 message_center::MessageCenterBubble* 347 message_center::MessageCenterBubble*
340 WebNotificationTray::GetMessageCenterBubbleForTest() { 348 WebNotificationTray::GetMessageCenterBubbleForTest() {
341 if (!message_center_bubble_.get()) 349 if (!message_center_bubble_.get())
342 return NULL; 350 return NULL;
343 return static_cast<message_center::MessageCenterBubble*>( 351 return static_cast<message_center::MessageCenterBubble*>(
344 message_center_bubble_->bubble()); 352 message_center_bubble_->bubble());
345 } 353 }
346 354
347 } // namespace message_center 355 } // namespace message_center
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698