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

Unified Diff: components/exo/notification_surface_impl.cc

Issue 2723143002: Add unittests of ArcCustomNotificationView (Closed)
Patch Set: Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: components/exo/notification_surface_impl.cc
diff --git a/components/exo/notification_surface.cc b/components/exo/notification_surface_impl.cc
similarity index 82%
rename from components/exo/notification_surface.cc
rename to components/exo/notification_surface_impl.cc
index 2b66eddec42a682b6ff7382bd21e5ac9208e0ef2..2edfbf51aa0acfcf576ae68e03d8933700e37345 100644
--- a/components/exo/notification_surface.cc
+++ b/components/exo/notification_surface_impl.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "components/exo/notification_surface.h"
+#include "components/exo/notification_surface_impl.h"
#include "components/exo/notification_surface_manager.h"
#include "components/exo/surface.h"
@@ -11,6 +11,7 @@
#include "ui/base/cursor/cursor.h"
#include "ui/base/hit_test.h"
#include "ui/gfx/geometry/rect.h"
+#include "ui/views/controls/native/native_view_host.h"
#include "ui/views/widget/widget.h"
namespace exo {
@@ -67,9 +68,10 @@ class CustomWindowDelegate : public aura::WindowDelegate {
} // namespace
-NotificationSurface::NotificationSurface(NotificationSurfaceManager* manager,
- Surface* surface,
- const std::string& notification_id)
+NotificationSurfaceImpl::NotificationSurfaceImpl(
+ NotificationSurfaceManager* manager,
+ Surface* surface,
+ const std::string& notification_id)
: manager_(manager),
surface_(surface),
notification_id_(notification_id),
@@ -87,7 +89,7 @@ NotificationSurface::NotificationSurface(NotificationSurfaceManager* manager,
surface_->window()->Show();
}
-NotificationSurface::~NotificationSurface() {
+NotificationSurfaceImpl::~NotificationSurfaceImpl() {
if (surface_) {
surface_->SetSurfaceDelegate(nullptr);
surface_->RemoveSurfaceObserver(this);
@@ -96,11 +98,23 @@ NotificationSurface::~NotificationSurface() {
manager_->RemoveSurface(this);
}
-gfx::Size NotificationSurface::GetSize() const {
+gfx::Size NotificationSurfaceImpl::GetSize() const {
return surface_->content_size();
}
-void NotificationSurface::OnSurfaceCommit() {
+void NotificationSurfaceImpl::AttachWindow(views::NativeViewHost* nvh) {
hidehiko 2017/03/02 15:38:16 Could you avoid non-trivial abbreviation?
+ nvh->Attach(window());
+}
+
+aura::Window* NotificationSurfaceImpl::window() {
+ return window_.get();
+}
+
+const std::string& NotificationSurfaceImpl::notification_id() const {
+ return notification_id_;
+}
+
+void NotificationSurfaceImpl::OnSurfaceCommit() {
surface_->CheckIfSurfaceHierarchyNeedsCommitToNewSurfaces();
surface_->CommitSurfaceHierarchy();
@@ -117,11 +131,11 @@ void NotificationSurface::OnSurfaceCommit() {
}
}
-bool NotificationSurface::IsSurfaceSynchronized() const {
+bool NotificationSurfaceImpl::IsSurfaceSynchronized() const {
return false;
}
-void NotificationSurface::OnSurfaceDestroying(Surface* surface) {
+void NotificationSurfaceImpl::OnSurfaceDestroying(Surface* surface) {
window_.reset();
surface->RemoveSurfaceObserver(this);
surface_ = nullptr;

Powered by Google App Engine
This is Rietveld 408576698