| 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/app_menu_button.h" | 5 #include "chrome/browser/ui/views/toolbar/app_menu_button.h" |
| 6 | 6 |
| 7 #include "base/location.h" | 7 #include "base/location.h" |
| 8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 GetImageSkiaNamed(IDR_TOOLBAR_BEZEL_HOVER)->size(); | 133 GetImageSkiaNamed(IDR_TOOLBAR_BEZEL_HOVER)->size(); |
| 134 } | 134 } |
| 135 | 135 |
| 136 void AppMenuButton::ScheduleAppMenuIconPaint() { | 136 void AppMenuButton::ScheduleAppMenuIconPaint() { |
| 137 SchedulePaint(); | 137 SchedulePaint(); |
| 138 } | 138 } |
| 139 | 139 |
| 140 void AppMenuButton::UpdateIcon() { | 140 void AppMenuButton::UpdateIcon() { |
| 141 DCHECK(ui::MaterialDesignController::IsModeMaterial()); | 141 DCHECK(ui::MaterialDesignController::IsModeMaterial()); |
| 142 SkColor color = gfx::kPlaceholderColor; | 142 SkColor color = gfx::kPlaceholderColor; |
| 143 const ui::NativeTheme* native_theme = GetNativeTheme(); |
| 143 switch (severity_) { | 144 switch (severity_) { |
| 144 case AppMenuIconPainter::SEVERITY_NONE: | 145 case AppMenuIconPainter::SEVERITY_NONE: |
| 145 color = GetThemeProvider()->GetColor( | 146 color = GetThemeProvider()->GetColor( |
| 146 ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON); | 147 ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON); |
| 147 break; | 148 break; |
| 148 case AppMenuIconPainter::SEVERITY_LOW: | 149 case AppMenuIconPainter::SEVERITY_LOW: |
| 149 color = gfx::kGoogleGreen700; | 150 color = native_theme->GetSystemColor( |
| 151 ui::NativeTheme::kColorId_AlertSeverityLow); |
| 150 break; | 152 break; |
| 151 case AppMenuIconPainter::SEVERITY_MEDIUM: | 153 case AppMenuIconPainter::SEVERITY_MEDIUM: |
| 152 color = gfx::kGoogleYellow700; | 154 color = native_theme->GetSystemColor( |
| 155 ui::NativeTheme::kColorId_AlertSeverityMedium); |
| 153 break; | 156 break; |
| 154 case AppMenuIconPainter::SEVERITY_HIGH: | 157 case AppMenuIconPainter::SEVERITY_HIGH: |
| 155 color = gfx::kGoogleRed700; | 158 color = native_theme->GetSystemColor( |
| 159 ui::NativeTheme::kColorId_AlertSeverityHigh); |
| 156 break; | 160 break; |
| 157 } | 161 } |
| 158 | 162 |
| 159 gfx::VectorIconId icon_id = gfx::VectorIconId::VECTOR_ICON_NONE; | 163 gfx::VectorIconId icon_id = gfx::VectorIconId::VECTOR_ICON_NONE; |
| 160 switch (type_) { | 164 switch (type_) { |
| 161 case AppMenuIconController::IconType::NONE: | 165 case AppMenuIconController::IconType::NONE: |
| 162 icon_id = gfx::VectorIconId::BROWSER_TOOLS; | 166 icon_id = gfx::VectorIconId::BROWSER_TOOLS; |
| 163 DCHECK_EQ(severity_, AppMenuIconPainter::SEVERITY_NONE); | 167 DCHECK_EQ(severity_, AppMenuIconPainter::SEVERITY_NONE); |
| 164 break; | 168 break; |
| 165 case AppMenuIconController::IconType::UPGRADE_NOTIFICATION: | 169 case AppMenuIconController::IconType::UPGRADE_NOTIFICATION: |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 views::MenuButton::OnPaint(canvas); | 270 views::MenuButton::OnPaint(canvas); |
| 267 if (ui::MaterialDesignController::IsModeMaterial()) | 271 if (ui::MaterialDesignController::IsModeMaterial()) |
| 268 return; | 272 return; |
| 269 // Use GetPreferredSize() to center the icon inside the visible bounds rather | 273 // Use GetPreferredSize() to center the icon inside the visible bounds rather |
| 270 // than the whole size() (which may refer to hit test region extended to the | 274 // than the whole size() (which may refer to hit test region extended to the |
| 271 // end of the toolbar in maximized mode). | 275 // end of the toolbar in maximized mode). |
| 272 icon_painter_->Paint(canvas, GetThemeProvider(), | 276 icon_painter_->Paint(canvas, GetThemeProvider(), |
| 273 gfx::Rect(GetPreferredSize()), | 277 gfx::Rect(GetPreferredSize()), |
| 274 AppMenuIconPainter::BEZEL_NONE); | 278 AppMenuIconPainter::BEZEL_NONE); |
| 275 } | 279 } |
| OLD | NEW |