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/wrench_menu.h" | 5 #include "chrome/browser/ui/views/toolbar/wrench_menu.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
180 } | 180 } |
181 } | 181 } |
182 | 182 |
183 // Overridden from views::Background. | 183 // Overridden from views::Background. |
184 virtual void Paint(gfx::Canvas* canvas, View* view) const OVERRIDE { | 184 virtual void Paint(gfx::Canvas* canvas, View* view) const OVERRIDE { |
185 CustomButton* button = CustomButton::AsCustomButton(view); | 185 CustomButton* button = CustomButton::AsCustomButton(view); |
186 views::Button::ButtonState state = | 186 views::Button::ButtonState state = |
187 button ? button->state() : views::Button::STATE_NORMAL; | 187 button ? button->state() : views::Button::STATE_NORMAL; |
188 int w = view->width(); | 188 int w = view->width(); |
189 int h = view->height(); | 189 int h = view->height(); |
190 #if defined(USE_AURA) | 190 #if defined(USE_AURA) |
sky
2014/03/05 15:28:34
nit: you can remove this ifdef too.
varkha
2014/03/05 15:57:38
Done.
| |
191 // Normal buttons get a border drawn on the right side and the rest gets | |
192 // filled in. The left button however does not get a line to combine | |
193 // buttons. | |
194 int border = 0; | |
195 if (type_ != RIGHT_BUTTON) { | |
196 border = 1; | |
197 canvas->FillRect(gfx::Rect(0, 0, border, h), | |
198 BorderColor(view, views::Button::STATE_NORMAL)); | |
199 } | |
200 if (use_new_menu_) { | 191 if (use_new_menu_) { |
sky
2014/03/05 15:28:34
view->GetNativeTheme() == ui::NativeThemeAura::ins
varkha
2014/03/05 15:57:38
Code in https://code.google.com/p/chromium/codesea
| |
192 // Normal buttons get a border drawn on the right side and the rest gets | |
193 // filled in. The left button however does not get a line to combine | |
194 // buttons. | |
195 if (type_ != RIGHT_BUTTON) { | |
196 canvas->FillRect(gfx::Rect(0, 0, 1, h), | |
197 BorderColor(view, views::Button::STATE_NORMAL)); | |
198 } | |
201 gfx::Rect bounds(view->GetLocalBounds()); | 199 gfx::Rect bounds(view->GetLocalBounds()); |
202 bounds.set_x(view->GetMirroredXForRect(bounds)); | 200 bounds.set_x(view->GetMirroredXForRect(bounds)); |
203 DrawBackground(canvas, view, bounds, state); | 201 DrawBackground(canvas, view, bounds, state); |
204 return; | 202 return; |
205 } | 203 } |
206 #endif | 204 #endif |
207 const SkColor border_color = BorderColor(view, state); | 205 const SkColor border_color = BorderColor(view, state); |
208 switch (TypeAdjustedForRTL()) { | 206 switch (TypeAdjustedForRTL()) { |
209 // TODO(pkasting): Why don't all the following use SkPaths with rounded | 207 // TODO(pkasting): Why don't all the following use SkPaths with rounded |
210 // corners? | 208 // corners? |
(...skipping 1155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1366 0, | 1364 0, |
1367 BookmarkMenuDelegate::SHOW_PERMANENT_FOLDERS, | 1365 BookmarkMenuDelegate::SHOW_PERMANENT_FOLDERS, |
1368 BOOKMARK_LAUNCH_LOCATION_WRENCH_MENU); | 1366 BOOKMARK_LAUNCH_LOCATION_WRENCH_MENU); |
1369 } | 1367 } |
1370 | 1368 |
1371 int WrenchMenu::ModelIndexFromCommandId(int command_id) const { | 1369 int WrenchMenu::ModelIndexFromCommandId(int command_id) const { |
1372 CommandIDToEntry::const_iterator ix = command_id_to_entry_.find(command_id); | 1370 CommandIDToEntry::const_iterator ix = command_id_to_entry_.find(command_id); |
1373 DCHECK(ix != command_id_to_entry_.end()); | 1371 DCHECK(ix != command_id_to_entry_.end()); |
1374 return ix->second.second; | 1372 return ix->second.second; |
1375 } | 1373 } |
OLD | NEW |