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

Unified Diff: chrome/browser/extensions/badge_controller.h

Issue 10381105: Refactor UI "badge" (page action) logic into a BadgeController interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: dont include badgecontroller.h Created 8 years, 7 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: chrome/browser/extensions/badge_controller.h
diff --git a/chrome/browser/extensions/badge_controller.h b/chrome/browser/extensions/badge_controller.h
new file mode 100644
index 0000000000000000000000000000000000000000..5bc87c425a538dd312fd0d6aae57430589eba64e
--- /dev/null
+++ b/chrome/browser/extensions/badge_controller.h
@@ -0,0 +1,54 @@
+// 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.
+
+#ifndef CHROME_BROWSER_EXTENSIONS_BADGE_CONTROLLER_H_
+#define CHROME_BROWSER_EXTENSIONS_BADGE_CONTROLLER_H_
+#pragma once
+
+#include <string>
+#include <vector>
+
+#include "base/memory/scoped_ptr.h"
+#include "chrome/browser/extensions/badge_decoration.h"
+
+class ExtensionAction;
+
+namespace extensions {
+
+// Controller of the "badges" (aka "page actions") in the UI.
Evan Stade 2012/05/11 21:52:08 confused about the terminology. I thought "badge"
Matt Perry 2012/05/11 22:01:17 Good point. This should be named ExtensionActionCo
not at google - send to devlin 2012/05/14 03:59:01 Cool. "Badge" was an attempt to make an agnostic n
Matt Perry 2012/05/14 18:48:57 I'm not a fan of PageBox. The generic name for Pag
not at google - send to devlin 2012/05/15 01:23:56 As discussed on IRC, made it ActionBoxController.
+class BadgeController {
+ public:
+ // Data about a UI badge.
+ struct Data {
+ // The type of decoration that should be applied to the badge.
+ badge_decoration::Decoration decoration;
+
+ // The ExtensionAction that corresponds to the badge.
+ ExtensionAction* action;
+ };
+
+ typedef std::vector<Data> DataList;
+
+ // The reaction that the UI should take after executing |OnClicked|.
+ enum Reaction {
Matt Perry 2012/05/11 21:15:12 Just "Action" ?
not at google - send to devlin 2012/05/14 03:59:01 Done.
+ NONE,
+ SHOW_POPUP,
+ SHOW_CONTEXT_MENU,
+ };
+
+ virtual ~BadgeController() {}
+
+ // Gets the badge data for all extensions.
+ virtual scoped_ptr<DataList> GetAllBadgeData() = 0;
+
+ // Notifies this that the badge for an extension has been clicked with some
+ // mouse button (1 for left, 2 for middle, and 3 for right click), and
+ // returns the action that should be taken in response (if any).
+ virtual Reaction OnClicked(const std::string& extension_id,
+ int button_type) = 0;
+};
+
+} // namespace extensions
+
+#endif // CHROME_BROWSER_EXTENSIONS_BADGE_CONTROLLER_H_
« no previous file with comments | « no previous file | chrome/browser/extensions/badge_decoration.h » ('j') | chrome/browser/extensions/page_action_controller.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698