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

Side by Side Diff: chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc

Issue 2070733002: Update omnibox dropdown selection/hover background drawing for MD. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scaled_radius
Patch Set: Created 4 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
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/omnibox/omnibox_popup_contents_view.h" 5 #include "chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 int current_height_delta = static_cast<int>( 115 int current_height_delta = static_cast<int>(
116 size_animation_.GetCurrentValue() * total_height_delta - 0.5); 116 size_animation_.GetCurrentValue() * total_height_delta - 0.5);
117 current_frame_bounds.set_height( 117 current_frame_bounds.set_height(
118 current_frame_bounds.height() + current_height_delta); 118 current_frame_bounds.height() + current_height_delta);
119 return current_frame_bounds; 119 return current_frame_bounds;
120 } 120 }
121 121
122 void OmniboxPopupContentsView::LayoutChildren() { 122 void OmniboxPopupContentsView::LayoutChildren() {
123 gfx::Rect contents_rect = GetContentsBounds(); 123 gfx::Rect contents_rect = GetContentsBounds();
124 contents_rect.Inset(GetLayoutInsets(OMNIBOX_DROPDOWN)); 124 contents_rect.Inset(GetLayoutInsets(OMNIBOX_DROPDOWN));
125 contents_rect.Inset(0, views::NonClientFrameView::kClientEdgeThickness, 0, 0); 125 contents_rect.Inset(start_margin_,
126 126 views::NonClientFrameView::kClientEdgeThickness,
127 // In the non-material dropdown, the colored/clickable regions within the 127 end_margin_, 0);
128 // dropdown are only as wide as the location bar. In the material version,
129 // these are full width, and OmniboxResultView instead insets the icons/text
130 // inside to be aligned with the location bar.
131 if (!ui::MaterialDesignController::IsModeMaterial())
132 contents_rect.Inset(start_margin_, 0, end_margin_, 0);
133 128
134 int top = contents_rect.y(); 129 int top = contents_rect.y();
135 for (size_t i = 0; i < AutocompleteResult::kMaxMatches; ++i) { 130 for (size_t i = 0; i < AutocompleteResult::kMaxMatches; ++i) {
136 View* v = child_at(i); 131 View* v = child_at(i);
137 if (v->visible()) { 132 if (v->visible()) {
138 v->SetBounds(contents_rect.x(), top, contents_rect.width(), 133 v->SetBounds(contents_rect.x(), top, contents_rect.width(),
139 v->GetPreferredSize().height()); 134 v->GetPreferredSize().height());
140 top = v->bounds().bottom(); 135 top = v->bounds().bottom();
141 } 136 }
142 } 137 }
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 size_t index = GetIndexForPoint(event.location()); 523 size_t index = GetIndexForPoint(event.location());
529 if (!HasMatchAt(index)) 524 if (!HasMatchAt(index))
530 return; 525 return;
531 omnibox_view_->OpenMatch(model_->result().match_at(index), disposition, 526 omnibox_view_->OpenMatch(model_->result().match_at(index), disposition,
532 GURL(), base::string16(), index); 527 GURL(), base::string16(), index);
533 } 528 }
534 529
535 OmniboxResultView* OmniboxPopupContentsView::result_view_at(size_t i) { 530 OmniboxResultView* OmniboxPopupContentsView::result_view_at(size_t i) {
536 return static_cast<OmniboxResultView*>(child_at(static_cast<int>(i))); 531 return static_cast<OmniboxResultView*>(child_at(static_cast<int>(i)));
537 } 532 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698