| 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.h" | 5 #include "chrome/browser/ui/views/toolbar/app_menu.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <cmath> | 10 #include <cmath> |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 params.menu_separator.paint_rect = &separator_bounds; | 169 params.menu_separator.paint_rect = &separator_bounds; |
| 170 params.menu_separator.type = ui::VERTICAL_SEPARATOR; | 170 params.menu_separator.type = ui::VERTICAL_SEPARATOR; |
| 171 view->GetNativeTheme()->Paint( | 171 view->GetNativeTheme()->Paint( |
| 172 canvas->sk_canvas(), ui::NativeTheme::kMenuPopupSeparator, | 172 canvas->sk_canvas(), ui::NativeTheme::kMenuPopupSeparator, |
| 173 ui::NativeTheme::kNormal, separator_bounds, params); | 173 ui::NativeTheme::kNormal, separator_bounds, params); |
| 174 bounds.Inset( | 174 bounds.Inset( |
| 175 gfx::Insets(0, MenuConfig::instance().separator_thickness, 0, 0)); | 175 gfx::Insets(0, MenuConfig::instance().separator_thickness, 0, 0)); |
| 176 } | 176 } |
| 177 | 177 |
| 178 // Fill in background for state. | 178 // Fill in background for state. |
| 179 bounds.set_x(view->GetMirroredXForRect(bounds)); | |
| 180 views::Button::ButtonState state = | 179 views::Button::ButtonState state = |
| 181 button ? button->state() : views::Button::STATE_NORMAL; | 180 button ? button->state() : views::Button::STATE_NORMAL; |
| 182 DrawBackground(canvas, view, bounds, state); | 181 DrawBackground(canvas, view, view->GetMirroredRect(bounds), state); |
| 183 } | 182 } |
| 184 | 183 |
| 185 private: | 184 private: |
| 186 static SkColor BackgroundColor(const View* view, | 185 static SkColor BackgroundColor(const View* view, |
| 187 views::Button::ButtonState state) { | 186 views::Button::ButtonState state) { |
| 188 const ui::NativeTheme* theme = view->GetNativeTheme(); | 187 const ui::NativeTheme* theme = view->GetNativeTheme(); |
| 189 switch (state) { | 188 switch (state) { |
| 190 case views::Button::STATE_PRESSED: | 189 case views::Button::STATE_PRESSED: |
| 191 return theme->GetSystemColor( | 190 return theme->GetSystemColor( |
| 192 ui::NativeTheme::kColorId_FocusedMenuItemBackgroundColor); | 191 ui::NativeTheme::kColorId_FocusedMenuItemBackgroundColor); |
| (...skipping 1042 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1235 0, | 1234 0, |
| 1236 BookmarkMenuDelegate::SHOW_PERMANENT_FOLDERS, | 1235 BookmarkMenuDelegate::SHOW_PERMANENT_FOLDERS, |
| 1237 BOOKMARK_LAUNCH_LOCATION_APP_MENU); | 1236 BOOKMARK_LAUNCH_LOCATION_APP_MENU); |
| 1238 } | 1237 } |
| 1239 | 1238 |
| 1240 int AppMenu::ModelIndexFromCommandId(int command_id) const { | 1239 int AppMenu::ModelIndexFromCommandId(int command_id) const { |
| 1241 CommandIDToEntry::const_iterator ix = command_id_to_entry_.find(command_id); | 1240 CommandIDToEntry::const_iterator ix = command_id_to_entry_.find(command_id); |
| 1242 DCHECK(ix != command_id_to_entry_.end()); | 1241 DCHECK(ix != command_id_to_entry_.end()); |
| 1243 return ix->second.second; | 1242 return ix->second.second; |
| 1244 } | 1243 } |
| OLD | NEW |