OLD | NEW |
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_notification_content_view.h" | 5 #include "ui/arc/notification/arc_notification_content_view.h" |
6 | 6 |
7 #include "ash/wm/window_util.h" | 7 #include "ash/wm/window_util.h" |
8 #include "base/auto_reset.h" | 8 #include "base/auto_reset.h" |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "components/exo/notification_surface.h" | 10 #include "components/exo/notification_surface.h" |
11 #include "components/exo/surface.h" | 11 #include "components/exo/surface.h" |
12 #include "ui/accessibility/ax_action_data.h" | 12 #include "ui/accessibility/ax_action_data.h" |
13 #include "ui/accessibility/ax_node_data.h" | 13 #include "ui/accessibility/ax_node_data.h" |
| 14 #include "ui/arc/notification/arc_notification_surface.h" |
14 #include "ui/arc/notification/arc_notification_view.h" | 15 #include "ui/arc/notification/arc_notification_view.h" |
15 #include "ui/base/l10n/l10n_util.h" | 16 #include "ui/base/l10n/l10n_util.h" |
16 #include "ui/base/resource/resource_bundle.h" | 17 #include "ui/base/resource/resource_bundle.h" |
17 #include "ui/compositor/layer_animation_observer.h" | 18 #include "ui/compositor/layer_animation_observer.h" |
18 #include "ui/events/event_handler.h" | 19 #include "ui/events/event_handler.h" |
19 #include "ui/gfx/animation/linear_animation.h" | 20 #include "ui/gfx/animation/linear_animation.h" |
20 #include "ui/gfx/animation/tween.h" | 21 #include "ui/gfx/animation/tween.h" |
21 #include "ui/gfx/canvas.h" | 22 #include "ui/gfx/canvas.h" |
22 #include "ui/gfx/transform.h" | 23 #include "ui/gfx/transform.h" |
23 #include "ui/message_center/message_center_style.h" | 24 #include "ui/message_center/message_center_style.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 | 105 |
105 class ArcNotificationContentView::SlideHelper | 106 class ArcNotificationContentView::SlideHelper |
106 : public ui::LayerAnimationObserver { | 107 : public ui::LayerAnimationObserver { |
107 public: | 108 public: |
108 explicit SlideHelper(ArcNotificationContentView* owner) : owner_(owner) { | 109 explicit SlideHelper(ArcNotificationContentView* owner) : owner_(owner) { |
109 GetSlideOutLayer()->GetAnimator()->AddObserver(this); | 110 GetSlideOutLayer()->GetAnimator()->AddObserver(this); |
110 | 111 |
111 // Reset opacity to 1 to handle to case when the surface is sliding before | 112 // Reset opacity to 1 to handle to case when the surface is sliding before |
112 // getting managed by this class, e.g. sliding in a popup before showing | 113 // getting managed by this class, e.g. sliding in a popup before showing |
113 // in a message center view. | 114 // in a message center view. |
114 if (owner_->surface_ && owner_->surface_->window()) | 115 if (owner_->surface_ && owner_->surface_->GetWindow()) |
115 owner_->surface_->window()->layer()->SetOpacity(1.0f); | 116 owner_->surface_->GetWindow()->layer()->SetOpacity(1.0f); |
116 } | 117 } |
117 ~SlideHelper() override { | 118 ~SlideHelper() override { |
118 if (GetSlideOutLayer()) | 119 if (GetSlideOutLayer()) |
119 GetSlideOutLayer()->GetAnimator()->RemoveObserver(this); | 120 GetSlideOutLayer()->GetAnimator()->RemoveObserver(this); |
120 } | 121 } |
121 | 122 |
122 void Update() { | 123 void Update() { |
123 const bool has_animation = | 124 const bool has_animation = |
124 GetSlideOutLayer()->GetAnimator()->is_animating(); | 125 GetSlideOutLayer()->GetAnimator()->is_animating(); |
125 const bool has_transform = !GetSlideOutLayer()->transform().IsIdentity(); | 126 const bool has_transform = !GetSlideOutLayer()->transform().IsIdentity(); |
(...skipping 10 matching lines...) Expand all Loading... |
136 } | 137 } |
137 | 138 |
138 private: | 139 private: |
139 // This is a temporary hack to address crbug.com/718965 | 140 // This is a temporary hack to address crbug.com/718965 |
140 ui::Layer* GetSlideOutLayer() { | 141 ui::Layer* GetSlideOutLayer() { |
141 ui::Layer* layer = owner_->parent()->layer(); | 142 ui::Layer* layer = owner_->parent()->layer(); |
142 return layer ? layer : owner_->GetWidget()->GetLayer(); | 143 return layer ? layer : owner_->GetWidget()->GetLayer(); |
143 } | 144 } |
144 | 145 |
145 void OnSlideStart() { | 146 void OnSlideStart() { |
146 if (!owner_->surface_ || !owner_->surface_->window()) | 147 if (!owner_->surface_ || !owner_->surface_->GetWindow()) |
147 return; | 148 return; |
148 surface_copy_ = ::wm::RecreateLayers(owner_->surface_->window()); | 149 surface_copy_ = ::wm::RecreateLayers(owner_->surface_->GetWindow()); |
149 // |surface_copy_| is at (0, 0) in owner_->layer(). | 150 // |surface_copy_| is at (0, 0) in owner_->layer(). |
150 surface_copy_->root()->SetBounds(gfx::Rect(surface_copy_->root()->size())); | 151 surface_copy_->root()->SetBounds(gfx::Rect(surface_copy_->root()->size())); |
151 owner_->layer()->Add(surface_copy_->root()); | 152 owner_->layer()->Add(surface_copy_->root()); |
152 owner_->surface_->window()->layer()->SetOpacity(0.0f); | 153 owner_->surface_->GetWindow()->layer()->SetOpacity(0.0f); |
153 } | 154 } |
154 | 155 |
155 void OnSlideEnd() { | 156 void OnSlideEnd() { |
156 if (!owner_->surface_ || !owner_->surface_->window()) | 157 if (!owner_->surface_ || !owner_->surface_->GetWindow()) |
157 return; | 158 return; |
158 owner_->surface_->window()->layer()->SetOpacity(1.0f); | 159 owner_->surface_->GetWindow()->layer()->SetOpacity(1.0f); |
159 owner_->Layout(); | 160 owner_->Layout(); |
160 surface_copy_.reset(); | 161 surface_copy_.reset(); |
161 } | 162 } |
162 | 163 |
163 // ui::LayerAnimationObserver | 164 // ui::LayerAnimationObserver |
164 void OnLayerAnimationEnded(ui::LayerAnimationSequence* seq) override { | 165 void OnLayerAnimationEnded(ui::LayerAnimationSequence* seq) override { |
165 Update(); | 166 Update(); |
166 } | 167 } |
167 void OnLayerAnimationAborted(ui::LayerAnimationSequence* seq) override { | 168 void OnLayerAnimationAborted(ui::LayerAnimationSequence* seq) override { |
168 Update(); | 169 Update(); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 void ArcNotificationContentView::ControlButton::OnFocus() { | 225 void ArcNotificationContentView::ControlButton::OnFocus() { |
225 message_center::PaddedButton::OnFocus(); | 226 message_center::PaddedButton::OnFocus(); |
226 owner_->UpdateControlButtonsVisibility(); | 227 owner_->UpdateControlButtonsVisibility(); |
227 } | 228 } |
228 | 229 |
229 void ArcNotificationContentView::ControlButton::OnBlur() { | 230 void ArcNotificationContentView::ControlButton::OnBlur() { |
230 message_center::PaddedButton::OnBlur(); | 231 message_center::PaddedButton::OnBlur(); |
231 owner_->UpdateControlButtonsVisibility(); | 232 owner_->UpdateControlButtonsVisibility(); |
232 } | 233 } |
233 | 234 |
| 235 // static |
| 236 const char ArcNotificationContentView::kViewClassName[] = |
| 237 "ArcNotificationContentView"; |
| 238 |
| 239 // static |
| 240 ArcNotificationSurfaceManager* |
| 241 ArcNotificationContentView::surface_manager_for_testing_ = nullptr; |
| 242 |
234 ArcNotificationContentView::ArcNotificationContentView( | 243 ArcNotificationContentView::ArcNotificationContentView( |
235 ArcNotificationItem* item) | 244 ArcNotificationItem* item) |
236 : item_(item), | 245 : item_(item), |
237 notification_key_(item->GetNotificationKey()), | 246 notification_key_(item->GetNotificationKey()), |
238 event_forwarder_(new EventForwarder(this)) { | 247 event_forwarder_(new EventForwarder(this)) { |
239 SetFocusBehavior(FocusBehavior::ALWAYS); | 248 SetFocusBehavior(FocusBehavior::ALWAYS); |
240 | 249 |
241 item_->IncrementWindowRefCount(); | 250 item_->IncrementWindowRefCount(); |
242 item_->AddObserver(this); | 251 item_->AddObserver(this); |
243 | 252 |
244 auto* surface_manager = ArcNotificationSurfaceManager::Get(); | 253 auto* surface_manager = GetSurfaceManager(); |
245 if (surface_manager) { | 254 if (surface_manager) { |
246 surface_manager->AddObserver(this); | 255 surface_manager->AddObserver(this); |
247 exo::NotificationSurface* surface = | 256 ArcNotificationSurface* surface = |
248 surface_manager->GetSurface(notification_key_); | 257 surface_manager->GetArcSurface(notification_key_); |
249 if (surface) | 258 if (surface) |
250 OnNotificationSurfaceAdded(surface); | 259 OnNotificationSurfaceAdded(surface); |
251 } | 260 } |
252 | 261 |
253 // Create a layer as an anchor to insert surface copy during a slide. | 262 // Create a layer as an anchor to insert surface copy during a slide. |
254 SetPaintToLayer(); | 263 SetPaintToLayer(); |
255 UpdatePreferredSize(); | 264 UpdatePreferredSize(); |
256 UpdateAccessibleName(); | 265 UpdateAccessibleName(); |
257 } | 266 } |
258 | 267 |
259 ArcNotificationContentView::~ArcNotificationContentView() { | 268 ArcNotificationContentView::~ArcNotificationContentView() { |
260 SetSurface(nullptr); | 269 SetSurface(nullptr); |
261 | 270 |
262 auto* surface_manager = ArcNotificationSurfaceManager::Get(); | 271 auto* surface_manager = GetSurfaceManager(); |
263 if (surface_manager) | 272 if (surface_manager) |
264 surface_manager->RemoveObserver(this); | 273 surface_manager->RemoveObserver(this); |
265 if (item_) { | 274 if (item_) { |
266 item_->RemoveObserver(this); | 275 item_->RemoveObserver(this); |
267 item_->DecrementWindowRefCount(); | 276 item_->DecrementWindowRefCount(); |
268 } | 277 } |
269 } | 278 } |
270 | 279 |
| 280 const char* ArcNotificationContentView::GetClassName() const { |
| 281 return kViewClassName; |
| 282 } |
| 283 |
271 std::unique_ptr<ArcNotificationContentViewDelegate> | 284 std::unique_ptr<ArcNotificationContentViewDelegate> |
272 ArcNotificationContentView::CreateContentViewDelegate() { | 285 ArcNotificationContentView::CreateContentViewDelegate() { |
273 return base::MakeUnique<ArcNotificationContentView::ContentViewDelegate>( | 286 return base::MakeUnique<ArcNotificationContentView::ContentViewDelegate>( |
274 this); | 287 this); |
275 } | 288 } |
276 | 289 |
| 290 ArcNotificationSurfaceManager* ArcNotificationContentView::GetSurfaceManager() |
| 291 const { |
| 292 if (surface_manager_for_testing_) |
| 293 return surface_manager_for_testing_; |
| 294 return ArcNotificationSurfaceManager::Get(); |
| 295 } |
| 296 |
277 void ArcNotificationContentView::CreateCloseButton() { | 297 void ArcNotificationContentView::CreateCloseButton() { |
278 DCHECK(control_buttons_view_); | 298 DCHECK(control_buttons_view_); |
279 DCHECK(item_); | 299 DCHECK(item_); |
280 | 300 |
281 close_button_ = base::MakeUnique<ControlButton>(this); | 301 close_button_ = base::MakeUnique<ControlButton>(this); |
282 close_button_->SetImage(views::CustomButton::STATE_NORMAL, | 302 close_button_->SetImage(views::CustomButton::STATE_NORMAL, |
283 message_center::GetCloseIcon()); | 303 message_center::GetCloseIcon()); |
284 close_button_->SetAccessibleName(l10n_util::GetStringUTF16( | 304 close_button_->SetAccessibleName(l10n_util::GetStringUTF16( |
285 IDS_MESSAGE_CENTER_CLOSE_NOTIFICATION_BUTTON_ACCESSIBLE_NAME)); | 305 IDS_MESSAGE_CENTER_CLOSE_NOTIFICATION_BUTTON_ACCESSIBLE_NAME)); |
286 close_button_->SetTooltipText(l10n_util::GetStringUTF16( | 306 close_button_->SetTooltipText(l10n_util::GetStringUTF16( |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0)); | 338 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0)); |
319 | 339 |
320 if (item_->IsOpeningSettingsSupported()) | 340 if (item_->IsOpeningSettingsSupported()) |
321 CreateSettingsButton(); | 341 CreateSettingsButton(); |
322 if (!item_->GetPinned()) | 342 if (!item_->GetPinned()) |
323 CreateCloseButton(); | 343 CreateCloseButton(); |
324 | 344 |
325 views::Widget::InitParams params(views::Widget::InitParams::TYPE_CONTROL); | 345 views::Widget::InitParams params(views::Widget::InitParams::TYPE_CONTROL); |
326 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; | 346 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; |
327 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 347 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
328 params.parent = surface_->window(); | 348 params.parent = surface_->GetWindow(); |
329 | 349 |
330 floating_control_buttons_widget_.reset(new views::Widget); | 350 floating_control_buttons_widget_.reset(new views::Widget); |
331 floating_control_buttons_widget_->Init(params); | 351 floating_control_buttons_widget_->Init(params); |
332 floating_control_buttons_widget_->SetContentsView(control_buttons_view_); | 352 floating_control_buttons_widget_->SetContentsView(control_buttons_view_); |
333 | 353 |
334 // Put the close button into the focus chain. | 354 // Put the close button into the focus chain. |
335 floating_control_buttons_widget_->SetFocusTraversableParent( | 355 floating_control_buttons_widget_->SetFocusTraversableParent( |
336 GetWidget()->GetFocusTraversable()); | 356 GetWidget()->GetFocusTraversable()); |
337 floating_control_buttons_widget_->SetFocusTraversableParentView(this); | 357 floating_control_buttons_widget_->SetFocusTraversableParentView(this); |
338 | 358 |
339 Layout(); | 359 Layout(); |
340 } | 360 } |
341 | 361 |
342 void ArcNotificationContentView::SetSurface(exo::NotificationSurface* surface) { | 362 void ArcNotificationContentView::SetSurface(ArcNotificationSurface* surface) { |
343 if (surface_ == surface) | 363 if (surface_ == surface) |
344 return; | 364 return; |
345 | 365 |
346 // Reset |floating_control_buttons_widget_| when |surface_| is changed. | 366 // Reset |floating_control_buttons_widget_| when |surface_| is changed. |
347 floating_control_buttons_widget_.reset(); | 367 floating_control_buttons_widget_.reset(); |
348 control_buttons_view_ = nullptr; | 368 control_buttons_view_ = nullptr; |
349 settings_button_ = nullptr; | 369 settings_button_ = nullptr; |
350 close_button_.reset(); | 370 close_button_.reset(); |
351 | 371 |
352 if (surface_ && surface_->window()) { | 372 if (surface_ && surface_->GetWindow()) { |
353 surface_->window()->RemoveObserver(this); | 373 surface_->GetWindow()->RemoveObserver(this); |
354 surface_->window()->RemovePreTargetHandler(event_forwarder_.get()); | 374 surface_->GetWindow()->RemovePreTargetHandler(event_forwarder_.get()); |
355 } | 375 } |
356 | 376 |
357 surface_ = surface; | 377 surface_ = surface; |
358 | 378 |
359 if (surface_ && surface_->window()) { | 379 if (surface_ && surface_->GetWindow()) { |
360 surface_->window()->AddObserver(this); | 380 surface_->GetWindow()->AddObserver(this); |
361 surface_->window()->AddPreTargetHandler(event_forwarder_.get()); | 381 surface_->GetWindow()->AddPreTargetHandler(event_forwarder_.get()); |
362 | 382 |
363 MaybeCreateFloatingControlButtons(); | 383 MaybeCreateFloatingControlButtons(); |
364 | 384 |
365 if (GetWidget()) | 385 if (GetWidget()) |
366 AttachSurface(); | 386 AttachSurface(); |
367 } | 387 } |
368 } | 388 } |
369 | 389 |
370 void ArcNotificationContentView::UpdatePreferredSize() { | 390 void ArcNotificationContentView::UpdatePreferredSize() { |
371 gfx::Size preferred_size; | 391 gfx::Size preferred_size; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 | 457 |
438 UpdatePreferredSize(); | 458 UpdatePreferredSize(); |
439 SchedulePaint(); | 459 SchedulePaint(); |
440 } | 460 } |
441 | 461 |
442 void ArcNotificationContentView::AttachSurface() { | 462 void ArcNotificationContentView::AttachSurface() { |
443 if (!GetWidget()) | 463 if (!GetWidget()) |
444 return; | 464 return; |
445 | 465 |
446 UpdatePreferredSize(); | 466 UpdatePreferredSize(); |
447 Attach(surface_->window()); | 467 surface_->AttachWindow(this); |
448 | 468 |
449 // The texture for this window can be placed at subpixel position | 469 // The texture for this window can be placed at subpixel position |
450 // with fractional scale factor. Force to align it at the pixel | 470 // with fractional scale factor. Force to align it at the pixel |
451 // boundary here, and when layout is updated in Layout(). | 471 // boundary here, and when layout is updated in Layout(). |
452 ash::wm::SnapWindowToPixelBoundary(surface_->window()); | 472 ash::wm::SnapWindowToPixelBoundary(surface_->GetWindow()); |
453 | 473 |
454 // Creates slide helper after this view is added to its parent. | 474 // Creates slide helper after this view is added to its parent. |
455 slide_helper_.reset(new SlideHelper(this)); | 475 slide_helper_.reset(new SlideHelper(this)); |
456 | 476 |
457 // Invokes Update() in case surface is attached during a slide. | 477 // Invokes Update() in case surface is attached during a slide. |
458 slide_helper_->Update(); | 478 slide_helper_->Update(); |
459 | 479 |
460 // Updates pinned state to create or destroy the floating close button | 480 // Updates pinned state to create or destroy the floating close button |
461 // after |surface_| is attached to a widget. | 481 // after |surface_| is attached to a widget. |
462 if (item_) | 482 if (item_) |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 const gfx::Size surface_size = surface_->GetSize(); | 555 const gfx::Size surface_size = surface_->GetSize(); |
536 const gfx::Size contents_size = contents_bounds.size(); | 556 const gfx::Size contents_size = contents_bounds.size(); |
537 if (!surface_size.IsEmpty() && !contents_size.IsEmpty()) { | 557 if (!surface_size.IsEmpty() && !contents_size.IsEmpty()) { |
538 transform.Scale( | 558 transform.Scale( |
539 static_cast<float>(contents_size.width()) / surface_size.width(), | 559 static_cast<float>(contents_size.width()) / surface_size.width(), |
540 static_cast<float>(contents_size.height()) / surface_size.height()); | 560 static_cast<float>(contents_size.height()) / surface_size.height()); |
541 } | 561 } |
542 | 562 |
543 // Apply the transform to the surface content so that close button can | 563 // Apply the transform to the surface content so that close button can |
544 // be positioned without the need to consider the transform. | 564 // be positioned without the need to consider the transform. |
545 surface_->window()->children()[0]->SetTransform(transform); | 565 surface_->GetWindow()->children()[0]->SetTransform(transform); |
546 | 566 |
547 if (!floating_control_buttons_widget_) | 567 if (!floating_control_buttons_widget_) |
548 return; | 568 return; |
549 | 569 |
550 gfx::Rect control_buttons_bounds(contents_bounds); | 570 gfx::Rect control_buttons_bounds(contents_bounds); |
551 int buttons_width = 0; | 571 int buttons_width = 0; |
552 int buttons_height = 0; | 572 int buttons_height = 0; |
553 if (close_button_) { | 573 if (close_button_) { |
554 buttons_width += close_button_->GetPreferredSize().width(); | 574 buttons_width += close_button_->GetPreferredSize().width(); |
555 buttons_height = close_button_->GetPreferredSize().height(); | 575 buttons_height = close_button_->GetPreferredSize().height(); |
556 } | 576 } |
557 if (settings_button_) { | 577 if (settings_button_) { |
558 buttons_width += settings_button_->GetPreferredSize().width(); | 578 buttons_width += settings_button_->GetPreferredSize().width(); |
559 buttons_height = settings_button_->GetPreferredSize().height(); | 579 buttons_height = settings_button_->GetPreferredSize().height(); |
560 } | 580 } |
561 control_buttons_bounds.set_x(control_buttons_bounds.right() - buttons_width - | 581 control_buttons_bounds.set_x(control_buttons_bounds.right() - buttons_width - |
562 message_center::kControlButtonPadding); | 582 message_center::kControlButtonPadding); |
563 control_buttons_bounds.set_y(control_buttons_bounds.y() + | 583 control_buttons_bounds.set_y(control_buttons_bounds.y() + |
564 message_center::kControlButtonPadding); | 584 message_center::kControlButtonPadding); |
565 control_buttons_bounds.set_width(buttons_width); | 585 control_buttons_bounds.set_width(buttons_width); |
566 control_buttons_bounds.set_height(buttons_height); | 586 control_buttons_bounds.set_height(buttons_height); |
567 floating_control_buttons_widget_->SetBounds(control_buttons_bounds); | 587 floating_control_buttons_widget_->SetBounds(control_buttons_bounds); |
568 | 588 |
569 UpdateControlButtonsVisibility(); | 589 UpdateControlButtonsVisibility(); |
570 | 590 |
571 ash::wm::SnapWindowToPixelBoundary(surface_->window()); | 591 ash::wm::SnapWindowToPixelBoundary(surface_->GetWindow()); |
572 } | 592 } |
573 | 593 |
574 void ArcNotificationContentView::OnPaint(gfx::Canvas* canvas) { | 594 void ArcNotificationContentView::OnPaint(gfx::Canvas* canvas) { |
575 views::NativeViewHost::OnPaint(canvas); | 595 views::NativeViewHost::OnPaint(canvas); |
576 | 596 |
577 // Bail if there is a |surface_| or no item or no snapshot image. | 597 // Bail if there is a |surface_| or no item or no snapshot image. |
578 if (surface_ || !item_ || item_->GetSnapshot().isNull()) | 598 if (surface_ || !item_ || item_->GetSnapshot().isNull()) |
579 return; | 599 return; |
580 const gfx::Rect contents_bounds = GetContentsBounds(); | 600 const gfx::Rect contents_bounds = GetContentsBounds(); |
581 canvas->DrawImageInt(item_->GetSnapshot(), 0, 0, item_->GetSnapshot().width(), | 601 canvas->DrawImageInt(item_->GetSnapshot(), 0, 0, item_->GetSnapshot().width(), |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
678 | 698 |
679 void ArcNotificationContentView::OnItemUpdated() { | 699 void ArcNotificationContentView::OnItemUpdated() { |
680 UpdateAccessibleName(); | 700 UpdateAccessibleName(); |
681 UpdatePinnedState(); | 701 UpdatePinnedState(); |
682 UpdateSnapshot(); | 702 UpdateSnapshot(); |
683 if (ShouldUpdateControlButtonsColor()) | 703 if (ShouldUpdateControlButtonsColor()) |
684 StartControlButtonsColorAnimation(); | 704 StartControlButtonsColorAnimation(); |
685 } | 705 } |
686 | 706 |
687 void ArcNotificationContentView::OnNotificationSurfaceAdded( | 707 void ArcNotificationContentView::OnNotificationSurfaceAdded( |
688 exo::NotificationSurface* surface) { | 708 ArcNotificationSurface* surface) { |
689 if (surface->notification_id() != notification_key_) | 709 if (surface->GetNotificationId() != notification_key_) |
690 return; | 710 return; |
691 | 711 |
692 SetSurface(surface); | 712 SetSurface(surface); |
693 } | 713 } |
694 | 714 |
695 void ArcNotificationContentView::OnNotificationSurfaceRemoved( | 715 void ArcNotificationContentView::OnNotificationSurfaceRemoved( |
696 exo::NotificationSurface* surface) { | 716 ArcNotificationSurface* surface) { |
697 if (surface->notification_id() != notification_key_) | 717 if (surface->GetNotificationId() != notification_key_) |
698 return; | 718 return; |
699 | 719 |
700 SetSurface(nullptr); | 720 SetSurface(nullptr); |
701 } | 721 } |
702 | 722 |
703 void ArcNotificationContentView::AnimationEnded( | 723 void ArcNotificationContentView::AnimationEnded( |
704 const gfx::Animation* animation) { | 724 const gfx::Animation* animation) { |
705 DCHECK_EQ(animation, control_button_color_animation_.get()); | 725 DCHECK_EQ(animation, control_button_color_animation_.get()); |
706 control_button_color_animation_.reset(); | 726 control_button_color_animation_.reset(); |
707 } | 727 } |
(...skipping 18 matching lines...) Expand all Loading... |
726 } | 746 } |
727 if (close_button_) { | 747 if (close_button_) { |
728 close_button_->set_background( | 748 close_button_->set_background( |
729 views::Background::CreateSolidBackground(current_color)); | 749 views::Background::CreateSolidBackground(current_color)); |
730 close_button_->SchedulePaint(); | 750 close_button_->SchedulePaint(); |
731 } | 751 } |
732 } | 752 } |
733 } | 753 } |
734 | 754 |
735 } // namespace arc | 755 } // namespace arc |
OLD | NEW |