| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/toolbar/toolbar_view.h" | 5 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/i18n/number_formatting.h" | 10 #include "base/i18n/number_formatting.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "base/trace_event/trace_event.h" | 12 #include "base/trace_event/trace_event.h" |
| 13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
| 14 #include "chrome/app/chrome_command_ids.h" | 14 #include "chrome/app/chrome_command_ids.h" |
| 15 #include "chrome/app/vector_icons/vector_icons.h" | |
| 16 #include "chrome/browser/chrome_notification_types.h" | 15 #include "chrome/browser/chrome_notification_types.h" |
| 17 #include "chrome/browser/command_updater.h" | 16 #include "chrome/browser/command_updater.h" |
| 18 #include "chrome/browser/extensions/extension_util.h" | 17 #include "chrome/browser/extensions/extension_util.h" |
| 19 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
| 20 #include "chrome/browser/themes/theme_properties.h" | 19 #include "chrome/browser/themes/theme_properties.h" |
| 21 #include "chrome/browser/ui/bookmarks/bookmark_bubble_sign_in_delegate.h" | 20 #include "chrome/browser/ui/bookmarks/bookmark_bubble_sign_in_delegate.h" |
| 22 #include "chrome/browser/ui/browser.h" | 21 #include "chrome/browser/ui/browser.h" |
| 23 #include "chrome/browser/ui/browser_command_controller.h" | 22 #include "chrome/browser/ui/browser_command_controller.h" |
| 24 #include "chrome/browser/ui/browser_commands.h" | 23 #include "chrome/browser/ui/browser_commands.h" |
| 25 #include "chrome/browser/ui/browser_content_setting_bubble_model_delegate.h" | 24 #include "chrome/browser/ui/browser_content_setting_bubble_model_delegate.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 #include "content/public/browser/web_contents.h" | 61 #include "content/public/browser/web_contents.h" |
| 63 #include "ui/accessibility/ax_node_data.h" | 62 #include "ui/accessibility/ax_node_data.h" |
| 64 #include "ui/base/l10n/l10n_util.h" | 63 #include "ui/base/l10n/l10n_util.h" |
| 65 #include "ui/base/material_design/material_design_controller.h" | 64 #include "ui/base/material_design/material_design_controller.h" |
| 66 #include "ui/base/theme_provider.h" | 65 #include "ui/base/theme_provider.h" |
| 67 #include "ui/base/window_open_disposition.h" | 66 #include "ui/base/window_open_disposition.h" |
| 68 #include "ui/compositor/layer.h" | 67 #include "ui/compositor/layer.h" |
| 69 #include "ui/gfx/canvas.h" | 68 #include "ui/gfx/canvas.h" |
| 70 #include "ui/gfx/image/canvas_image_source.h" | 69 #include "ui/gfx/image/canvas_image_source.h" |
| 71 #include "ui/gfx/paint_vector_icon.h" | 70 #include "ui/gfx/paint_vector_icon.h" |
| 71 #include "ui/gfx/vector_icons_public.h" |
| 72 #include "ui/keyboard/keyboard_controller.h" | 72 #include "ui/keyboard/keyboard_controller.h" |
| 73 #include "ui/native_theme/native_theme_aura.h" | 73 #include "ui/native_theme/native_theme_aura.h" |
| 74 #include "ui/views/focus/view_storage.h" | 74 #include "ui/views/focus/view_storage.h" |
| 75 #include "ui/views/widget/tooltip_manager.h" | 75 #include "ui/views/widget/tooltip_manager.h" |
| 76 #include "ui/views/widget/widget.h" | 76 #include "ui/views/widget/widget.h" |
| 77 #include "ui/views/window/non_client_view.h" | 77 #include "ui/views/window/non_client_view.h" |
| 78 | 78 |
| 79 #if defined(OS_WIN) | 79 #if defined(OS_WIN) |
| 80 #include "chrome/browser/recovery/recovery_install_global_error_factory.h" | 80 #include "chrome/browser/recovery/recovery_install_global_error_factory.h" |
| 81 #include "chrome/browser/ui/views/conflicting_module_view_win.h" | 81 #include "chrome/browser/ui/views/conflicting_module_view_win.h" |
| (...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 741 void ToolbarView::LoadImages() { | 741 void ToolbarView::LoadImages() { |
| 742 const ui::ThemeProvider* tp = GetThemeProvider(); | 742 const ui::ThemeProvider* tp = GetThemeProvider(); |
| 743 | 743 |
| 744 const SkColor normal_color = | 744 const SkColor normal_color = |
| 745 tp->GetColor(ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON); | 745 tp->GetColor(ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON); |
| 746 const SkColor disabled_color = | 746 const SkColor disabled_color = |
| 747 tp->GetColor(ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON_INACTIVE); | 747 tp->GetColor(ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON_INACTIVE); |
| 748 | 748 |
| 749 back_->SetImage( | 749 back_->SetImage( |
| 750 views::Button::STATE_NORMAL, | 750 views::Button::STATE_NORMAL, |
| 751 gfx::CreateVectorIcon(kNavigateBackIcon, normal_color)); | 751 gfx::CreateVectorIcon(gfx::VectorIconId::NAVIGATE_BACK, normal_color)); |
| 752 back_->SetImage( | 752 back_->SetImage( |
| 753 views::Button::STATE_DISABLED, | 753 views::Button::STATE_DISABLED, |
| 754 gfx::CreateVectorIcon(kNavigateBackIcon, normal_color)); | 754 gfx::CreateVectorIcon(gfx::VectorIconId::NAVIGATE_BACK, disabled_color)); |
| 755 forward_->SetImage( | 755 forward_->SetImage( |
| 756 views::Button::STATE_NORMAL, | 756 views::Button::STATE_NORMAL, |
| 757 gfx::CreateVectorIcon(kNavigateForwardIcon, normal_color)); | 757 gfx::CreateVectorIcon(gfx::VectorIconId::NAVIGATE_FORWARD, normal_color)); |
| 758 forward_->SetImage( | 758 forward_->SetImage(views::Button::STATE_DISABLED, |
| 759 views::Button::STATE_DISABLED, | 759 gfx::CreateVectorIcon(gfx::VectorIconId::NAVIGATE_FORWARD, |
| 760 gfx::CreateVectorIcon(kNavigateForwardIcon, disabled_color)); | 760 disabled_color)); |
| 761 home_->SetImage(views::Button::STATE_NORMAL, | 761 home_->SetImage( |
| 762 gfx::CreateVectorIcon(kNavigateHomeIcon, normal_color)); | 762 views::Button::STATE_NORMAL, |
| 763 gfx::CreateVectorIcon(gfx::VectorIconId::NAVIGATE_HOME, normal_color)); |
| 763 app_menu_button_->UpdateIcon(); | 764 app_menu_button_->UpdateIcon(); |
| 764 | 765 |
| 765 back_->set_ink_drop_base_color(normal_color); | 766 back_->set_ink_drop_base_color(normal_color); |
| 766 forward_->set_ink_drop_base_color(normal_color); | 767 forward_->set_ink_drop_base_color(normal_color); |
| 767 home_->set_ink_drop_base_color(normal_color); | 768 home_->set_ink_drop_base_color(normal_color); |
| 768 app_menu_button_->set_ink_drop_base_color(normal_color); | 769 app_menu_button_->set_ink_drop_base_color(normal_color); |
| 769 | 770 |
| 770 reload_->LoadImages(); | 771 reload_->LoadImages(); |
| 771 } | 772 } |
| 772 | 773 |
| 773 void ToolbarView::ShowCriticalNotification() { | 774 void ToolbarView::ShowCriticalNotification() { |
| 774 #if defined(OS_WIN) | 775 #if defined(OS_WIN) |
| 775 views::BubbleDialogDelegateView::CreateBubble( | 776 views::BubbleDialogDelegateView::CreateBubble( |
| 776 new CriticalNotificationBubbleView(app_menu_button_))->Show(); | 777 new CriticalNotificationBubbleView(app_menu_button_))->Show(); |
| 777 #endif | 778 #endif |
| 778 } | 779 } |
| 779 | 780 |
| 780 void ToolbarView::ShowOutdatedInstallNotification(bool auto_update_enabled) { | 781 void ToolbarView::ShowOutdatedInstallNotification(bool auto_update_enabled) { |
| 781 if (OutdatedUpgradeBubbleView::IsAvailable()) { | 782 if (OutdatedUpgradeBubbleView::IsAvailable()) { |
| 782 OutdatedUpgradeBubbleView::ShowBubble(app_menu_button_, browser_, | 783 OutdatedUpgradeBubbleView::ShowBubble(app_menu_button_, browser_, |
| 783 auto_update_enabled); | 784 auto_update_enabled); |
| 784 } | 785 } |
| 785 } | 786 } |
| 786 | 787 |
| 787 void ToolbarView::OnShowHomeButtonChanged() { | 788 void ToolbarView::OnShowHomeButtonChanged() { |
| 788 Layout(); | 789 Layout(); |
| 789 SchedulePaint(); | 790 SchedulePaint(); |
| 790 } | 791 } |
| OLD | NEW |