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

Unified Diff: ash/system/tray/tray_bubble_wrapper.cc

Issue 11028134: Re-factor Ash Message Center code part 2/4 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years, 2 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
« no previous file with comments | « ash/system/tray/tray_bubble_wrapper.h ('k') | ash/system/tray/tray_event_filter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/system/tray/tray_bubble_wrapper.cc
diff --git a/ash/system/tray/tray_bubble_wrapper.cc b/ash/system/tray/tray_bubble_wrapper.cc
new file mode 100644
index 0000000000000000000000000000000000000000..950a0d2510fcadb691d6326385fd9aab8adb9ac2
--- /dev/null
+++ b/ash/system/tray/tray_bubble_wrapper.cc
@@ -0,0 +1,43 @@
+// Copyright (c) 2012 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 "ash/system/tray/tray_bubble_wrapper.h"
+
+#include "ash/system/tray/tray_background_view.h"
+#include "ash/system/tray/tray_bubble_view.h"
+#include "ash/system/tray/tray_event_filter.h"
+#include "ui/views/widget/widget.h"
+
+namespace ash {
+namespace internal {
+
+TrayBubbleWrapper::TrayBubbleWrapper(TrayBackgroundView* tray,
+ TrayBubbleView* bubble_view)
+ : tray_(tray),
+ bubble_view_(bubble_view) {
+ bubble_widget_ = views::BubbleDelegateView::CreateBubble(bubble_view_);
+ bubble_widget_->AddObserver(this);
+
+ bubble_view_->InitializeAndShowBubble();
+ tray_->InitializeBubbleAnimations(bubble_widget_);
+
+ tray_event_filter_.reset(new TrayEventFilter(this));
+}
+
+TrayBubbleWrapper::~TrayBubbleWrapper() {
+ tray_event_filter_.reset();
+ if (bubble_widget_) {
+ bubble_widget_->RemoveObserver(this);
+ bubble_widget_->Close();
+ }
+}
+
+void TrayBubbleWrapper::OnWidgetClosing(views::Widget* widget) {
+ CHECK_EQ(bubble_widget_, widget);
+ bubble_widget_ = NULL;
+ tray_->HideBubbleWithView(bubble_view_); // May destroy |bubble_view_|
+}
+
+} // namespace internal
+} // namespace ash
« no previous file with comments | « ash/system/tray/tray_bubble_wrapper.h ('k') | ash/system/tray/tray_event_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698