| 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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 } | 189 } |
| 190 | 190 |
| 191 void AppMenuButton::AddInkDropLayer(ui::Layer* ink_drop_layer) { | 191 void AppMenuButton::AddInkDropLayer(ui::Layer* ink_drop_layer) { |
| 192 image()->SetPaintToLayer(true); | 192 image()->SetPaintToLayer(true); |
| 193 image()->SetFillsBoundsOpaquely(false); | 193 image()->SetFillsBoundsOpaquely(false); |
| 194 views::MenuButton::AddInkDropLayer(ink_drop_layer); | 194 views::MenuButton::AddInkDropLayer(ink_drop_layer); |
| 195 } | 195 } |
| 196 | 196 |
| 197 void AppMenuButton::RemoveInkDropLayer(ui::Layer* ink_drop_layer) { | 197 void AppMenuButton::RemoveInkDropLayer(ui::Layer* ink_drop_layer) { |
| 198 views::MenuButton::RemoveInkDropLayer(ink_drop_layer); | 198 views::MenuButton::RemoveInkDropLayer(ink_drop_layer); |
| 199 image()->SetFillsBoundsOpaquely(true); | |
| 200 image()->SetPaintToLayer(false); | 199 image()->SetPaintToLayer(false); |
| 201 } | 200 } |
| 202 | 201 |
| 203 gfx::Point AppMenuButton::GetInkDropCenter() const { | 202 gfx::Point AppMenuButton::GetInkDropCenter() const { |
| 204 // ToolbarView extends the bounds of the app button to the right in maximized | 203 // ToolbarView extends the bounds of the app button to the right in maximized |
| 205 // mode. So instead of using the center point of local bounds, we use the | 204 // mode. So instead of using the center point of local bounds, we use the |
| 206 // center point (adjusted for RTL layouts) of the preferred size, which | 205 // center point (adjusted for RTL layouts) of the preferred size, which |
| 207 // doesn't change in maximized mode. | 206 // doesn't change in maximized mode. |
| 208 const int visible_width = GetPreferredSize().width(); | 207 const int visible_width = GetPreferredSize().width(); |
| 209 return gfx::Point( | 208 return gfx::Point( |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 views::MenuButton::OnPaint(canvas); | 288 views::MenuButton::OnPaint(canvas); |
| 290 if (ui::MaterialDesignController::IsModeMaterial()) | 289 if (ui::MaterialDesignController::IsModeMaterial()) |
| 291 return; | 290 return; |
| 292 // Use GetPreferredSize() to center the icon inside the visible bounds rather | 291 // Use GetPreferredSize() to center the icon inside the visible bounds rather |
| 293 // than the whole size() (which may refer to hit test region extended to the | 292 // than the whole size() (which may refer to hit test region extended to the |
| 294 // end of the toolbar in maximized mode). | 293 // end of the toolbar in maximized mode). |
| 295 icon_painter_->Paint(canvas, GetThemeProvider(), | 294 icon_painter_->Paint(canvas, GetThemeProvider(), |
| 296 gfx::Rect(GetPreferredSize()), | 295 gfx::Rect(GetPreferredSize()), |
| 297 AppMenuIconPainter::BEZEL_NONE); | 296 AppMenuIconPainter::BEZEL_NONE); |
| 298 } | 297 } |
| OLD | NEW |