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

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: 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_controller.h
diff --git a/components/bubble/bubble_controller.h b/components/bubble/bubble_controller.h
new file mode 100644
index 0000000000000000000000000000000000000000..0e4f18ac681c29ee39c6744d155930d28412d044
--- /dev/null
+++ b/components/bubble/bubble_controller.h
@@ -0,0 +1,62 @@
+// 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/callback.h"
please use gerrit instead 2015/08/07 23:02:27 base/callback_forward.h or something.
hcarmona 2015/08/11 02:35:46 Done.
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
+#include "components/bubble/bubble_ui.h"
+#include "ui/gfx/native_widget_types.h"
+
+class BubbleDelegate;
+class BubbleManager;
+
+enum BubbleCloseReason {
+ // Bubble was closed without any user interaction.
+ BUBBLE_CLOSE_IGNORE = 0,
please use gerrit instead 2015/08/07 23:02:27 = 0 not needed
hcarmona 2015/08/11 02:35:46 Done.
+
+ // User did not interact with the bubble, but changed tab.
+ BUBBLE_CLOSE_TABSWITCH,
+
+ // User dismissed the bubble. (ESC, close, etc)
+ BUBBLE_CLOSE_CLOSE,
+
+ // User selected the "Allow" option in a bubble.
+ BUBBLE_CLOSE_ALLOW,
+
+ // User selected the "Deny" option in a bubble.
+ BUBBLE_CLOSE_DENY,
+};
+
+/*
+ * Only the BubbleManager should know of and use the BubbleController.
+ */
please use gerrit instead 2015/08/07 23:02:27 // also, what does it do? \o/
hcarmona 2015/08/11 02:35:46 Done.
+class BubbleController : public base::SupportsWeakPtr<BubbleController> {
+ public:
+ BubbleController(BubbleManager* manager, scoped_ptr<BubbleDelegate> delegate);
+ virtual ~BubbleController();
please use gerrit instead 2015/08/07 23:02:27 override
hcarmona 2015/08/11 02:35:46 Acknowledged.
+
+ void Show();
+ void Hide(BubbleCloseReason reason);
+ void UpdateAnchorPosition();
+
+ bool ShouldClose();
+ void Close();
+
+ bool IsOwnerOf(BubbleDelegate* delegate);
+ bool MatchesContext(void* context);
hcarmona 2015/08/07 23:02:38 Update design doc: what is "context"
+
+ private:
+ // Weak.
+ BubbleManager* manager_;
please use gerrit instead 2015/08/07 23:02:27 may not be necessary
hcarmona 2015/08/11 02:35:46 Done.
+
+ scoped_ptr<BubbleDelegate> delegate_;
+ scoped_ptr<BubbleUI> bubble_ui_;
+
+ DISALLOW_COPY_AND_ASSIGN(BubbleController);
+};
+
+#endif // COMPONENTS_BUBBLE_BUBBLE_CONTROLLER_H__

Powered by Google App Engine
This is Rietveld 408576698