| 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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 gfx::VectorIconId icon_id = gfx::VectorIconId::VECTOR_ICON_NONE; | 159 gfx::VectorIconId icon_id = gfx::VectorIconId::VECTOR_ICON_NONE; |
| 160 switch (type_) { | 160 switch (type_) { |
| 161 case AppMenuIconController::IconType::NONE: | 161 case AppMenuIconController::IconType::NONE: |
| 162 icon_id = gfx::VectorIconId::BROWSER_TOOLS; | 162 icon_id = gfx::VectorIconId::BROWSER_TOOLS; |
| 163 DCHECK_EQ(severity_, AppMenuIconPainter::SEVERITY_NONE); | 163 DCHECK_EQ(severity_, AppMenuIconPainter::SEVERITY_NONE); |
| 164 break; | 164 break; |
| 165 case AppMenuIconController::IconType::UPGRADE_NOTIFICATION: | 165 case AppMenuIconController::IconType::UPGRADE_NOTIFICATION: |
| 166 icon_id = gfx::VectorIconId::BROWSER_TOOLS_UPDATE; | 166 icon_id = gfx::VectorIconId::BROWSER_TOOLS_UPDATE; |
| 167 break; | 167 break; |
| 168 case AppMenuIconController::IconType::GLOBAL_ERROR: | 168 case AppMenuIconController::IconType::GLOBAL_ERROR: |
| 169 case AppMenuIconController::IconType::INCOMPATIBILITY_WARNING: |
| 169 icon_id = gfx::VectorIconId::BROWSER_TOOLS_ERROR; | 170 icon_id = gfx::VectorIconId::BROWSER_TOOLS_ERROR; |
| 170 break; | 171 break; |
| 171 case AppMenuIconController::IconType::INCOMPATIBILITY_WARNING: | |
| 172 icon_id = gfx::VectorIconId::BROWSER_TOOLS_WARNING; | |
| 173 break; | |
| 174 } | 172 } |
| 175 | 173 |
| 176 SetImage(views::Button::STATE_NORMAL, gfx::CreateVectorIcon(icon_id, color)); | 174 SetImage(views::Button::STATE_NORMAL, gfx::CreateVectorIcon(icon_id, color)); |
| 177 } | 175 } |
| 178 | 176 |
| 179 void AppMenuButton::SetTrailingMargin(int margin) { | 177 void AppMenuButton::SetTrailingMargin(int margin) { |
| 180 margin_trailing_ = margin; | 178 margin_trailing_ = margin; |
| 181 | 179 |
| 182 UpdateThemedBorder(); | 180 UpdateThemedBorder(); |
| 183 | 181 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 views::MenuButton::OnPaint(canvas); | 266 views::MenuButton::OnPaint(canvas); |
| 269 if (ui::MaterialDesignController::IsModeMaterial()) | 267 if (ui::MaterialDesignController::IsModeMaterial()) |
| 270 return; | 268 return; |
| 271 // Use GetPreferredSize() to center the icon inside the visible bounds rather | 269 // Use GetPreferredSize() to center the icon inside the visible bounds rather |
| 272 // than the whole size() (which may refer to hit test region extended to the | 270 // than the whole size() (which may refer to hit test region extended to the |
| 273 // end of the toolbar in maximized mode). | 271 // end of the toolbar in maximized mode). |
| 274 icon_painter_->Paint(canvas, GetThemeProvider(), | 272 icon_painter_->Paint(canvas, GetThemeProvider(), |
| 275 gfx::Rect(GetPreferredSize()), | 273 gfx::Rect(GetPreferredSize()), |
| 276 AppMenuIconPainter::BEZEL_NONE); | 274 AppMenuIconPainter::BEZEL_NONE); |
| 277 } | 275 } |
| OLD | NEW |