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

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

Issue 10519008: Enlarge size of touch target for several location bar buttons without affecting visual layout. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to LKGR Created 8 years, 6 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_TOUCHABLE_LOCATION_BAR_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_TOUCHABLE_LOCATION_BAR_VIEW_H_
7 #pragma once
8
9 // To make your location bar View named FooBlat extend itself into the
10 // padding around it to get an enlarged touch target, inherit from
11 // TouchableLocationBarView<FooBlat> and call
12 // TouchableLocationBarViewBase::Init() from your constructor.
13
14 #include "ui/views/border.h"
15
16 class TouchableLocationBarViewBase {
Peter Kasting 2012/06/12 22:03:52 I don't understand what splitting this class in tw
Jói 2012/06/13 11:29:39 Rolled it into one class as requested. This simpl
17 public:
18 // Call this from the constructor (or during early initialization)
19 // of a class that inherits from TouchableLocationBarView<>.
20 void Init();
21
22 // Returns the number of pixels of built-in padding to the left and
23 // right of the image for this view.
24 int GetBuiltInHorizontalPadding() const;
25
26 protected:
27 int touch_horizontal_padding() const;
Peter Kasting 2012/06/12 22:03:52 Nit: Should be camel-cased since implementation is
Jói 2012/06/13 11:29:39 This method went away with the simplification.
28 virtual void SetBorder(int vertical_padding, int horizontal_padding) = 0;
29 };
30
31 // A mix-in for a class based on views::View and intended for the
32 // location bar. In a touch layout, the mix-in adds an empty border
33 // around the view to increase the size of the touch target. The
34 // border extends a few pixels up and down, which doesn't affect
35 // layout, and extends half of the padding used between items in the
36 // location bar to the left and right.
37 template<class Concrete>
38 class TouchableLocationBarView : public TouchableLocationBarViewBase {
39 private:
40 virtual void SetBorder(int vertical_padding, int horizontal_padding) OVERRIDE;
41 };
42
43 template<class Concrete>
44 void TouchableLocationBarView<Concrete>::SetBorder(int vertical_padding,
45 int horizontal_padding) {
46 static_cast<Concrete*>(this)->set_border(views::Border::CreateEmptyBorder(
47 vertical_padding, horizontal_padding,
48 vertical_padding, horizontal_padding));
49 }
50
51 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_TOUCHABLE_LOCATION_BAR_VIEW_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/location_bar/star_view.cc ('k') | chrome/browser/ui/views/location_bar/touchable_location_bar_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698