| 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/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" | 
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 144       color = gfx::kGoogleGreen700; | 144       color = gfx::kGoogleGreen700; | 
| 145       break; | 145       break; | 
| 146     case AppMenuIconPainter::SEVERITY_MEDIUM: | 146     case AppMenuIconPainter::SEVERITY_MEDIUM: | 
| 147       color = gfx::kGoogleYellow700; | 147       color = gfx::kGoogleYellow700; | 
| 148       break; | 148       break; | 
| 149     case AppMenuIconPainter::SEVERITY_HIGH: | 149     case AppMenuIconPainter::SEVERITY_HIGH: | 
| 150       color = gfx::kGoogleRed700; | 150       color = gfx::kGoogleRed700; | 
| 151       break; | 151       break; | 
| 152   } | 152   } | 
| 153 | 153 | 
| 154   // TODO(estade): find a home for this constant. |  | 
| 155   const int kButtonSize = 16; |  | 
| 156   SetImage(views::Button::STATE_NORMAL, | 154   SetImage(views::Button::STATE_NORMAL, | 
| 157            gfx::CreateVectorIcon(gfx::VectorIconId::BROWSER_TOOLS, kButtonSize, | 155            gfx::CreateVectorIcon(gfx::VectorIconId::BROWSER_TOOLS, color)); | 
| 158                                  color)); |  | 
| 159 } | 156 } | 
| 160 | 157 | 
| 161 void AppMenuButton::SetTrailingMargin(int margin) { | 158 void AppMenuButton::SetTrailingMargin(int margin) { | 
| 162   margin_trailing_ = margin; | 159   margin_trailing_ = margin; | 
| 163 | 160 | 
| 164   UpdateThemedBorder(); | 161   UpdateThemedBorder(); | 
| 165 | 162 | 
| 166   const int inset = LabelButton::kFocusRectInset; | 163   const int inset = LabelButton::kFocusRectInset; | 
| 167   SetFocusPainter(views::Painter::CreateDashedFocusPainterWithInsets( | 164   SetFocusPainter(views::Painter::CreateDashedFocusPainterWithInsets( | 
| 168       gfx::Insets(inset, inset, inset, inset + margin))); | 165       gfx::Insets(inset, inset, inset, inset + margin))); | 
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 247   views::MenuButton::OnPaint(canvas); | 244   views::MenuButton::OnPaint(canvas); | 
| 248   if (ui::MaterialDesignController::IsModeMaterial()) | 245   if (ui::MaterialDesignController::IsModeMaterial()) | 
| 249     return; | 246     return; | 
| 250   // Use GetPreferredSize() to center the icon inside the visible bounds rather | 247   // Use GetPreferredSize() to center the icon inside the visible bounds rather | 
| 251   // than the whole size() (which may refer to hit test region extended to the | 248   // than the whole size() (which may refer to hit test region extended to the | 
| 252   // end of the toolbar in maximized mode). | 249   // end of the toolbar in maximized mode). | 
| 253   icon_painter_->Paint(canvas, GetThemeProvider(), | 250   icon_painter_->Paint(canvas, GetThemeProvider(), | 
| 254                        gfx::Rect(GetPreferredSize()), | 251                        gfx::Rect(GetPreferredSize()), | 
| 255                        AppMenuIconPainter::BEZEL_NONE); | 252                        AppMenuIconPainter::BEZEL_NONE); | 
| 256 } | 253 } | 
| OLD | NEW | 
|---|