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

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

Issue 10792020: Implements the "Set to default" button on the zoom bubble. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Added private helper functions to make code more readable Created 8 years, 5 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
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/basictypes.h"
9 #include "chrome/browser/ui/toolbar/toolbar_model.h" 9 #include "chrome/browser/ui/toolbar/toolbar_model.h"
10 #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
10 #include "chrome/browser/ui/zoom/zoom_controller.h" 11 #include "chrome/browser/ui/zoom/zoom_controller.h"
11 #include "ui/views/controls/image_view.h" 12 #include "ui/views/controls/image_view.h"
12 13
13 namespace views { 14 namespace views {
14 class KeyEvent; 15 class KeyEvent;
15 class MouseEvent; 16 class MouseEvent;
16 } 17 }
17 18
18 // View for the zoom icon in the Omnibox. 19 // View for the zoom icon in the Omnibox.
19 class ZoomView : public views::ImageView { 20 class ZoomView : public views::ImageView {
20 public: 21 public:
21 explicit ZoomView(ToolbarModel* toolbar_model); 22 // Constructor for ZoomView. Clicking on the ZoomView shows a ZoomBubbleView,
23 // which requires the current TabContents. Thus, a LocationBarView::Delegate
Peter Kasting 2012/07/26 01:36:14 Nit: Maybe clearer: "...current TabContents, which
Kyle Horimoto 2012/08/03 03:33:29 Done.
24 // is passed here so that it can be queried for the current TabContents as
25 // needed.
26 explicit ZoomView(ToolbarModel* toolbar_model,
Peter Kasting 2012/07/26 01:36:14 Nit: explicit not needed for 2-arg constructor
Kyle Horimoto 2012/08/03 03:33:29 Done.
27 LocationBarView::Delegate* location_bar_delegate);
22 virtual ~ZoomView(); 28 virtual ~ZoomView();
23 29
24 void SetZoomIconState(ZoomController::ZoomIconState zoom_icon_state); 30 void SetZoomIconState(ZoomController::ZoomIconState zoom_icon_state);
25 void SetZoomIconTooltipPercent(int zoom_percent); 31 void SetZoomIconTooltipPercent(int zoom_percent);
26 32
27 // Updates the image and its tooltip appropriately, hiding or showing the icon 33 // Updates the image and its tooltip appropriately, hiding or showing the icon
28 // as needed. 34 // as needed.
29 void Update(); 35 void Update();
30 36
31 private: 37 private:
32 // views::ImageView: 38 // views::ImageView:
33 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; 39 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE;
34 virtual bool GetTooltipText(const gfx::Point& p, 40 virtual bool GetTooltipText(const gfx::Point& p,
35 string16* tooltip) const OVERRIDE; 41 string16* tooltip) const OVERRIDE;
36 virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE; 42 virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE;
37 virtual void OnMouseReleased(const views::MouseEvent& event) OVERRIDE; 43 virtual void OnMouseReleased(const views::MouseEvent& event) OVERRIDE;
38 virtual bool OnKeyPressed(const views::KeyEvent& event) OVERRIDE; 44 virtual bool OnKeyPressed(const views::KeyEvent& event) OVERRIDE;
39 45
40 // Toolbar model used to test whether location bar input is in progress. 46 // Toolbar model used to test whether location bar input is in progress.
41 ToolbarModel* toolbar_model_; 47 ToolbarModel* toolbar_model_;
42 48
49 // The Delegate for this view's corresponding LocationBarView.
Peter Kasting 2012/07/26 01:36:14 Nit: Maybe "The delegate we can use to get the cur
Kyle Horimoto 2012/08/03 03:33:29 Done.
50 LocationBarView::Delegate* location_bar_delegate_;
51
43 // The current icon state. 52 // The current icon state.
44 ZoomController::ZoomIconState zoom_icon_state_; 53 ZoomController::ZoomIconState zoom_icon_state_;
45 54
46 // The current zoom percentage. 55 // The current zoom percentage.
47 int zoom_percent_; 56 int zoom_percent_;
48 57
49 DISALLOW_COPY_AND_ASSIGN(ZoomView); 58 DISALLOW_COPY_AND_ASSIGN(ZoomView);
50 }; 59 };
51 60
52 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ZOOM_VIEW_H_ 61 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ZOOM_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698