| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 #include "ui/accessibility/ax_view_state.h" | 72 #include "ui/accessibility/ax_view_state.h" |
| 73 #include "ui/base/dragdrop/drag_drop_types.h" | 73 #include "ui/base/dragdrop/drag_drop_types.h" |
| 74 #include "ui/base/l10n/l10n_util.h" | 74 #include "ui/base/l10n/l10n_util.h" |
| 75 #include "ui/base/resource/material_design/material_design_controller.h" | 75 #include "ui/base/resource/material_design/material_design_controller.h" |
| 76 #include "ui/base/resource/resource_bundle.h" | 76 #include "ui/base/resource/resource_bundle.h" |
| 77 #include "ui/base/theme_provider.h" | 77 #include "ui/base/theme_provider.h" |
| 78 #include "ui/compositor/paint_recorder.h" | 78 #include "ui/compositor/paint_recorder.h" |
| 79 #include "ui/events/event.h" | 79 #include "ui/events/event.h" |
| 80 #include "ui/gfx/animation/slide_animation.h" | 80 #include "ui/gfx/animation/slide_animation.h" |
| 81 #include "ui/gfx/canvas.h" | 81 #include "ui/gfx/canvas.h" |
| 82 #include "ui/gfx/color_palette.h" |
| 82 #include "ui/gfx/color_utils.h" | 83 #include "ui/gfx/color_utils.h" |
| 83 #include "ui/gfx/image/image.h" | 84 #include "ui/gfx/image/image.h" |
| 84 #include "ui/gfx/image/image_skia_operations.h" | 85 #include "ui/gfx/image/image_skia_operations.h" |
| 86 #include "ui/gfx/paint_vector_icon.h" |
| 85 #include "ui/gfx/scoped_canvas.h" | 87 #include "ui/gfx/scoped_canvas.h" |
| 86 #include "ui/gfx/skia_util.h" | 88 #include "ui/gfx/skia_util.h" |
| 87 #include "ui/gfx/text_utils.h" | 89 #include "ui/gfx/text_utils.h" |
| 88 #include "ui/native_theme/native_theme.h" | 90 #include "ui/native_theme/native_theme.h" |
| 89 #include "ui/views/background.h" | 91 #include "ui/views/background.h" |
| 90 #include "ui/views/border.h" | 92 #include "ui/views/border.h" |
| 91 #include "ui/views/button_drag_utils.h" | 93 #include "ui/views/button_drag_utils.h" |
| 92 #include "ui/views/controls/button/image_button.h" | 94 #include "ui/views/controls/button/image_button.h" |
| 93 #include "ui/views/controls/label.h" | 95 #include "ui/views/controls/label.h" |
| 94 #include "ui/views/widget/widget.h" | 96 #include "ui/views/widget/widget.h" |
| (...skipping 1272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1367 } | 1369 } |
| 1368 | 1370 |
| 1369 void LocationBarView::AnimationEnded(const gfx::Animation* animation) { | 1371 void LocationBarView::AnimationEnded(const gfx::Animation* animation) { |
| 1370 browser_->window()->ToolbarSizeChanged(false); | 1372 browser_->window()->ToolbarSizeChanged(false); |
| 1371 } | 1373 } |
| 1372 | 1374 |
| 1373 //////////////////////////////////////////////////////////////////////////////// | 1375 //////////////////////////////////////////////////////////////////////////////// |
| 1374 // LocationBarView, private OmniboxEditController implementation: | 1376 // LocationBarView, private OmniboxEditController implementation: |
| 1375 | 1377 |
| 1376 void LocationBarView::OnChanged() { | 1378 void LocationBarView::OnChanged() { |
| 1377 int icon_id = omnibox_view_->GetIcon(); | 1379 location_icon_view_->SetImage( |
| 1378 location_icon_view_->SetImage(GetThemeProvider()->GetImageSkiaNamed(icon_id)); | 1380 ui::MaterialDesignController::IsModeMaterial() |
| 1381 ? gfx::CreateVectorIcon(omnibox_view_->GetVectorIcon(), 16, |
| 1382 gfx::kChromeIconGrey) |
| 1383 : *GetThemeProvider()->GetImageSkiaNamed(omnibox_view_->GetIcon())); |
| 1379 location_icon_view_->ShowTooltip(!GetOmniboxView()->IsEditingOrEmpty()); | 1384 location_icon_view_->ShowTooltip(!GetOmniboxView()->IsEditingOrEmpty()); |
| 1380 | 1385 |
| 1381 Layout(); | 1386 Layout(); |
| 1382 SchedulePaint(); | 1387 SchedulePaint(); |
| 1383 } | 1388 } |
| 1384 | 1389 |
| 1385 void LocationBarView::OnSetFocus() { | 1390 void LocationBarView::OnSetFocus() { |
| 1386 GetFocusManager()->SetFocusedView(this); | 1391 GetFocusManager()->SetFocusedView(this); |
| 1387 } | 1392 } |
| 1388 | 1393 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1418 | 1423 |
| 1419 void LocationBarView::ModelChanged(const SearchModel::State& old_state, | 1424 void LocationBarView::ModelChanged(const SearchModel::State& old_state, |
| 1420 const SearchModel::State& new_state) { | 1425 const SearchModel::State& new_state) { |
| 1421 const bool visible = !GetToolbarModel()->input_in_progress() && | 1426 const bool visible = !GetToolbarModel()->input_in_progress() && |
| 1422 new_state.voice_search_supported; | 1427 new_state.voice_search_supported; |
| 1423 if (mic_search_view_->visible() != visible) { | 1428 if (mic_search_view_->visible() != visible) { |
| 1424 mic_search_view_->SetVisible(visible); | 1429 mic_search_view_->SetVisible(visible); |
| 1425 Layout(); | 1430 Layout(); |
| 1426 } | 1431 } |
| 1427 } | 1432 } |
| OLD | NEW |