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

Side by Side Diff: chrome/browser/views/location_bar_view.cc

Issue 329028: Page action pixel-god appeasement.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/views/location_bar_view.h" 5 #include "chrome/browser/views/location_bar_view.h"
6 6
7 #if defined(OS_LINUX) 7 #if defined(OS_LINUX)
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 #endif 9 #endif
10 10
(...skipping 25 matching lines...) Expand all
36 // static 36 // static
37 const int LocationBarView::kVertMargin = 2; 37 const int LocationBarView::kVertMargin = 2;
38 38
39 // Padding on the right and left of the entry field. 39 // Padding on the right and left of the entry field.
40 static const int kEntryPadding = 3; 40 static const int kEntryPadding = 3;
41 41
42 // Padding between the entry and the leading/trailing views. 42 // Padding between the entry and the leading/trailing views.
43 static const int kInnerPadding = 3; 43 static const int kInnerPadding = 3;
44 44
45 // The size (both dimensions) of the buttons for page actions. 45 // The size (both dimensions) of the buttons for page actions.
46 static const int kPageActionButtonSize = 29; 46 static const int kPageActionButtonSize = 19;
47 47
48 static const SkBitmap* kBackground = NULL; 48 static const SkBitmap* kBackground = NULL;
49 49
50 static const SkBitmap* kPopupBackground = NULL; 50 static const SkBitmap* kPopupBackground = NULL;
51 51
52 // The delay the mouse has to be hovering over the lock/warning icon before the 52 // The delay the mouse has to be hovering over the lock/warning icon before the
53 // info bubble is shown. 53 // info bubble is shown.
54 static const int kInfoBubbleHoverDelayMs = 500; 54 static const int kInfoBubbleHoverDelayMs = 500;
55 55
56 // The tab key image. 56 // The tab key image.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 PageActionImageView* image_view_; 95 PageActionImageView* image_view_;
96 }; 96 };
97 97
98 LocationBarView::PageActionWithBadgeView::PageActionWithBadgeView( 98 LocationBarView::PageActionWithBadgeView::PageActionWithBadgeView(
99 PageActionImageView* image_view) { 99 PageActionImageView* image_view) {
100 image_view_ = image_view; 100 image_view_ = image_view;
101 AddChildView(image_view_); 101 AddChildView(image_view_);
102 } 102 }
103 103
104 void LocationBarView::PageActionWithBadgeView::Layout() { 104 void LocationBarView::PageActionWithBadgeView::Layout() {
105 image_view_->SetBounds(0, 0, width(), height()); 105 // We have 25 pixels of vertical space in the Omnibox to play with, so even
106 // sized icons (such as 16x16) have either a 5 or a 4 pixel whitespace
107 // (padding) above and below. It looks better to have the extra pixel above
108 // the icon than below it, so we add a pixel. http://crbug.com/25708.
109 const SkBitmap& image = image_view()->GetImage();
110 int y = (image.height() + 1) % 2; // Even numbers: 1px padding. Odd: 0px.
111 image_view_->SetBounds(0, y, width(), height());
106 } 112 }
107 113
108 void LocationBarView::PageActionWithBadgeView::PaintChildren( 114 void LocationBarView::PageActionWithBadgeView::PaintChildren(
109 gfx::Canvas* canvas) { 115 gfx::Canvas* canvas) {
110 View::PaintChildren(canvas); 116 View::PaintChildren(canvas);
111 117
112 ExtensionAction* action = image_view_->page_action(); 118 ExtensionAction* action = image_view_->page_action();
113 int tab_id = image_view_->current_tab_id(); 119 int tab_id = image_view_->current_tab_id();
114 if (tab_id < 0) 120 if (tab_id < 0)
115 return; 121 return;
(...skipping 1284 matching lines...) Expand 10 before | Expand all | Expand 10 after
1400 } 1406 }
1401 1407
1402 int LocationBarView::PageActionVisibleCount() { 1408 int LocationBarView::PageActionVisibleCount() {
1403 int result = 0; 1409 int result = 0;
1404 for (size_t i = 0; i < page_action_views_.size(); i++) { 1410 for (size_t i = 0; i < page_action_views_.size(); i++) {
1405 if (page_action_views_[i]->IsVisible()) 1411 if (page_action_views_[i]->IsVisible())
1406 ++result; 1412 ++result;
1407 } 1413 }
1408 return result; 1414 return result;
1409 } 1415 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698