blob: 0df481270d7d84eadd42bfcd8e61ad9395b46563 [file] [log] [blame]
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/macros.h"
#include "ui/message_center/message_center_export.h"
#include "ui/message_center/views/message_view.h"
namespace views {
class Painter;
namespace message_center {
// View for notification with NOTIFICATION_TYPE_CUSTOM that hosts the custom
// content of the notification.
class MESSAGE_CENTER_EXPORT CustomNotificationView : public MessageView {
static const char kViewClassName[];
CustomNotificationView(MessageCenterController* controller,
const Notification& notification);
~CustomNotificationView() override;
// These method are called by the content view when focus handling is defered
// to the content.
void OnContentFocused();
void OnContentBlured();
// Overidden from MessageView:
void SetDrawBackgroundAsActive(bool active) override;
bool IsCloseButtonFocused() const override;
void RequestFocusOnCloseButton() override;
bool IsPinned() const override;
void UpdateControlButtonsVisibility() override;
// Overridden from views::View:
const char* GetClassName() const override;
gfx::Size GetPreferredSize() const override;
void Layout() override;
bool HasFocus() const override;
void RequestFocus() override;
void OnPaint(gfx::Canvas* canvas) override;
bool OnKeyPressed(const ui::KeyEvent& event) override;
void ChildPreferredSizeChanged(View* child) override;
bool OnMousePressed(const ui::MouseEvent& event) override;
friend class CustomNotificationViewTest;
// The view for the custom content. Owned by view hierarchy.
views::View* contents_view_ = nullptr;
std::unique_ptr<views::Painter> focus_painter_;
} // namespace message_center