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

Side by Side Diff: chrome/browser/ui/views/location_bar/page_action_with_badge_view.cc

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: Pure 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
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "chrome/browser/ui/views/location_bar/page_action_with_badge_view.h" 5 #include "chrome/browser/ui/views/location_bar/page_action_with_badge_view.h"
6 6
7 #include "chrome/browser/ui/views/location_bar/page_action_image_view.h" 7 #include "chrome/browser/ui/views/location_bar/page_action_image_view.h"
8 #include "chrome/common/extensions/extension.h" 8 #include "chrome/common/extensions/extension.h"
9 #include "ui/base/accessibility/accessible_view_state.h" 9 #include "ui/base/accessibility/accessible_view_state.h"
10 10
11 using content::WebContents; 11 using content::WebContents;
12 12
13 PageActionWithBadgeView::PageActionWithBadgeView( 13 PageActionWithBadgeView::PageActionWithBadgeView(
14 PageActionImageView* image_view) { 14 PageActionImageView* image_view) {
15 image_view_ = image_view; 15 image_view_ = image_view;
16 AddChildView(image_view_); 16 AddChildView(image_view_);
17 TouchableLocationBarView::Init(this);
17 } 18 }
18 19
19 void PageActionWithBadgeView::GetAccessibleState( 20 void PageActionWithBadgeView::GetAccessibleState(
20 ui::AccessibleViewState* state) { 21 ui::AccessibleViewState* state) {
21 state->role = ui::AccessibilityTypes::ROLE_GROUPING; 22 state->role = ui::AccessibilityTypes::ROLE_GROUPING;
22 } 23 }
23 24
24 gfx::Size PageActionWithBadgeView::GetPreferredSize() { 25 gfx::Size PageActionWithBadgeView::GetPreferredSize() {
25 return gfx::Size(extensions::Extension::kPageActionIconMaxSize, 26 return gfx::Size(extensions::Extension::kPageActionIconMaxSize,
26 extensions::Extension::kPageActionIconMaxSize); 27 extensions::Extension::kPageActionIconMaxSize);
27 } 28 }
28 29
30 int PageActionWithBadgeView::GetBuiltInHorizontalPadding() const {
31 return GetBuiltInHorizontalPaddingImpl();
32 }
33
29 void PageActionWithBadgeView::Layout() { 34 void PageActionWithBadgeView::Layout() {
30 // We have 25 pixels of vertical space in the Omnibox to play with, so even 35 // We have 25 pixels of vertical space in the Omnibox to play with, so even
31 // sized icons (such as 16x16) have either a 5 or a 4 pixel whitespace 36 // sized icons (such as 16x16) have either a 5 or a 4 pixel whitespace
32 // (padding) above and below. It looks better to have the extra pixel above 37 // (padding) above and below. It looks better to have the extra pixel above
33 // the icon than below it, so we add a pixel. http://crbug.com/25708. 38 // the icon than below it, so we add a pixel. http://crbug.com/25708.
34 const SkBitmap& image = image_view()->GetImage(); 39 const SkBitmap& image = image_view()->GetImage();
35 int y = (image.height() + 1) % 2; // Even numbers: 1px padding. Odd: 0px. 40 int y = (image.height() + 1) % 2; // Even numbers: 1px padding. Odd: 0px.
36 image_view_->SetBounds(0, y, width(), height()); 41 image_view_->SetBounds(0, y, width(), height());
37 } 42 }
38 43
39 void PageActionWithBadgeView::UpdateVisibility(WebContents* contents, 44 void PageActionWithBadgeView::UpdateVisibility(WebContents* contents,
40 const GURL& url) { 45 const GURL& url) {
41 image_view_->UpdateVisibility(contents, url); 46 image_view_->UpdateVisibility(contents, url);
42 SetVisible(image_view_->visible()); 47 SetVisible(image_view_->visible());
43 } 48 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/location_bar/page_action_with_badge_view.h ('k') | chrome/browser/ui/views/location_bar/star_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698