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

Side by Side Diff: ui/message_center/views/notification_view.cc

Issue 246633004: Remove non USE_AURA code from views files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to ToT and throw away conflicting files; I'll redo them in another patch. Created 6 years, 8 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/message_center/views/notification_view.h" 5 #include "ui/message_center/views/notification_view.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "grit/ui_resources.h" 10 #include "grit/ui_resources.h"
11 #include "grit/ui_strings.h" 11 #include "grit/ui_strings.h"
12 #include "ui/base/cursor/cursor.h"
12 #include "ui/base/l10n/l10n_util.h" 13 #include "ui/base/l10n/l10n_util.h"
13 #include "ui/base/layout.h" 14 #include "ui/base/layout.h"
14 #include "ui/base/resource/resource_bundle.h" 15 #include "ui/base/resource/resource_bundle.h"
15 #include "ui/gfx/canvas.h" 16 #include "ui/gfx/canvas.h"
16 #include "ui/gfx/size.h" 17 #include "ui/gfx/size.h"
17 #include "ui/gfx/skia_util.h" 18 #include "ui/gfx/skia_util.h"
18 #include "ui/gfx/text_elider.h" 19 #include "ui/gfx/text_elider.h"
19 #include "ui/message_center/message_center.h" 20 #include "ui/message_center/message_center.h"
20 #include "ui/message_center/message_center_style.h" 21 #include "ui/message_center/message_center_style.h"
21 #include "ui/message_center/message_center_switches.h" 22 #include "ui/message_center/message_center_switches.h"
(...skipping 11 matching lines...) Expand all
33 #include "ui/views/border.h" 34 #include "ui/views/border.h"
34 #include "ui/views/controls/button/image_button.h" 35 #include "ui/views/controls/button/image_button.h"
35 #include "ui/views/controls/image_view.h" 36 #include "ui/views/controls/image_view.h"
36 #include "ui/views/controls/label.h" 37 #include "ui/views/controls/label.h"
37 #include "ui/views/controls/progress_bar.h" 38 #include "ui/views/controls/progress_bar.h"
38 #include "ui/views/layout/box_layout.h" 39 #include "ui/views/layout/box_layout.h"
39 #include "ui/views/layout/fill_layout.h" 40 #include "ui/views/layout/fill_layout.h"
40 #include "ui/views/painter.h" 41 #include "ui/views/painter.h"
41 #include "ui/views/widget/widget.h" 42 #include "ui/views/widget/widget.h"
42 43
43 #if defined(USE_AURA)
44 #include "ui/base/cursor/cursor.h"
45 #endif
46
47 namespace { 44 namespace {
48 45
49 // Dimensions. 46 // Dimensions.
50 const int kProgressBarWidth = message_center::kNotificationWidth - 47 const int kProgressBarWidth = message_center::kNotificationWidth -
51 message_center::kTextLeftPadding - message_center::kTextRightPadding; 48 message_center::kTextLeftPadding - message_center::kTextRightPadding;
52 const int kProgressBarBottomPadding = 0; 49 const int kProgressBarBottomPadding = 0;
53 50
54 // static 51 // static
55 scoped_ptr<views::Border> MakeEmptyBorder(int top, 52 scoped_ptr<views::Border> MakeEmptyBorder(int top,
56 int left, 53 int left,
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 return buttons[i]->GetEventHandlerForPoint(point_in_child); 539 return buttons[i]->GetEventHandlerForPoint(point_in_child);
543 } 540 }
544 541
545 return this; 542 return this;
546 } 543 }
547 544
548 gfx::NativeCursor NotificationView::GetCursor(const ui::MouseEvent& event) { 545 gfx::NativeCursor NotificationView::GetCursor(const ui::MouseEvent& event) {
549 if (!clickable_ || !controller_->HasClickedListener(notification_id())) 546 if (!clickable_ || !controller_->HasClickedListener(notification_id()))
550 return views::View::GetCursor(event); 547 return views::View::GetCursor(event);
551 548
552 #if defined(USE_AURA)
553 return ui::kCursorHand; 549 return ui::kCursorHand;
554 #elif defined(OS_WIN)
555 static HCURSOR g_hand_cursor = LoadCursor(NULL, IDC_HAND);
556 return g_hand_cursor;
557 #endif
558 } 550 }
559 551
560 void NotificationView::ButtonPressed(views::Button* sender, 552 void NotificationView::ButtonPressed(views::Button* sender,
561 const ui::Event& event) { 553 const ui::Event& event) {
562 // Certain operations can cause |this| to be destructed, so copy the members 554 // Certain operations can cause |this| to be destructed, so copy the members
563 // we send to other parts of the code. 555 // we send to other parts of the code.
564 // TODO(dewittj): Remove this hack. 556 // TODO(dewittj): Remove this hack.
565 std::string id(notification_id()); 557 std::string id(notification_id());
566 // See if the button pressed was an action button. 558 // See if the button pressed was an action button.
567 for (size_t i = 0; i < action_buttons_.size(); ++i) { 559 for (size_t i = 0; i < action_buttons_.size(); ++i) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 DCHECK_GT(message_line_limit, 0); 596 DCHECK_GT(message_line_limit, 0);
605 return message_line_limit; 597 return message_line_limit;
606 } 598 }
607 599
608 int NotificationView::GetMessageHeight(int width, int limit) { 600 int NotificationView::GetMessageHeight(int width, int limit) {
609 return message_view_ ? 601 return message_view_ ?
610 message_view_->GetSizeForWidthAndLines(width, limit).height() : 0; 602 message_view_->GetSizeForWidthAndLines(width, limit).height() : 0;
611 } 603 }
612 604
613 } // namespace message_center 605 } // namespace message_center
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698