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

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

Issue 275183002: patch from issue 218843002 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 6 years, 7 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/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 1415 matching lines...) Expand 10 before | Expand all | Expand 10 after
1426 paint.setStyle(SkPaint::kFill_Style); 1426 paint.setStyle(SkPaint::kFill_Style);
1427 paint.setColor(color); 1427 paint.setColor(color);
1428 const int kBorderCornerRadius = 2; 1428 const int kBorderCornerRadius = 2;
1429 canvas->DrawRoundRect(bounds, kBorderCornerRadius, paint); 1429 canvas->DrawRoundRect(bounds, kBorderCornerRadius, paint);
1430 } 1430 }
1431 1431
1432 // The border itself will be drawn in PaintChildren() since it includes an 1432 // The border itself will be drawn in PaintChildren() since it includes an
1433 // inner shadow which should be drawn over the contents. 1433 // inner shadow which should be drawn over the contents.
1434 } 1434 }
1435 1435
1436 void LocationBarView::PaintChildren(gfx::Canvas* canvas) { 1436 void LocationBarView::PaintChildren(gfx::Canvas* canvas,
1437 const views::CullSet& cull_set) {
1437 // Paint all the children except for the origin chip and the search button, 1438 // Paint all the children except for the origin chip and the search button,
1438 // which will be painted after the border. 1439 // which will be painted after the border.
1439 for (int i = 0, count = child_count(); i < count; ++i) { 1440 for (int i = 0, count = child_count(); i < count; ++i) {
1440 if (!child_at(i)->layer() && 1441 if (!child_at(i)->layer() &&
1441 (child_at(i) != origin_chip_view_) && 1442 (child_at(i) != origin_chip_view_) &&
1442 (child_at(i) != search_button_)) 1443 (child_at(i) != search_button_))
1443 child_at(i)->Paint(canvas); 1444 child_at(i)->Paint(canvas, cull_set);
1444 } 1445 }
1445 1446
1446 // For non-InstantExtendedAPI cases, if necessary, show focus rect. As we need 1447 // For non-InstantExtendedAPI cases, if necessary, show focus rect. As we need
1447 // the focus rect to appear on top of children we paint here rather than 1448 // the focus rect to appear on top of children we paint here rather than
1448 // OnPaint(). 1449 // OnPaint().
1449 // Note: |Canvas::DrawFocusRect| paints a dashed rect with gray color. 1450 // Note: |Canvas::DrawFocusRect| paints a dashed rect with gray color.
1450 if (show_focus_rect_ && HasFocus()) 1451 if (show_focus_rect_ && HasFocus())
1451 canvas->DrawFocusRect(omnibox_view_->bounds()); 1452 canvas->DrawFocusRect(omnibox_view_->bounds());
1452 1453
1453 // Maximized popup windows don't draw the horizontal edges. We implement this 1454 // Maximized popup windows don't draw the horizontal edges. We implement this
1454 // by simply expanding the paint area outside the view by the edge thickness. 1455 // by simply expanding the paint area outside the view by the edge thickness.
1455 gfx::Rect border_rect(GetContentsBounds()); 1456 gfx::Rect border_rect(GetContentsBounds());
1456 if (is_popup_mode_ && (GetHorizontalEdgeThickness() == 0)) 1457 if (is_popup_mode_ && (GetHorizontalEdgeThickness() == 0))
1457 border_rect.Inset(-kPopupEdgeThickness, 0); 1458 border_rect.Inset(-kPopupEdgeThickness, 0);
1458 views::Painter::PaintPainterAt(canvas, border_painter_.get(), border_rect); 1459 views::Painter::PaintPainterAt(canvas, border_painter_.get(), border_rect);
1459 1460
1460 // The origin chip and the search button must be painted after the border so 1461 // The origin chip and the search button must be painted after the border so
1461 // that the border shadow is not drawn over them. 1462 // that the border shadow is not drawn over them.
1462 origin_chip_view_->Paint(canvas); 1463 origin_chip_view_->Paint(canvas, cull_set);
1463 search_button_->Paint(canvas); 1464 search_button_->Paint(canvas, cull_set);
1464 } 1465 }
1465 1466
1466 //////////////////////////////////////////////////////////////////////////////// 1467 ////////////////////////////////////////////////////////////////////////////////
1467 // LocationBarView, private views::ButtonListener implementation: 1468 // LocationBarView, private views::ButtonListener implementation:
1468 1469
1469 void LocationBarView::ButtonPressed(views::Button* sender, 1470 void LocationBarView::ButtonPressed(views::Button* sender,
1470 const ui::Event& event) { 1471 const ui::Event& event) {
1471 if (sender == mic_search_view_) { 1472 if (sender == mic_search_view_) {
1472 command_updater()->ExecuteCommand(IDC_TOGGLE_SPEECH_INPUT); 1473 command_updater()->ExecuteCommand(IDC_TOGGLE_SPEECH_INPUT);
1473 return; 1474 return;
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
1641 void LocationBarView::ModelChanged(const SearchModel::State& old_state, 1642 void LocationBarView::ModelChanged(const SearchModel::State& old_state,
1642 const SearchModel::State& new_state) { 1643 const SearchModel::State& new_state) {
1643 const bool visible = !GetToolbarModel()->input_in_progress() && 1644 const bool visible = !GetToolbarModel()->input_in_progress() &&
1644 new_state.voice_search_supported; 1645 new_state.voice_search_supported;
1645 if (mic_search_view_->visible() != visible) { 1646 if (mic_search_view_->visible() != visible) {
1646 mic_search_view_->SetVisible(visible); 1647 mic_search_view_->SetVisible(visible);
1647 Layout(); 1648 Layout();
1648 } 1649 }
1649 } 1650 }
1650 1651
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698