Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(629)

Side by Side Diff: chrome/browser/ui/views/toolbar/app_menu_button.cc

Issue 2041033002: Moved ButtonInkDropDelegate logic into InkDropHostView and deleted InkDropDelegates. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed merge conflict in custom_button.cc Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "base/time/time.h" 11 #include "base/time/time.h"
12 #include "chrome/browser/themes/theme_properties.h" 12 #include "chrome/browser/themes/theme_properties.h"
13 #include "chrome/browser/ui/browser.h" 13 #include "chrome/browser/ui/browser.h"
14 #include "chrome/browser/ui/browser_otr_state.h" 14 #include "chrome/browser/ui/browser_otr_state.h"
15 #include "chrome/browser/ui/layout_constants.h" 15 #include "chrome/browser/ui/layout_constants.h"
16 #include "chrome/browser/ui/toolbar/app_menu_model.h" 16 #include "chrome/browser/ui/toolbar/app_menu_model.h"
17 #include "chrome/browser/ui/views/extensions/browser_action_drag_data.h" 17 #include "chrome/browser/ui/views/extensions/browser_action_drag_data.h"
18 #include "chrome/browser/ui/views/toolbar/app_menu.h" 18 #include "chrome/browser/ui/views/toolbar/app_menu.h"
19 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" 19 #include "chrome/browser/ui/views/toolbar/toolbar_view.h"
20 #include "extensions/common/feature_switch.h" 20 #include "extensions/common/feature_switch.h"
21 #include "grit/theme_resources.h" 21 #include "grit/theme_resources.h"
22 #include "ui/base/material_design/material_design_controller.h" 22 #include "ui/base/material_design/material_design_controller.h"
23 #include "ui/base/resource/resource_bundle.h" 23 #include "ui/base/resource/resource_bundle.h"
24 #include "ui/base/theme_provider.h" 24 #include "ui/base/theme_provider.h"
25 #include "ui/gfx/color_palette.h" 25 #include "ui/gfx/color_palette.h"
26 #include "ui/gfx/paint_vector_icon.h" 26 #include "ui/gfx/paint_vector_icon.h"
27 #include "ui/gfx/vector_icons_public.h" 27 #include "ui/gfx/vector_icons_public.h"
28 #include "ui/keyboard/keyboard_controller.h" 28 #include "ui/keyboard/keyboard_controller.h"
29 #include "ui/views/animation/button_ink_drop_delegate.h"
30 #include "ui/views/controls/button/label_button_border.h" 29 #include "ui/views/controls/button/label_button_border.h"
31 #include "ui/views/controls/menu/menu_listener.h" 30 #include "ui/views/controls/menu/menu_listener.h"
32 #include "ui/views/metrics.h" 31 #include "ui/views/metrics.h"
33 #include "ui/views/painter.h" 32 #include "ui/views/painter.h"
34 33
35 // static 34 // static
36 bool AppMenuButton::g_open_app_immediately_for_testing = false; 35 bool AppMenuButton::g_open_app_immediately_for_testing = false;
37 36
38 AppMenuButton::AppMenuButton(ToolbarView* toolbar_view) 37 AppMenuButton::AppMenuButton(ToolbarView* toolbar_view)
39 : views::MenuButton(base::string16(), toolbar_view, false), 38 : views::MenuButton(base::string16(), toolbar_view, false),
40 severity_(AppMenuIconPainter::SEVERITY_NONE), 39 severity_(AppMenuIconPainter::SEVERITY_NONE),
41 type_(AppMenuBadgeController::BadgeType::NONE), 40 type_(AppMenuBadgeController::BadgeType::NONE),
42 toolbar_view_(toolbar_view), 41 toolbar_view_(toolbar_view),
43 allow_extension_dragging_( 42 allow_extension_dragging_(
44 extensions::FeatureSwitch::extension_action_redesign()->IsEnabled()), 43 extensions::FeatureSwitch::extension_action_redesign()->IsEnabled()),
45 margin_trailing_(0), 44 margin_trailing_(0),
46 weak_factory_(this) { 45 weak_factory_(this) {
47 set_ink_drop_delegate( 46 SetHasInkDrop(true);
48 base::WrapUnique(new views::ButtonInkDropDelegate(this, this)));
49 if (!ui::MaterialDesignController::IsModeMaterial()) 47 if (!ui::MaterialDesignController::IsModeMaterial())
50 icon_painter_.reset(new AppMenuIconPainter(this)); 48 icon_painter_.reset(new AppMenuIconPainter(this));
51 } 49 }
52 50
53 AppMenuButton::~AppMenuButton() {} 51 AppMenuButton::~AppMenuButton() {}
54 52
55 void AppMenuButton::SetSeverity(AppMenuBadgeController::BadgeType type, 53 void AppMenuButton::SetSeverity(AppMenuBadgeController::BadgeType type,
56 AppMenuIconPainter::Severity severity, 54 AppMenuIconPainter::Severity severity,
57 bool animate) { 55 bool animate) {
58 if (ui::MaterialDesignController::IsModeMaterial()) { 56 if (ui::MaterialDesignController::IsModeMaterial()) {
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 views::MenuButton::OnPaint(canvas); 265 views::MenuButton::OnPaint(canvas);
268 if (ui::MaterialDesignController::IsModeMaterial()) 266 if (ui::MaterialDesignController::IsModeMaterial())
269 return; 267 return;
270 // Use GetPreferredSize() to center the icon inside the visible bounds rather 268 // Use GetPreferredSize() to center the icon inside the visible bounds rather
271 // than the whole size() (which may refer to hit test region extended to the 269 // than the whole size() (which may refer to hit test region extended to the
272 // end of the toolbar in maximized mode). 270 // end of the toolbar in maximized mode).
273 icon_painter_->Paint(canvas, GetThemeProvider(), 271 icon_painter_->Paint(canvas, GetThemeProvider(),
274 gfx::Rect(GetPreferredSize()), 272 gfx::Rect(GetPreferredSize()),
275 AppMenuIconPainter::BEZEL_NONE); 273 AppMenuIconPainter::BEZEL_NONE);
276 } 274 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698