| 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/wrench_toolbar_button.h" | 5 #include "chrome/browser/ui/views/toolbar/wrench_toolbar_button.h" |
| 6 | 6 |
| 7 #include "base/location.h" | 7 #include "base/location.h" |
| 8 #include "base/single_thread_task_runner.h" | 8 #include "base/single_thread_task_runner.h" |
| 9 #include "base/thread_task_runner_handle.h" | 9 #include "base/thread_task_runner_handle.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| 11 #include "chrome/browser/themes/theme_properties.h" | |
| 12 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
| 13 #include "chrome/browser/ui/views/extensions/browser_action_drag_data.h" | 12 #include "chrome/browser/ui/views/extensions/browser_action_drag_data.h" |
| 13 #include "chrome/browser/ui/views/layout_constants.h" |
| 14 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" | 14 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" |
| 15 #include "extensions/common/feature_switch.h" | 15 #include "extensions/common/feature_switch.h" |
| 16 #include "grit/theme_resources.h" | 16 #include "grit/theme_resources.h" |
| 17 #include "ui/base/resource/material_design/material_design_controller.h" | 17 #include "ui/base/resource/material_design/material_design_controller.h" |
| 18 #include "ui/base/resource/resource_bundle.h" | 18 #include "ui/base/resource/resource_bundle.h" |
| 19 #include "ui/base/theme_provider.h" | 19 #include "ui/base/theme_provider.h" |
| 20 #include "ui/views/controls/button/label_button_border.h" | 20 #include "ui/views/controls/button/label_button_border.h" |
| 21 #include "ui/views/metrics.h" | 21 #include "ui/views/metrics.h" |
| 22 #include "ui/views/painter.h" | 22 #include "ui/views/painter.h" |
| 23 | 23 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 46 | 46 |
| 47 wrench_icon_painter_->SetSeverity(severity, animate); | 47 wrench_icon_painter_->SetSeverity(severity, animate); |
| 48 SchedulePaint(); | 48 SchedulePaint(); |
| 49 } | 49 } |
| 50 | 50 |
| 51 gfx::Size WrenchToolbarButton::GetPreferredSize() const { | 51 gfx::Size WrenchToolbarButton::GetPreferredSize() const { |
| 52 if (ui::MaterialDesignController::IsModeMaterial()) { | 52 if (ui::MaterialDesignController::IsModeMaterial()) { |
| 53 gfx::Size size(image()->GetPreferredSize()); | 53 gfx::Size size(image()->GetPreferredSize()); |
| 54 ui::ThemeProvider* provider = GetThemeProvider(); | 54 ui::ThemeProvider* provider = GetThemeProvider(); |
| 55 if (provider && provider->UsingSystemTheme()) { | 55 if (provider && provider->UsingSystemTheme()) { |
| 56 int inset = provider->GetDisplayProperty( | 56 gfx::Insets insets(GetLayoutInsets(TOOLBAR_BUTTON)); |
| 57 ThemeProperties::PROPERTY_TOOLBAR_BUTTON_BORDER_INSET); | 57 size.Enlarge(insets.width(), insets.height()); |
| 58 size.Enlarge(2 * inset, 2 * inset); | |
| 59 } | 58 } |
| 60 return size; | 59 return size; |
| 61 } | 60 } |
| 62 | 61 |
| 63 return ResourceBundle::GetSharedInstance(). | 62 return ResourceBundle::GetSharedInstance(). |
| 64 GetImageSkiaNamed(IDR_TOOLBAR_BEZEL_HOVER)->size(); | 63 GetImageSkiaNamed(IDR_TOOLBAR_BEZEL_HOVER)->size(); |
| 65 } | 64 } |
| 66 | 65 |
| 67 void WrenchToolbarButton::ScheduleWrenchIconPaint() { | 66 void WrenchToolbarButton::ScheduleWrenchIconPaint() { |
| 68 SchedulePaint(); | 67 SchedulePaint(); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 return; | 123 return; |
| 125 wrench_icon_painter_->Paint(canvas, | 124 wrench_icon_painter_->Paint(canvas, |
| 126 GetThemeProvider(), | 125 GetThemeProvider(), |
| 127 gfx::Rect(size()), | 126 gfx::Rect(size()), |
| 128 WrenchIconPainter::BEZEL_NONE); | 127 WrenchIconPainter::BEZEL_NONE); |
| 129 } | 128 } |
| 130 | 129 |
| 131 void WrenchToolbarButton::ShowOverflowMenu() { | 130 void WrenchToolbarButton::ShowOverflowMenu() { |
| 132 toolbar_view_->ShowAppMenu(true); // For drop. | 131 toolbar_view_->ShowAppMenu(true); // For drop. |
| 133 } | 132 } |
| OLD | NEW |