| 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 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 MenuButtonBackground::ButtonType type, | 384 MenuButtonBackground::ButtonType type, |
| 385 int index, | 385 int index, |
| 386 MenuButtonBackground** background, | 386 MenuButtonBackground** background, |
| 387 int acc_string_id) { | 387 int acc_string_id) { |
| 388 // Should only be invoked during construction when |menu_| is valid. | 388 // Should only be invoked during construction when |menu_| is valid. |
| 389 DCHECK(menu_); | 389 DCHECK(menu_); |
| 390 LabelButton* button = new LabelButton(this, gfx::RemoveAcceleratorChar( | 390 LabelButton* button = new LabelButton(this, gfx::RemoveAcceleratorChar( |
| 391 l10n_util::GetStringUTF16(string_id), '&', NULL, NULL)); | 391 l10n_util::GetStringUTF16(string_id), '&', NULL, NULL)); |
| 392 button->SetAccessibleName( | 392 button->SetAccessibleName( |
| 393 GetAccessibleNameForWrenchMenuItem(menu_model_, index, acc_string_id)); | 393 GetAccessibleNameForWrenchMenuItem(menu_model_, index, acc_string_id)); |
| 394 button->set_focusable(true); | 394 button->SetFocusable(true); |
| 395 button->set_request_focus_on_press(false); | 395 button->set_request_focus_on_press(false); |
| 396 button->set_tag(index); | 396 button->set_tag(index); |
| 397 button->SetEnabled(menu_model_->IsEnabledAt(index)); | 397 button->SetEnabled(menu_model_->IsEnabledAt(index)); |
| 398 MenuButtonBackground* bg = | 398 MenuButtonBackground* bg = |
| 399 new MenuButtonBackground(type, menu_->use_new_menu()); | 399 new MenuButtonBackground(type, menu_->use_new_menu()); |
| 400 button->set_background(bg); | 400 button->set_background(bg); |
| 401 const MenuConfig& menu_config = menu_->GetMenuConfig(); | 401 const MenuConfig& menu_config = menu_->GetMenuConfig(); |
| 402 button->SetTextColor(views::Button::STATE_NORMAL, menu_config.text_color); | 402 button->SetTextColor(views::Button::STATE_NORMAL, menu_config.text_color); |
| 403 if (background) | 403 if (background) |
| 404 *background = bg; | 404 *background = bg; |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 657 decrement_button_->SetTextColor(views::Button::STATE_NORMAL, | 657 decrement_button_->SetTextColor(views::Button::STATE_NORMAL, |
| 658 enabled_text_color); | 658 enabled_text_color); |
| 659 increment_button_->SetTextColor(views::Button::STATE_NORMAL, | 659 increment_button_->SetTextColor(views::Button::STATE_NORMAL, |
| 660 enabled_text_color); | 660 enabled_text_color); |
| 661 SkColor disabled_text_color = native_theme->GetSystemColor( | 661 SkColor disabled_text_color = native_theme->GetSystemColor( |
| 662 ui::NativeTheme::kColorId_DisabledMenuItemForegroundColor); | 662 ui::NativeTheme::kColorId_DisabledMenuItemForegroundColor); |
| 663 decrement_button_->SetTextColor(views::Button::STATE_DISABLED, | 663 decrement_button_->SetTextColor(views::Button::STATE_DISABLED, |
| 664 disabled_text_color); | 664 disabled_text_color); |
| 665 increment_button_->SetTextColor(views::Button::STATE_DISABLED, | 665 increment_button_->SetTextColor(views::Button::STATE_DISABLED, |
| 666 disabled_text_color); | 666 disabled_text_color); |
| 667 fullscreen_button_->set_focusable(true); | 667 fullscreen_button_->SetFocusable(true); |
| 668 fullscreen_button_->set_request_focus_on_press(false); | 668 fullscreen_button_->set_request_focus_on_press(false); |
| 669 fullscreen_button_->set_tag(fullscreen_index); | 669 fullscreen_button_->set_tag(fullscreen_index); |
| 670 fullscreen_button_->SetImageAlignment( | 670 fullscreen_button_->SetImageAlignment( |
| 671 ImageButton::ALIGN_CENTER, ImageButton::ALIGN_MIDDLE); | 671 ImageButton::ALIGN_CENTER, ImageButton::ALIGN_MIDDLE); |
| 672 int horizontal_padding = | 672 int horizontal_padding = |
| 673 menu->use_new_menu() ? kHorizontalTouchPadding : kHorizontalPadding; | 673 menu->use_new_menu() ? kHorizontalTouchPadding : kHorizontalPadding; |
| 674 fullscreen_button_->set_border(views::Border::CreateEmptyBorder( | 674 fullscreen_button_->set_border(views::Border::CreateEmptyBorder( |
| 675 0, horizontal_padding, 0, horizontal_padding)); | 675 0, horizontal_padding, 0, horizontal_padding)); |
| 676 fullscreen_button_->set_background( | 676 fullscreen_button_->set_background( |
| 677 new MenuButtonBackground(MenuButtonBackground::SINGLE_BUTTON, | 677 new MenuButtonBackground(MenuButtonBackground::SINGLE_BUTTON, |
| (...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1360 0, | 1360 0, |
| 1361 BookmarkMenuDelegate::SHOW_PERMANENT_FOLDERS, | 1361 BookmarkMenuDelegate::SHOW_PERMANENT_FOLDERS, |
| 1362 BOOKMARK_LAUNCH_LOCATION_WRENCH_MENU); | 1362 BOOKMARK_LAUNCH_LOCATION_WRENCH_MENU); |
| 1363 } | 1363 } |
| 1364 | 1364 |
| 1365 int WrenchMenu::ModelIndexFromCommandId(int command_id) const { | 1365 int WrenchMenu::ModelIndexFromCommandId(int command_id) const { |
| 1366 CommandIDToEntry::const_iterator ix = command_id_to_entry_.find(command_id); | 1366 CommandIDToEntry::const_iterator ix = command_id_to_entry_.find(command_id); |
| 1367 DCHECK(ix != command_id_to_entry_.end()); | 1367 DCHECK(ix != command_id_to_entry_.end()); |
| 1368 return ix->second.second; | 1368 return ix->second.second; |
| 1369 } | 1369 } |
| OLD | NEW |