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

Side by Side Diff: ui/arc/notification/arc_custom_notification_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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/arc/notification/arc_custom_notification_view.h" 5 #include "ui/arc/notification/arc_custom_notification_view.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "components/exo/notification_surface.h" 8 #include "components/exo/notification_surface.h"
9 #include "components/exo/surface.h" 9 #include "components/exo/surface.h"
10 #include "third_party/skia/include/core/SkColor.h" 10 #include "third_party/skia/include/core/SkColor.h"
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 180
181 floating_close_button_ = new views::ImageButton(this); 181 floating_close_button_ = new views::ImageButton(this);
182 floating_close_button_->set_background( 182 floating_close_button_->set_background(
183 views::Background::CreateSolidBackground(SK_ColorTRANSPARENT)); 183 views::Background::CreateSolidBackground(SK_ColorTRANSPARENT));
184 184
185 // The sizes below are in DIPs. 185 // The sizes below are in DIPs.
186 constexpr int kPaddingFromBorder = 4; 186 constexpr int kPaddingFromBorder = 4;
187 constexpr int kImageSize = 16; 187 constexpr int kImageSize = 16;
188 constexpr int kTouchExtendedPadding = 188 constexpr int kTouchExtendedPadding =
189 message_center::kControlButtonSize - kImageSize - kPaddingFromBorder; 189 message_center::kControlButtonSize - kImageSize - kPaddingFromBorder;
190 floating_close_button_->SetBorder(views::Border::CreateEmptyBorder( 190 floating_close_button_->SetBorder(
191 kPaddingFromBorder, kTouchExtendedPadding, kTouchExtendedPadding, 191 views::CreateEmptyBorder(kPaddingFromBorder, kTouchExtendedPadding,
192 kPaddingFromBorder)); 192 kTouchExtendedPadding, kPaddingFromBorder));
193 193
194 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 194 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
195 floating_close_button_->SetImage( 195 floating_close_button_->SetImage(
196 views::CustomButton::STATE_NORMAL, 196 views::CustomButton::STATE_NORMAL,
197 rb.GetImageSkiaNamed(IDR_ARC_NOTIFICATION_CLOSE)); 197 rb.GetImageSkiaNamed(IDR_ARC_NOTIFICATION_CLOSE));
198 floating_close_button_->set_animate_on_state_change(false); 198 floating_close_button_->set_animate_on_state_change(false);
199 floating_close_button_->SetAccessibleName(l10n_util::GetStringUTF16( 199 floating_close_button_->SetAccessibleName(l10n_util::GetStringUTF16(
200 IDS_MESSAGE_CENTER_CLOSE_NOTIFICATION_BUTTON_ACCESSIBLE_NAME)); 200 IDS_MESSAGE_CENTER_CLOSE_NOTIFICATION_BUTTON_ACCESSIBLE_NAME));
201 201
202 views::Widget::InitParams params(views::Widget::InitParams::TYPE_CONTROL); 202 views::Widget::InitParams params(views::Widget::InitParams::TYPE_CONTROL);
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 445
446 void ArcCustomNotificationView::OnNotificationSurfaceRemoved( 446 void ArcCustomNotificationView::OnNotificationSurfaceRemoved(
447 exo::NotificationSurface* surface) { 447 exo::NotificationSurface* surface) {
448 if (surface->notification_id() != notification_key_) 448 if (surface->notification_id() != notification_key_)
449 return; 449 return;
450 450
451 SetSurface(nullptr); 451 SetSurface(nullptr);
452 } 452 }
453 453
454 } // namespace arc 454 } // namespace arc
OLDNEW
« no previous file with comments | « ui/app_list/views/search_result_tile_item_list_view.cc ('k') | ui/chromeos/ime/candidate_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698