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

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

Issue 10834279: Give request-to-act badges a grey background, and increase spacing to make it fit. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add Views UI; clean up GTK Created 8 years, 4 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 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" 5 #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 return browser::FindBrowserWithWebContents(contents); 105 return browser::FindBrowserWithWebContents(contents);
106 } 106 }
107 107
108 // Height of the location bar's round corner region. 108 // Height of the location bar's round corner region.
109 const int kBorderRoundCornerHeight = 5; 109 const int kBorderRoundCornerHeight = 5;
110 // Width of location bar's round corner region. 110 // Width of location bar's round corner region.
111 const int kBorderRoundCornerWidth = 4; 111 const int kBorderRoundCornerWidth = 4;
112 // Radius of the round corners inside the location bar. 112 // Radius of the round corners inside the location bar.
113 const int kBorderCornerRadius = 2; 113 const int kBorderCornerRadius = 2;
114 114
115 const int kDesktopItemPadding = 3; 115 const int kDesktopItemPadding = 9;
Peter Kasting 2012/08/24 23:08:28 Is increasing this for all items really the right
Jeffrey Yasskin 2012/08/29 00:37:50 Aaron asked for the extra spacing on the star in h
116 const int kDesktopEdgeItemPadding = kDesktopItemPadding; 116 const int kDesktopEdgeItemPadding = kDesktopItemPadding;
117 117
118 const int kTouchItemPadding = 8; 118 const int kTouchItemPadding = 8;
119 const int kTouchEdgeItemPadding = kTouchItemPadding; 119 const int kTouchEdgeItemPadding = kTouchItemPadding;
120 120
121 // Extra padding for the height of the omnibox in search mode. 121 // Extra padding for the height of the omnibox in search mode.
122 const int kSearchEditHeightPadding = 2; 122 const int kSearchEditHeightPadding = 2;
123 123
124 } // namespace 124 } // namespace
125 125
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after
908 paint.setStyle(SkPaint::kFill_Style); 908 paint.setStyle(SkPaint::kFill_Style);
909 paint.setAntiAlias(true); 909 paint.setAntiAlias(true);
910 // TODO(jamescook): Make the corners of the dropdown match the corners of 910 // TODO(jamescook): Make the corners of the dropdown match the corners of
911 // the omnibox. 911 // the omnibox.
912 const SkScalar radius(SkIntToScalar(kBorderCornerRadius)); 912 const SkScalar radius(SkIntToScalar(kBorderCornerRadius));
913 bounds.Inset(kNormalHorizontalEdgeThickness, 0); 913 bounds.Inset(kNormalHorizontalEdgeThickness, 0);
914 canvas->sk_canvas()->drawRoundRect(gfx::RectToSkRect(bounds), radius, 914 canvas->sk_canvas()->drawRoundRect(gfx::RectToSkRect(bounds), radius,
915 radius, paint); 915 radius, paint);
916 if (action_box_button_view_) 916 if (action_box_button_view_)
917 PaintActionBoxBackground(canvas, bounds); 917 PaintActionBoxBackground(canvas, bounds);
918 PaintPageActionBackgrounds(canvas);
918 } else { 919 } else {
919 canvas->FillRect(bounds, color); 920 canvas->FillRect(bounds, color);
920 } 921 }
921 922
922 if (show_focus_rect_ && HasFocus()) { 923 if (show_focus_rect_ && HasFocus()) {
923 gfx::Rect r = location_entry_view_->bounds(); 924 gfx::Rect r = location_entry_view_->bounds();
924 // TODO(jamescook): Is this still needed? 925 // TODO(jamescook): Is this still needed?
925 #if defined(OS_WIN) 926 #if defined(OS_WIN)
926 r.Inset(-1, -1); 927 r.Inset(-1, -1);
927 #else 928 #else
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
1214 bounds.set_width(kBorderCornerRadius); 1215 bounds.set_width(kBorderCornerRadius);
1215 canvas->DrawRect(bounds, paint); 1216 canvas->DrawRect(bounds, paint);
1216 1217
1217 // Draw left border. 1218 // Draw left border.
1218 gfx::Point line_end(bounds.origin()); 1219 gfx::Point line_end(bounds.origin());
1219 line_end.Offset(0, bounds.height()); 1220 line_end.Offset(0, bounds.height());
1220 canvas->DrawLine(bounds.origin(), line_end, 1221 canvas->DrawLine(bounds.origin(), line_end,
1221 action_box_button_view_->GetBorderColor()); 1222 action_box_button_view_->GetBorderColor());
1222 } 1223 }
1223 1224
1225 void LocationBarView::PaintPageActionBackgrounds(gfx::Canvas* canvas) {
1226 for (size_t i = 0; i < page_action_views_.size(); ++i) {
Peter Kasting 2012/08/24 23:08:28 Nit: Since all you do with i is to get page_action
Jeffrey Yasskin 2012/08/29 00:37:50 Done.
1227 gfx::Rect bounds = page_action_views_[i]->bounds();
1228 int horizontal_padding = GetItemPadding() -
1229 page_action_views_[i]->GetBuiltInHorizontalPadding();
1230 // These offsets place the top and bottom edges on top of the darkest line
1231 // in the location bar border, and the side edges on the pixels exactly
1232 // between two page actions. If the border image changes, these offsets
1233 // will have to change to match.
1234 bounds.Inset(-horizontal_padding / 2, -1,
Peter Kasting 2012/08/24 23:08:28 Nit: Don't use -1s here. Split the kVerticalEdgeT
Jeffrey Yasskin 2012/08/29 00:37:50 In Views, the visible edge thickness is 1 on the t
1235 -horizontal_padding / 2, -1);
1236 ExtensionAction* action =
1237 page_action_views_[i]->image_view()->page_action();
1238 action->PaintBackground(canvas, bounds,
1239 SessionID::IdForTab(GetTabContents()));
1240 }
1241 }
1242
1224 std::string LocationBarView::GetClassName() const { 1243 std::string LocationBarView::GetClassName() const {
1225 return kViewClassName; 1244 return kViewClassName;
1226 } 1245 }
1227 1246
1228 bool LocationBarView::SkipDefaultKeyEventProcessing(const ui::KeyEvent& event) { 1247 bool LocationBarView::SkipDefaultKeyEventProcessing(const ui::KeyEvent& event) {
1229 #if defined(OS_WIN) 1248 #if defined(OS_WIN)
1230 if (views::FocusManager::IsTabTraversalKeyEvent(event)) { 1249 if (views::FocusManager::IsTabTraversalKeyEvent(event)) {
1231 if (location_entry_->model()->popup_model()->IsOpen()) { 1250 if (location_entry_->model()->popup_model()->IsOpen()) {
1232 // Return true so that the edit sees the tab and moves the selection. 1251 // Return true so that the edit sees the tab and moves the selection.
1233 return true; 1252 return true;
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
1506 } 1525 }
1507 1526
1508 void LocationBarView::CleanupFadeAnimation() { 1527 void LocationBarView::CleanupFadeAnimation() {
1509 // Since we're no longer animating we don't need our layer. 1528 // Since we're no longer animating we don't need our layer.
1510 SetPaintToLayer(false); 1529 SetPaintToLayer(false);
1511 // Bubble labels don't need a transparent background anymore. 1530 // Bubble labels don't need a transparent background anymore.
1512 ev_bubble_view_->SetLabelBackgroundColor(SK_ColorWHITE); 1531 ev_bubble_view_->SetLabelBackgroundColor(SK_ColorWHITE);
1513 selected_keyword_view_->SetLabelBackgroundColor(SK_ColorWHITE); 1532 selected_keyword_view_->SetLabelBackgroundColor(SK_ColorWHITE);
1514 } 1533 }
1515 #endif // USE_AURA 1534 #endif // USE_AURA
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698