| 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/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 void AppMenuButton::AddMenuListener(views::MenuListener* listener) { | 102 void AppMenuButton::AddMenuListener(views::MenuListener* listener) { |
| 103 menu_listeners_.AddObserver(listener); | 103 menu_listeners_.AddObserver(listener); |
| 104 } | 104 } |
| 105 | 105 |
| 106 void AppMenuButton::RemoveMenuListener(views::MenuListener* listener) { | 106 void AppMenuButton::RemoveMenuListener(views::MenuListener* listener) { |
| 107 menu_listeners_.RemoveObserver(listener); | 107 menu_listeners_.RemoveObserver(listener); |
| 108 } | 108 } |
| 109 | 109 |
| 110 gfx::Size AppMenuButton::GetPreferredSize() const { | 110 gfx::Size AppMenuButton::GetPreferredSize() const { |
| 111 gfx::Size size(image()->GetPreferredSize()); | 111 gfx::Size size(image()->GetPreferredSize()); |
| 112 gfx::Insets insets(GetLayoutInsets(TOOLBAR_BUTTON)); | 112 const int pad = GetLayoutConstant(TOOLBAR_BUTTON_PADDING); |
| 113 size.Enlarge(insets.width(), insets.height()); | 113 size.Enlarge(pad * 2, pad * 2); |
| 114 return size; | 114 return size; |
| 115 } | 115 } |
| 116 | 116 |
| 117 void AppMenuButton::UpdateIcon() { | 117 void AppMenuButton::UpdateIcon() { |
| 118 SkColor color = gfx::kPlaceholderColor; | 118 SkColor color = gfx::kPlaceholderColor; |
| 119 const ui::NativeTheme* native_theme = GetNativeTheme(); | 119 const ui::NativeTheme* native_theme = GetNativeTheme(); |
| 120 switch (severity_) { | 120 switch (severity_) { |
| 121 case AppMenuIconController::Severity::NONE: | 121 case AppMenuIconController::Severity::NONE: |
| 122 color = GetThemeProvider()->GetColor( | 122 color = GetThemeProvider()->GetColor( |
| 123 ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON); | 123 ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON); |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 | 226 |
| 227 void AppMenuButton::OnDragExited() { | 227 void AppMenuButton::OnDragExited() { |
| 228 DCHECK(allow_extension_dragging_); | 228 DCHECK(allow_extension_dragging_); |
| 229 weak_factory_.InvalidateWeakPtrs(); | 229 weak_factory_.InvalidateWeakPtrs(); |
| 230 } | 230 } |
| 231 | 231 |
| 232 int AppMenuButton::OnPerformDrop(const ui::DropTargetEvent& event) { | 232 int AppMenuButton::OnPerformDrop(const ui::DropTargetEvent& event) { |
| 233 DCHECK(allow_extension_dragging_); | 233 DCHECK(allow_extension_dragging_); |
| 234 return ui::DragDropTypes::DRAG_MOVE; | 234 return ui::DragDropTypes::DRAG_MOVE; |
| 235 } | 235 } |
| OLD | NEW |