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

Unified Diff: components/bubble/bubble_manager.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: Update 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
Index: components/bubble/bubble_manager.h
diff --git a/components/bubble/bubble_manager.h b/components/bubble/bubble_manager.h
new file mode 100644
index 0000000000000000000000000000000000000000..49e13898dfa65f0a04c9c6233ebcebd782504b77
--- /dev/null
+++ b/components/bubble/bubble_manager.h
@@ -0,0 +1,43 @@
+// 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_MANAGER_H__
+#define COMPONENTS_BUBBLE_BUBBLE_MANAGER_H__
+
+#include "base/memory/scoped_vector.h"
+#include "base/memory/weak_ptr.h"
+#include "components/bubble/bubble_controller.h"
+
+class BubbleDelegate;
+typedef base::WeakPtr<BubbleDelegate> BubbleReference;
+
+/**
+ * BubbleManager should exist per profile.
+ * Showing bubbles should go through the BubbleManager.
+ *
+ * This class assumes that we won't be showing a lot of bubbles simultaneously.
+ * If this assumption ever stops being true, please file a bug against whatever
+ * is bombarding the user with many bubbles at the same time.
+ */
+class BubbleManager {
+ public:
+ virtual ~BubbleManager();
+
+ BubbleReference ShowBubble(scoped_ptr<BubbleDelegate> bubble);
+ void HideBubble(BubbleReference bubble);
+ bool IsBubbleVisible(BubbleReference bubble);
+
+ protected:
+ // This class should be subclassed to hook into all the appropriate events.
+ BubbleManager();
+
+ // For mass updating of bubbles:
+ void ShowMatchingBubbles(void* context);
+ void HideMatchingBubbles(void* context, BubbleCloseReason reason);
+ void UpdateMatchingBubbles(void* context);
+
+ ScopedVector<BubbleController> controllers_;
+};
hcarmona 2015/08/06 17:43:44 Make sure all files have disallow copy + assign
+
+#endif // COMPONENTS_BUBBLE_BUBBLE_MANAGER_H__

Powered by Google App Engine
This is Rietveld 408576698