| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 #include "ui/base/resource/resource_bundle.h" | 79 #include "ui/base/resource/resource_bundle.h" |
| 80 #include "ui/base/theme_provider.h" | 80 #include "ui/base/theme_provider.h" |
| 81 #include "ui/compositor/paint_recorder.h" | 81 #include "ui/compositor/paint_recorder.h" |
| 82 #include "ui/events/event.h" | 82 #include "ui/events/event.h" |
| 83 #include "ui/gfx/animation/slide_animation.h" | 83 #include "ui/gfx/animation/slide_animation.h" |
| 84 #include "ui/gfx/canvas.h" | 84 #include "ui/gfx/canvas.h" |
| 85 #include "ui/gfx/color_palette.h" | 85 #include "ui/gfx/color_palette.h" |
| 86 #include "ui/gfx/color_utils.h" | 86 #include "ui/gfx/color_utils.h" |
| 87 #include "ui/gfx/image/image.h" | 87 #include "ui/gfx/image/image.h" |
| 88 #include "ui/gfx/image/image_skia_operations.h" | 88 #include "ui/gfx/image/image_skia_operations.h" |
| 89 #include "ui/gfx/paint_vector_icon.h" |
| 89 #include "ui/gfx/scoped_canvas.h" | 90 #include "ui/gfx/scoped_canvas.h" |
| 90 #include "ui/gfx/skia_util.h" | 91 #include "ui/gfx/skia_util.h" |
| 91 #include "ui/gfx/text_utils.h" | 92 #include "ui/gfx/text_utils.h" |
| 92 #include "ui/native_theme/native_theme.h" | 93 #include "ui/native_theme/native_theme.h" |
| 93 #include "ui/views/background.h" | 94 #include "ui/views/background.h" |
| 94 #include "ui/views/border.h" | 95 #include "ui/views/border.h" |
| 95 #include "ui/views/button_drag_utils.h" | 96 #include "ui/views/button_drag_utils.h" |
| 96 #include "ui/views/controls/button/image_button.h" | 97 #include "ui/views/controls/button/image_button.h" |
| 97 #include "ui/views/controls/label.h" | 98 #include "ui/views/controls/label.h" |
| 98 #include "ui/views/widget/widget.h" | 99 #include "ui/views/widget/widget.h" |
| (...skipping 1292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1391 } | 1392 } |
| 1392 | 1393 |
| 1393 void LocationBarView::AnimationEnded(const gfx::Animation* animation) { | 1394 void LocationBarView::AnimationEnded(const gfx::Animation* animation) { |
| 1394 browser_->window()->ToolbarSizeChanged(false); | 1395 browser_->window()->ToolbarSizeChanged(false); |
| 1395 } | 1396 } |
| 1396 | 1397 |
| 1397 //////////////////////////////////////////////////////////////////////////////// | 1398 //////////////////////////////////////////////////////////////////////////////// |
| 1398 // LocationBarView, private OmniboxEditController implementation: | 1399 // LocationBarView, private OmniboxEditController implementation: |
| 1399 | 1400 |
| 1400 void LocationBarView::OnChanged() { | 1401 void LocationBarView::OnChanged() { |
| 1401 int icon_id = omnibox_view_->GetIcon(); | 1402 location_icon_view_->SetImage( |
| 1402 location_icon_view_->SetImage(GetThemeProvider()->GetImageSkiaNamed(icon_id)); | 1403 ui::MaterialDesignController::IsModeMaterial() |
| 1404 ? gfx::CreateVectorIcon(omnibox_view_->GetVectorIcon(), 16, |
| 1405 gfx::kChromeIconGrey) |
| 1406 : *GetThemeProvider()->GetImageSkiaNamed(omnibox_view_->GetIcon())); |
| 1403 location_icon_view_->ShowTooltip(!GetOmniboxView()->IsEditingOrEmpty()); | 1407 location_icon_view_->ShowTooltip(!GetOmniboxView()->IsEditingOrEmpty()); |
| 1404 | 1408 |
| 1405 Layout(); | 1409 Layout(); |
| 1406 SchedulePaint(); | 1410 SchedulePaint(); |
| 1407 } | 1411 } |
| 1408 | 1412 |
| 1409 void LocationBarView::OnSetFocus() { | 1413 void LocationBarView::OnSetFocus() { |
| 1410 GetFocusManager()->SetFocusedView(this); | 1414 GetFocusManager()->SetFocusedView(this); |
| 1411 } | 1415 } |
| 1412 | 1416 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1442 | 1446 |
| 1443 void LocationBarView::ModelChanged(const SearchModel::State& old_state, | 1447 void LocationBarView::ModelChanged(const SearchModel::State& old_state, |
| 1444 const SearchModel::State& new_state) { | 1448 const SearchModel::State& new_state) { |
| 1445 const bool visible = !GetToolbarModel()->input_in_progress() && | 1449 const bool visible = !GetToolbarModel()->input_in_progress() && |
| 1446 new_state.voice_search_supported; | 1450 new_state.voice_search_supported; |
| 1447 if (mic_search_view_->visible() != visible) { | 1451 if (mic_search_view_->visible() != visible) { |
| 1448 mic_search_view_->SetVisible(visible); | 1452 mic_search_view_->SetVisible(visible); |
| 1449 Layout(); | 1453 Layout(); |
| 1450 } | 1454 } |
| 1451 } | 1455 } |
| OLD | NEW |