summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views/location_bar/star_view.h
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/views/location_bar/star_view.h')
-rw-r--r--chrome/browser/views/location_bar/star_view.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/chrome/browser/views/location_bar/star_view.h b/chrome/browser/views/location_bar/star_view.h
new file mode 100644
index 0000000..f5aa62c
--- /dev/null
+++ b/chrome/browser/views/location_bar/star_view.h
@@ -0,0 +1,43 @@
+// Copyright (c) 2010 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_VIEWS_LOCATION_BAR_STAR_VIEW_H_
+#define CHROME_BROWSER_VIEWS_LOCATION_BAR_STAR_VIEW_H_
+
+#include "chrome/browser/views/info_bubble.h"
+#include "views/controls/image_view.h"
+
+class CommandUpdater;
+class InfoBubble;
+
+namespace views {
+class MouseEvent;
+}
+
+class StarView : public views::ImageView, public InfoBubbleDelegate {
+ public:
+ explicit StarView(CommandUpdater* command_updater);
+ virtual ~StarView();
+
+ // Toggles the star on or off.
+ void SetToggled(bool on);
+
+ private:
+ // views::ImageView overrides:
+ virtual bool GetAccessibleRole(AccessibilityTypes::Role* role);
+ virtual bool OnMousePressed(const views::MouseEvent& event);
+ virtual void OnMouseReleased(const views::MouseEvent& event, bool canceled);
+
+ // InfoBubbleDelegate overrides:
+ virtual void InfoBubbleClosing(InfoBubble* info_bubble,
+ bool closed_by_escape);
+ virtual bool CloseOnEscape();
+
+ // The CommandUpdater for the Browser object that owns the location bar.
+ CommandUpdater* command_updater_;
+
+ DISALLOW_IMPLICIT_CONSTRUCTORS(StarView);
+};
+
+#endif // CHROME_BROWSER_VIEWS_LOCATION_BAR_STAR_VIEW_H_