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

Unified Diff: components/bubble/bubble_controller.h

Issue 1251633002: Add BubbleManager to manage bubbles and ChromeBubbleManager for events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: gn nit Created 5 years, 4 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 | « components/bubble/bubble_close_reason.h ('k') | components/bubble/bubble_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/bubble/bubble_controller.h
diff --git a/components/bubble/bubble_controller.h b/components/bubble/bubble_controller.h
new file mode 100644
index 0000000000000000000000000000000000000000..bd87d2dc7f86d68bc2654f6cbdb6edce4e2feb26
--- /dev/null
+++ b/components/bubble/bubble_controller.h
@@ -0,0 +1,47 @@
+// Copyright 2015 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.
+
+#ifndef COMPONENTS_BUBBLE_BUBBLE_CONTROLLER_H_
+#define COMPONENTS_BUBBLE_BUBBLE_CONTROLLER_H_
+
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
+#include "components/bubble/bubble_close_reason.h"
+
+class BubbleDelegate;
+class BubbleManager;
+class BubbleUI;
+
+// BubbleController is responsible for the lifetime of the delegate and its UI.
+class BubbleController : public base::SupportsWeakPtr<BubbleController> {
+ public:
+ explicit BubbleController(BubbleManager* manager,
+ scoped_ptr<BubbleDelegate> delegate);
+ virtual ~BubbleController();
+
+ // Calls CloseBubble on the associated BubbleManager.
+ bool CloseBubble(BubbleCloseReason reason);
+
+ private:
+ friend class BubbleManager;
+
+ // Creates and shows the UI for the delegate.
+ void Show();
+
+ // Notifies the bubble UI that it should update its anchor location.
+ // Important when there's a UI change (ex: fullscreen transition).
+ void UpdateAnchorPosition();
+
+ // Cleans up the delegate and its UI if it closed.
+ // Returns true if the bubble was closed.
+ bool ShouldClose(BubbleCloseReason reason);
+
+ BubbleManager* manager_;
+ scoped_ptr<BubbleDelegate> delegate_;
+ scoped_ptr<BubbleUI> bubble_ui_;
+
+ DISALLOW_COPY_AND_ASSIGN(BubbleController);
+};
+
+#endif // COMPONENTS_BUBBLE_BUBBLE_CONTROLLER_H_
« no previous file with comments | « components/bubble/bubble_close_reason.h ('k') | components/bubble/bubble_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698