| OLD | NEW |
| 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/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
| (...skipping 1271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1282 recorder.canvas()->DrawFocusRect(omnibox_view_->bounds()); | 1282 recorder.canvas()->DrawFocusRect(omnibox_view_->bounds()); |
| 1283 | 1283 |
| 1284 // Maximized popup windows don't draw the horizontal edges. We implement this | 1284 // Maximized popup windows don't draw the horizontal edges. We implement this |
| 1285 // by simply expanding the paint area outside the view by the edge thickness. | 1285 // by simply expanding the paint area outside the view by the edge thickness. |
| 1286 gfx::Rect border_rect(GetContentsBounds()); | 1286 gfx::Rect border_rect(GetContentsBounds()); |
| 1287 if (is_popup_mode_ && (GetHorizontalEdgeThickness() == 0)) | 1287 if (is_popup_mode_ && (GetHorizontalEdgeThickness() == 0)) |
| 1288 border_rect.Inset(-kPopupEdgeThickness, 0); | 1288 border_rect.Inset(-kPopupEdgeThickness, 0); |
| 1289 | 1289 |
| 1290 if (ui::MaterialDesignController::IsModeMaterial()) { | 1290 if (ui::MaterialDesignController::IsModeMaterial()) { |
| 1291 gfx::Canvas* canvas = recorder.canvas(); | 1291 gfx::Canvas* canvas = recorder.canvas(); |
| 1292 const float scale = canvas->SaveAndUnscale(); | 1292 ScopedCanvas scoped(canvas); |
| 1293 const float scale = canvas->UnscaleTheDeviceScaleFactor(); |
| 1293 | 1294 |
| 1294 SkPaint paint; | 1295 SkPaint paint; |
| 1295 paint.setStyle(SkPaint::Style::kStroke_Style); | 1296 paint.setStyle(SkPaint::Style::kStroke_Style); |
| 1296 paint.setColor(SkColorSetARGB(0x40, 0x00, 0x00, 0x00)); | 1297 paint.setColor(SkColorSetARGB(0x40, 0x00, 0x00, 0x00)); |
| 1297 paint.setStrokeWidth(1); | 1298 paint.setStrokeWidth(1); |
| 1298 paint.setAntiAlias(true); | 1299 paint.setAntiAlias(true); |
| 1299 | 1300 |
| 1300 const float kOffset = 0.5f; | 1301 const float kOffset = 0.5f; |
| 1301 gfx::RectF border_rect_f(border_rect); | 1302 gfx::RectF border_rect_f(border_rect); |
| 1302 border_rect_f.Scale(scale); | 1303 border_rect_f.Scale(scale); |
| 1303 gfx::InsetsF insets(kOffset, kOffset, kOffset, kOffset); | 1304 gfx::InsetsF insets(kOffset, kOffset, kOffset, kOffset); |
| 1304 border_rect_f.Inset(insets); | 1305 border_rect_f.Inset(insets); |
| 1305 | 1306 |
| 1306 const SkScalar kCornerRadius = SkDoubleToScalar(2.5f * scale); | 1307 const SkScalar kCornerRadius = SkDoubleToScalar(2.5f * scale); |
| 1307 canvas->sk_canvas()->drawRoundRect(gfx::RectFToSkRect(border_rect_f), | 1308 canvas->sk_canvas()->drawRoundRect(gfx::RectFToSkRect(border_rect_f), |
| 1308 kCornerRadius, kCornerRadius, paint); | 1309 kCornerRadius, kCornerRadius, paint); |
| 1309 recorder.canvas()->Restore(); | |
| 1310 } else { | 1310 } else { |
| 1311 views::Painter::PaintPainterAt(recorder.canvas(), border_painter_.get(), | 1311 views::Painter::PaintPainterAt(recorder.canvas(), border_painter_.get(), |
| 1312 border_rect); | 1312 border_rect); |
| 1313 } | 1313 } |
| 1314 } | 1314 } |
| 1315 | 1315 |
| 1316 //////////////////////////////////////////////////////////////////////////////// | 1316 //////////////////////////////////////////////////////////////////////////////// |
| 1317 // LocationBarView, private views::ButtonListener implementation: | 1317 // LocationBarView, private views::ButtonListener implementation: |
| 1318 | 1318 |
| 1319 void LocationBarView::ButtonPressed(views::Button* sender, | 1319 void LocationBarView::ButtonPressed(views::Button* sender, |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1417 | 1417 |
| 1418 void LocationBarView::ModelChanged(const SearchModel::State& old_state, | 1418 void LocationBarView::ModelChanged(const SearchModel::State& old_state, |
| 1419 const SearchModel::State& new_state) { | 1419 const SearchModel::State& new_state) { |
| 1420 const bool visible = !GetToolbarModel()->input_in_progress() && | 1420 const bool visible = !GetToolbarModel()->input_in_progress() && |
| 1421 new_state.voice_search_supported; | 1421 new_state.voice_search_supported; |
| 1422 if (mic_search_view_->visible() != visible) { | 1422 if (mic_search_view_->visible() != visible) { |
| 1423 mic_search_view_->SetVisible(visible); | 1423 mic_search_view_->SetVisible(visible); |
| 1424 Layout(); | 1424 Layout(); |
| 1425 } | 1425 } |
| 1426 } | 1426 } |
| OLD | NEW |