| 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/toolbar_button.h" | 5 #include "chrome/browser/ui/views/toolbar/toolbar_button.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 ToolbarButton::CreateDefaultBorder() const { | 159 ToolbarButton::CreateDefaultBorder() const { |
| 160 scoped_ptr<views::LabelButtonBorder> border = | 160 scoped_ptr<views::LabelButtonBorder> border = |
| 161 views::LabelButton::CreateDefaultBorder(); | 161 views::LabelButton::CreateDefaultBorder(); |
| 162 | 162 |
| 163 if (ThemeServiceFactory::GetForProfile(profile_)->UsingSystemTheme()) | 163 if (ThemeServiceFactory::GetForProfile(profile_)->UsingSystemTheme()) |
| 164 border->set_insets(GetLayoutInsets(TOOLBAR_BUTTON)); | 164 border->set_insets(GetLayoutInsets(TOOLBAR_BUTTON)); |
| 165 | 165 |
| 166 return border; | 166 return border; |
| 167 } | 167 } |
| 168 | 168 |
| 169 void ToolbarButton::AddInkDropLayer(ui::Layer* ink_drop_layer) { | |
| 170 image()->SetPaintToLayer(true); | |
| 171 image()->SetFillsBoundsOpaquely(false); | |
| 172 views::LabelButton::AddInkDropLayer(ink_drop_layer); | |
| 173 } | |
| 174 | |
| 175 void ToolbarButton::RemoveInkDropLayer(ui::Layer* ink_drop_layer) { | |
| 176 views::LabelButton::RemoveInkDropLayer(ink_drop_layer); | |
| 177 image()->SetPaintToLayer(false); | |
| 178 } | |
| 179 | |
| 180 void ToolbarButton::ShowContextMenuForView(View* source, | 169 void ToolbarButton::ShowContextMenuForView(View* source, |
| 181 const gfx::Point& point, | 170 const gfx::Point& point, |
| 182 ui::MenuSourceType source_type) { | 171 ui::MenuSourceType source_type) { |
| 183 if (!enabled()) | 172 if (!enabled()) |
| 184 return; | 173 return; |
| 185 | 174 |
| 186 show_menu_factory_.InvalidateWeakPtrs(); | 175 show_menu_factory_.InvalidateWeakPtrs(); |
| 187 ShowDropDownMenu(source_type); | 176 ShowDropDownMenu(source_type); |
| 188 } | 177 } |
| 189 | 178 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 SetMouseHandler(nullptr); | 255 SetMouseHandler(nullptr); |
| 267 | 256 |
| 268 // Set the state back to normal after the drop down menu is closed. | 257 // Set the state back to normal after the drop down menu is closed. |
| 269 if (state() != STATE_DISABLED) | 258 if (state() != STATE_DISABLED) |
| 270 SetState(STATE_NORMAL); | 259 SetState(STATE_NORMAL); |
| 271 } | 260 } |
| 272 | 261 |
| 273 const char* ToolbarButton::GetClassName() const { | 262 const char* ToolbarButton::GetClassName() const { |
| 274 return "ToolbarButton"; | 263 return "ToolbarButton"; |
| 275 } | 264 } |
| OLD | NEW |