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

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: Partial Feedback 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..ea6bbc2dbadb04e07571a3ab1d26b6fa20cf84e0
--- /dev/null
+++ b/components/bubble/bubble_manager.h
@@ -0,0 +1,50 @@
+// 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"
please use gerrit instead 2015/08/07 23:02:28 might be able to get away with forward declaring b
hcarmona 2015/08/11 02:35:46 BubbleCloseReason prevents this.
+
+class BubbleDelegate;
+typedef base::WeakPtr<BubbleDelegate> BubbleReference;
please use gerrit instead 2015/08/07 23:02:28 ref to controller
hcarmona 2015/08/11 02:35:46 Done. How can we prevent anyone who has a referen
+
+/**
+ * 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.
+ */
please use gerrit instead 2015/08/07 23:02:28 //
hcarmona 2015/08/11 02:35:47 Done.
+class BubbleManager {
+ public:
+ virtual ~BubbleManager();
+
+ BubbleReference ShowBubble(scoped_ptr<BubbleDelegate> bubble);
+ void CloseBubble(BubbleReference bubble);
+
+ protected:
+ // This class should be subclassed to hook into all the appropriate events.
+ BubbleManager();
+
+ // For mass updating of bubbles:
+ // TODO(hcarmona): combine into a single function and use a callback.
+ void ShowMatchingBubbles(void* context);
+ void CloseMatchingBubbles(void* context, bool force,
+ BubbleCloseReason reason);
+ void UpdateMatchingBubbles(void* context);
+
+ // Override and call Show on the controller when it's convenient.
+ virtual void ScheduleShowBubble(
+ base::WeakPtr<BubbleController> controller) = 0;
+
+ ScopedVector<BubbleController> controllers_;
please use gerrit instead 2015/08/07 23:02:28 member vars and DISALLOW() should be private
hcarmona 2015/08/11 02:35:46 Done.
+
+ DISALLOW_COPY_AND_ASSIGN(BubbleManager);
+};
+
+#endif // COMPONENTS_BUBBLE_BUBBLE_MANAGER_H__

Powered by Google App Engine
This is Rietveld 408576698