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

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

Issue 869453002: Define class names for views class in c/b/ui/views (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: addressed comments Created 5 years, 11 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/wrench_toolbar_button.h" 5 #include "chrome/browser/ui/views/toolbar/wrench_toolbar_button.h"
6 6
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "base/time/time.h" 8 #include "base/time/time.h"
9 #include "chrome/browser/ui/browser.h" 9 #include "chrome/browser/ui/browser.h"
10 #include "chrome/browser/ui/views/extensions/browser_action_drag_data.h" 10 #include "chrome/browser/ui/views/extensions/browser_action_drag_data.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 } 51 }
52 SetBorder(border.Pass()); 52 SetBorder(border.Pass());
53 SchedulePaint(); 53 SchedulePaint();
54 } 54 }
55 55
56 gfx::Size WrenchToolbarButton::GetPreferredSize() const { 56 gfx::Size WrenchToolbarButton::GetPreferredSize() const {
57 return ResourceBundle::GetSharedInstance(). 57 return ResourceBundle::GetSharedInstance().
58 GetImageSkiaNamed(IDR_TOOLBAR_BEZEL_HOVER)->size(); 58 GetImageSkiaNamed(IDR_TOOLBAR_BEZEL_HOVER)->size();
59 } 59 }
60 60
61 void WrenchToolbarButton::OnPaint(gfx::Canvas* canvas) {
62 views::MenuButton::OnPaint(canvas);
63 wrench_icon_painter_->Paint(canvas,
64 GetThemeProvider(),
65 gfx::Rect(size()),
66 WrenchIconPainter::BEZEL_NONE);
67 }
68
69 void WrenchToolbarButton::ScheduleWrenchIconPaint() { 61 void WrenchToolbarButton::ScheduleWrenchIconPaint() {
70 SchedulePaint(); 62 SchedulePaint();
71 } 63 }
72 64
65 const char* WrenchToolbarButton::GetClassName() const {
66 return "WrenchToolbarButton";
67 }
68
73 bool WrenchToolbarButton::GetDropFormats( 69 bool WrenchToolbarButton::GetDropFormats(
74 int* formats, std::set<ui::OSExchangeData::CustomFormat>* custom_formats) { 70 int* formats, std::set<ui::OSExchangeData::CustomFormat>* custom_formats) {
75 return allow_extension_dragging_ ? 71 return allow_extension_dragging_ ?
76 BrowserActionDragData::GetDropFormats(custom_formats) : 72 BrowserActionDragData::GetDropFormats(custom_formats) :
77 views::View::GetDropFormats(formats, custom_formats); 73 views::View::GetDropFormats(formats, custom_formats);
78 } 74 }
79 bool WrenchToolbarButton::AreDropTypesRequired() { 75 bool WrenchToolbarButton::AreDropTypesRequired() {
80 return allow_extension_dragging_ ? 76 return allow_extension_dragging_ ?
81 BrowserActionDragData::AreDropTypesRequired() : 77 BrowserActionDragData::AreDropTypesRequired() :
82 views::View::AreDropTypesRequired(); 78 views::View::AreDropTypesRequired();
(...skipping 27 matching lines...) Expand all
110 void WrenchToolbarButton::OnDragExited() { 106 void WrenchToolbarButton::OnDragExited() {
111 DCHECK(allow_extension_dragging_); 107 DCHECK(allow_extension_dragging_);
112 weak_factory_.InvalidateWeakPtrs(); 108 weak_factory_.InvalidateWeakPtrs();
113 } 109 }
114 110
115 int WrenchToolbarButton::OnPerformDrop(const ui::DropTargetEvent& event) { 111 int WrenchToolbarButton::OnPerformDrop(const ui::DropTargetEvent& event) {
116 DCHECK(allow_extension_dragging_); 112 DCHECK(allow_extension_dragging_);
117 return ui::DragDropTypes::DRAG_MOVE; 113 return ui::DragDropTypes::DRAG_MOVE;
118 } 114 }
119 115
116 void WrenchToolbarButton::OnPaint(gfx::Canvas* canvas) {
117 views::MenuButton::OnPaint(canvas);
118 wrench_icon_painter_->Paint(canvas,
119 GetThemeProvider(),
120 gfx::Rect(size()),
121 WrenchIconPainter::BEZEL_NONE);
122 }
123
120 void WrenchToolbarButton::ShowOverflowMenu() { 124 void WrenchToolbarButton::ShowOverflowMenu() {
121 toolbar_view_->ShowAppMenu(true); // For drop. 125 toolbar_view_->ShowAppMenu(true); // For drop.
122 } 126 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698