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

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

Issue 12047107: Change the SearchBox API from using the start/end margins of the location bar to using the start ma… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync to r180728 Created 7 years, 10 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 1268 matching lines...) Expand 10 before | Expand all | Expand 10 after
1279 state->selection_start = entry_start; 1279 state->selection_start = entry_start;
1280 state->selection_end = entry_end; 1280 state->selection_end = entry_end;
1281 } 1281 }
1282 1282
1283 bool LocationBarView::HasFocus() const { 1283 bool LocationBarView::HasFocus() const {
1284 return location_entry_->model()->has_focus(); 1284 return location_entry_->model()->has_focus();
1285 } 1285 }
1286 1286
1287 void LocationBarView::OnBoundsChanged(const gfx::Rect& previous_bounds) { 1287 void LocationBarView::OnBoundsChanged(const gfx::Rect& previous_bounds) {
1288 if (browser_ && browser_->instant_controller() && parent()) { 1288 if (browser_ && browser_->instant_controller() && parent()) {
1289 // Pass the side margins of the location bar to the Instant Controller. 1289 // Pass the start margin and width of the location bar to the Instant
1290 // Controller.
1290 const gfx::Rect bounds = GetBoundsInScreen(); 1291 const gfx::Rect bounds = GetBoundsInScreen();
1291 const gfx::Rect parent_bounds = parent()->GetBoundsInScreen(); 1292 const gfx::Rect parent_bounds = parent()->GetBoundsInScreen();
1292 int start = bounds.x() - parent_bounds.x(); 1293 int margin = base::i18n::IsRTL() ?
samarth 2013/02/05 23:39:33 nit: const int (and below)
melevin 2013/02/06 23:44:05 Done.
1293 int end = parent_bounds.right() - bounds.right(); 1294 parent_bounds.right() - bounds.right() : bounds.x() - parent_bounds.x();
1294 if (base::i18n::IsRTL()) 1295 int width = bounds.width();
1295 std::swap(start, end); 1296 browser_->instant_controller()->SetLocationBarMarginAndWidth(margin, width);
1296 browser_->instant_controller()->SetMarginSize(start, end);
1297 } 1297 }
1298 } 1298 }
1299 1299
1300 void LocationBarView::WriteDragDataForView(views::View* sender, 1300 void LocationBarView::WriteDragDataForView(views::View* sender,
1301 const gfx::Point& press_pt, 1301 const gfx::Point& press_pt,
1302 OSExchangeData* data) { 1302 OSExchangeData* data) {
1303 DCHECK_NE(GetDragOperationsForView(sender, press_pt), 1303 DCHECK_NE(GetDragOperationsForView(sender, press_pt),
1304 ui::DragDropTypes::DRAG_NONE); 1304 ui::DragDropTypes::DRAG_NONE);
1305 1305
1306 WebContents* web_contents = GetWebContents(); 1306 WebContents* web_contents = GetWebContents();
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
1489 int LocationBarView::GetInternalHeight(bool use_preferred_size) { 1489 int LocationBarView::GetInternalHeight(bool use_preferred_size) {
1490 int total_height = 1490 int total_height =
1491 use_preferred_size ? GetPreferredSize().height() : height(); 1491 use_preferred_size ? GetPreferredSize().height() : height();
1492 return std::max(total_height - (kVerticalEdgeThickness * 2), 0); 1492 return std::max(total_height - (kVerticalEdgeThickness * 2), 0);
1493 } 1493 }
1494 1494
1495 bool LocationBarView::HasValidSuggestText() const { 1495 bool LocationBarView::HasValidSuggestText() const {
1496 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() && 1496 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() &&
1497 !suggested_text_view_->text().empty(); 1497 !suggested_text_view_->text().empty();
1498 } 1498 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698