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

Side by Side Diff: chrome/browser/ui/views/location_bar/zoom_view.h

Issue 420533002: zoom bubble: Close if anchor is clicked while bubble is showing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 2 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ZOOM_VIEW_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ZOOM_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ZOOM_VIEW_H_ 6 #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ZOOM_VIEW_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/macros.h"
9 #include "base/compiler_specific.h" 9 #include "chrome/browser/ui/views/location_bar/bubble_icon_view.h"
10 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" 10 #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
11 #include "ui/views/controls/image_view.h"
12 11
13 class ZoomController; 12 class ZoomController;
14 13
15 // View for the zoom icon in the Omnibox. 14 // View for the zoom icon in the Omnibox.
16 class ZoomView : public views::ImageView { 15 class ZoomView : public BubbleIconView {
17 public: 16 public:
18 // Clicking on the ZoomView shows a ZoomBubbleView, which requires the current 17 // Clicking on the ZoomView shows a ZoomBubbleView, which requires the current
19 // WebContents. Because the current WebContents changes as the user switches 18 // WebContents. Because the current WebContents changes as the user switches
20 // tabs, it cannot be provided in the constructor. Instead, a 19 // tabs, a LocationBarView::Delegate is supplied to queried for the current
21 // LocationBarView::Delegate is passed here so that it can be queried for the 20 // WebContents when needed.
22 // current WebContents as needed.
23 explicit ZoomView(LocationBarView::Delegate* location_bar_delegate); 21 explicit ZoomView(LocationBarView::Delegate* location_bar_delegate);
24 virtual ~ZoomView(); 22 ~ZoomView() override;
25 23
26 // Updates the image and its tooltip appropriately, hiding or showing the icon 24 // Updates the image and its tooltip appropriately, hiding or showing the icon
27 // as needed. 25 // as needed.
28 void Update(ZoomController* zoom_controller); 26 void Update(ZoomController* zoom_controller);
29 27
28 protected:
29 // BubbleIconView:
30 bool IsBubbleShowing() const override;
31 void OnExecuting(BubbleIconView::ExecuteSource source) override;
32 void GetAccessibleState(ui::AXViewState* state) override;
33
30 private: 34 private:
31 // views::ImageView:
32 virtual void GetAccessibleState(ui::AXViewState* state) override;
33 virtual bool GetTooltipText(const gfx::Point& p,
34 base::string16* tooltip) const override;
35 virtual bool OnMousePressed(const ui::MouseEvent& event) override;
36 virtual void OnMouseReleased(const ui::MouseEvent& event) override;
37 virtual bool OnKeyPressed(const ui::KeyEvent& event) override;
38
39 // ui::EventHandler:
40 virtual void OnGestureEvent(ui::GestureEvent* event) override;
41
42 // Helper method to show and focus the zoom bubble associated with this
43 // widget.
44 void ActivateBubble();
45
46 // The delegate used to get the currently visible WebContents. 35 // The delegate used to get the currently visible WebContents.
47 LocationBarView::Delegate* location_bar_delegate_; 36 LocationBarView::Delegate* location_bar_delegate_;
48 37
49 DISALLOW_COPY_AND_ASSIGN(ZoomView); 38 DISALLOW_COPY_AND_ASSIGN(ZoomView);
50 }; 39 };
51 40
52 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ZOOM_VIEW_H_ 41 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ZOOM_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698