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

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

Issue 2480813003: Reduce views::Border creation verbosity by promoting factory functions (Closed)
Patch Set: fix bad merge Created 4 years, 1 month 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
OLDNEW
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/location.h" 6 #include "base/location.h"
7 #include "base/single_thread_task_runner.h" 7 #include "base/single_thread_task_runner.h"
8 #include "base/threading/thread_task_runner_handle.h" 8 #include "base/threading/thread_task_runner_handle.h"
9 #include "ui/gfx/animation/slide_animation.h" 9 #include "ui/gfx/animation/slide_animation.h"
10 #include "ui/message_center/message_center_style.h" 10 #include "ui/message_center/message_center_style.h"
(...skipping 28 matching lines...) Expand all
39 layout->SetDefaultFlex(1); 39 layout->SetDefaultFlex(1);
40 SetLayoutManager(layout); 40 SetLayoutManager(layout);
41 41
42 // Set the margin to 0 for the layout. BoxLayout assumes the same margin 42 // Set the margin to 0 for the layout. BoxLayout assumes the same margin
43 // for top and bottom, but the bottom margin here should be smaller 43 // for top and bottom, but the bottom margin here should be smaller
44 // because of the shadow of message view. Use an empty border instead 44 // because of the shadow of message view. Use an empty border instead
45 // to provide this margin. 45 // to provide this margin.
46 gfx::Insets shadow_insets = MessageView::GetShadowInsets(); 46 gfx::Insets shadow_insets = MessageView::GetShadowInsets();
47 set_background( 47 set_background(
48 views::Background::CreateSolidBackground(kMessageCenterBackgroundColor)); 48 views::Background::CreateSolidBackground(kMessageCenterBackgroundColor));
49 SetBorder(views::Border::CreateEmptyBorder( 49 SetBorder(views::CreateEmptyBorder(
50 top_down ? 0 : kMarginBetweenItems - shadow_insets.top(), /* top */ 50 top_down ? 0 : kMarginBetweenItems - shadow_insets.top(), /* top */
51 kMarginBetweenItems - shadow_insets.left(), /* left */ 51 kMarginBetweenItems - shadow_insets.left(), /* left */
52 top_down ? kMarginBetweenItems - shadow_insets.bottom() : 0, /* bottom */ 52 top_down ? kMarginBetweenItems - shadow_insets.bottom() : 0, /* bottom */
53 kMarginBetweenItems - shadow_insets.right() /* right */)); 53 kMarginBetweenItems - shadow_insets.right() /* right */));
54 animator_.AddObserver(this); 54 animator_.AddObserver(this);
55 } 55 }
56 56
57 MessageListView::~MessageListView() { 57 MessageListView::~MessageListView() {
58 animator_.RemoveObserver(this); 58 animator_.RemoveObserver(this);
59 } 59 }
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 base::TimeDelta::FromMilliseconds( 465 base::TimeDelta::FromMilliseconds(
466 kAnimateClearingNextNotificationDelayMS)); 466 kAnimateClearingNextNotificationDelayMS));
467 } 467 }
468 } 468 }
469 469
470 void MessageListView::SetRepositionTargetForTest(const gfx::Rect& target_rect) { 470 void MessageListView::SetRepositionTargetForTest(const gfx::Rect& target_rect) {
471 SetRepositionTarget(target_rect); 471 SetRepositionTarget(target_rect);
472 } 472 }
473 473
474 } // namespace message_center 474 } // namespace message_center
OLDNEW
« no previous file with comments | « ui/message_center/views/message_center_view.cc ('k') | ui/message_center/views/notification_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698