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/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" |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 scoped_ptr<views::LabelButtonBorder> border = | 224 scoped_ptr<views::LabelButtonBorder> border = |
225 MenuButton::CreateDefaultBorder(); | 225 MenuButton::CreateDefaultBorder(); |
226 | 226 |
227 // Adjust border insets to follow the margin change, | 227 // Adjust border insets to follow the margin change, |
228 // which will be reflected in where the border is painted | 228 // which will be reflected in where the border is painted |
229 // through GetThemePaintRect(). | 229 // through GetThemePaintRect(). |
230 gfx::Insets insets(border->GetInsets()); | 230 gfx::Insets insets(border->GetInsets()); |
231 insets += gfx::Insets(0, 0, 0, margin_trailing_); | 231 insets += gfx::Insets(0, 0, 0, margin_trailing_); |
232 border->set_insets(insets); | 232 border->set_insets(insets); |
233 | 233 |
234 return border.Pass(); | 234 return border; |
235 } | 235 } |
236 | 236 |
237 gfx::Rect AppMenuButton::GetThemePaintRect() const { | 237 gfx::Rect AppMenuButton::GetThemePaintRect() const { |
238 gfx::Rect rect(MenuButton::GetThemePaintRect()); | 238 gfx::Rect rect(MenuButton::GetThemePaintRect()); |
239 rect.Inset(0, 0, margin_trailing_, 0); | 239 rect.Inset(0, 0, margin_trailing_, 0); |
240 return rect; | 240 return rect; |
241 } | 241 } |
242 | 242 |
243 bool AppMenuButton::GetDropFormats( | 243 bool AppMenuButton::GetDropFormats( |
244 int* formats, | 244 int* formats, |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 views::MenuButton::OnPaint(canvas); | 293 views::MenuButton::OnPaint(canvas); |
294 if (ui::MaterialDesignController::IsModeMaterial()) | 294 if (ui::MaterialDesignController::IsModeMaterial()) |
295 return; | 295 return; |
296 // Use GetPreferredSize() to center the icon inside the visible bounds rather | 296 // Use GetPreferredSize() to center the icon inside the visible bounds rather |
297 // than the whole size() (which may refer to hit test region extended to the | 297 // than the whole size() (which may refer to hit test region extended to the |
298 // end of the toolbar in maximized mode). | 298 // end of the toolbar in maximized mode). |
299 icon_painter_->Paint(canvas, GetThemeProvider(), | 299 icon_painter_->Paint(canvas, GetThemeProvider(), |
300 gfx::Rect(GetPreferredSize()), | 300 gfx::Rect(GetPreferredSize()), |
301 AppMenuIconPainter::BEZEL_NONE); | 301 AppMenuIconPainter::BEZEL_NONE); |
302 } | 302 } |
OLD | NEW |