| 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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 const int inset = LabelButton::kFocusRectInset; | 166 const int inset = LabelButton::kFocusRectInset; |
| 167 SetFocusPainter(views::Painter::CreateDashedFocusPainterWithInsets( | 167 SetFocusPainter(views::Painter::CreateDashedFocusPainterWithInsets( |
| 168 gfx::Insets(inset, inset, inset, inset + margin))); | 168 gfx::Insets(inset, inset, inset, inset + margin))); |
| 169 InvalidateLayout(); | 169 InvalidateLayout(); |
| 170 } | 170 } |
| 171 | 171 |
| 172 const char* AppMenuButton::GetClassName() const { | 172 const char* AppMenuButton::GetClassName() const { |
| 173 return "AppMenuButton"; | 173 return "AppMenuButton"; |
| 174 } | 174 } |
| 175 | 175 |
| 176 scoped_ptr<views::LabelButtonBorder> AppMenuButton::CreateDefaultBorder() | 176 std::unique_ptr<views::LabelButtonBorder> AppMenuButton::CreateDefaultBorder() |
| 177 const { | 177 const { |
| 178 scoped_ptr<views::LabelButtonBorder> border = | 178 std::unique_ptr<views::LabelButtonBorder> border = |
| 179 MenuButton::CreateDefaultBorder(); | 179 MenuButton::CreateDefaultBorder(); |
| 180 | 180 |
| 181 // Adjust border insets to follow the margin change, | 181 // Adjust border insets to follow the margin change, |
| 182 // which will be reflected in where the border is painted | 182 // which will be reflected in where the border is painted |
| 183 // through GetThemePaintRect(). | 183 // through GetThemePaintRect(). |
| 184 gfx::Insets insets(border->GetInsets()); | 184 gfx::Insets insets(border->GetInsets()); |
| 185 insets += gfx::Insets(0, 0, 0, margin_trailing_); | 185 insets += gfx::Insets(0, 0, 0, margin_trailing_); |
| 186 border->set_insets(insets); | 186 border->set_insets(insets); |
| 187 | 187 |
| 188 return border; | 188 return border; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 views::MenuButton::OnPaint(canvas); | 247 views::MenuButton::OnPaint(canvas); |
| 248 if (ui::MaterialDesignController::IsModeMaterial()) | 248 if (ui::MaterialDesignController::IsModeMaterial()) |
| 249 return; | 249 return; |
| 250 // Use GetPreferredSize() to center the icon inside the visible bounds rather | 250 // 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 | 251 // than the whole size() (which may refer to hit test region extended to the |
| 252 // end of the toolbar in maximized mode). | 252 // end of the toolbar in maximized mode). |
| 253 icon_painter_->Paint(canvas, GetThemeProvider(), | 253 icon_painter_->Paint(canvas, GetThemeProvider(), |
| 254 gfx::Rect(GetPreferredSize()), | 254 gfx::Rect(GetPreferredSize()), |
| 255 AppMenuIconPainter::BEZEL_NONE); | 255 AppMenuIconPainter::BEZEL_NONE); |
| 256 } | 256 } |
| OLD | NEW |