| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/wrench_menu.h" | 5 #include "chrome/browser/ui/views/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 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 IDS_PASTE, | 427 IDS_PASTE, |
| 428 menu_->use_new_menu() && menu_->supports_new_separators_ ? | 428 menu_->use_new_menu() && menu_->supports_new_separators_ ? |
| 429 MenuButtonBackground::CENTER_BUTTON : | 429 MenuButtonBackground::CENTER_BUTTON : |
| 430 MenuButtonBackground::RIGHT_BUTTON, | 430 MenuButtonBackground::RIGHT_BUTTON, |
| 431 paste_index, | 431 paste_index, |
| 432 NULL); | 432 NULL); |
| 433 if (menu_->use_new_menu()) { | 433 if (menu_->use_new_menu()) { |
| 434 cut->SetEnabledColor(kTouchButtonText); | 434 cut->SetEnabledColor(kTouchButtonText); |
| 435 copy->SetEnabledColor(kTouchButtonText); | 435 copy->SetEnabledColor(kTouchButtonText); |
| 436 paste->SetEnabledColor(kTouchButtonText); | 436 paste->SetEnabledColor(kTouchButtonText); |
| 437 } else { |
| 438 SkColor text_color = GetNativeTheme()->GetSystemColor( |
| 439 ui::NativeTheme::kColorId_EnabledMenuItemForegroundColor); |
| 440 cut->SetEnabledColor(text_color); |
| 441 copy->SetEnabledColor(text_color); |
| 442 paste->SetEnabledColor(text_color); |
| 437 } | 443 } |
| 438 copy_background->SetOtherButtons(cut, paste); | 444 copy_background->SetOtherButtons(cut, paste); |
| 439 } | 445 } |
| 440 | 446 |
| 441 // Overridden from View. | 447 // Overridden from View. |
| 442 virtual gfx::Size GetPreferredSize() OVERRIDE { | 448 virtual gfx::Size GetPreferredSize() OVERRIDE { |
| 443 // Returned height doesn't matter as MenuItemView forces everything to the | 449 // Returned height doesn't matter as MenuItemView forces everything to the |
| 444 // height of the menuitemview. | 450 // height of the menuitemview. |
| 445 return gfx::Size(GetMaxChildViewPreferredWidth() * child_count(), 0); | 451 return gfx::Size(GetMaxChildViewPreferredWidth() * child_count(), 0); |
| 446 } | 452 } |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 fullscreen_button_ = new FullscreenButton(this); | 537 fullscreen_button_ = new FullscreenButton(this); |
| 532 gfx::ImageSkia* full_screen_image = | 538 gfx::ImageSkia* full_screen_image = |
| 533 ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | 539 ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
| 534 IDR_FULLSCREEN_MENU_BUTTON); | 540 IDR_FULLSCREEN_MENU_BUTTON); |
| 535 fullscreen_button_->SetImage(ImageButton::STATE_NORMAL, full_screen_image); | 541 fullscreen_button_->SetImage(ImageButton::STATE_NORMAL, full_screen_image); |
| 536 if (menu_->use_new_menu()) { | 542 if (menu_->use_new_menu()) { |
| 537 zoom_label_->SetEnabledColor(kTouchButtonText); | 543 zoom_label_->SetEnabledColor(kTouchButtonText); |
| 538 decrement_button_->SetEnabledColor(kTouchButtonText); | 544 decrement_button_->SetEnabledColor(kTouchButtonText); |
| 539 increment_button_->SetEnabledColor(kTouchButtonText); | 545 increment_button_->SetEnabledColor(kTouchButtonText); |
| 540 } else { | 546 } else { |
| 541 zoom_label_->SetEnabledColor(menu_config.text_color); | 547 SkColor enabled_text_color = GetNativeTheme()->GetSystemColor( |
| 548 ui::NativeTheme::kColorId_EnabledMenuItemForegroundColor); |
| 549 zoom_label_->SetEnabledColor(enabled_text_color); |
| 550 decrement_button_->SetEnabledColor(enabled_text_color); |
| 551 increment_button_->SetEnabledColor(enabled_text_color); |
| 552 SkColor disabled_text_color = GetNativeTheme()->GetSystemColor( |
| 553 ui::NativeTheme::kColorId_DisabledMenuItemForegroundColor); |
| 554 decrement_button_->SetDisabledColor(disabled_text_color); |
| 555 increment_button_->SetDisabledColor(disabled_text_color); |
| 542 } | 556 } |
| 543 | 557 |
| 544 fullscreen_button_->set_focusable(true); | 558 fullscreen_button_->set_focusable(true); |
| 545 fullscreen_button_->set_request_focus_on_press(false); | 559 fullscreen_button_->set_request_focus_on_press(false); |
| 546 fullscreen_button_->set_tag(fullscreen_index); | 560 fullscreen_button_->set_tag(fullscreen_index); |
| 547 fullscreen_button_->SetImageAlignment( | 561 fullscreen_button_->SetImageAlignment( |
| 548 ImageButton::ALIGN_CENTER, ImageButton::ALIGN_MIDDLE); | 562 ImageButton::ALIGN_CENTER, ImageButton::ALIGN_MIDDLE); |
| 549 int horizontal_padding = | 563 int horizontal_padding = |
| 550 menu_->use_new_menu() ? kHorizontalTouchPadding : kHorizontalPadding; | 564 menu_->use_new_menu() ? kHorizontalTouchPadding : kHorizontalPadding; |
| 551 fullscreen_button_->set_border(views::Border::CreateEmptyBorder( | 565 fullscreen_button_->set_border(views::Border::CreateEmptyBorder( |
| (...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1134 bookmark_menu_delegate_.reset( | 1148 bookmark_menu_delegate_.reset( |
| 1135 new BookmarkMenuDelegate(browser_, | 1149 new BookmarkMenuDelegate(browser_, |
| 1136 browser_, | 1150 browser_, |
| 1137 parent, | 1151 parent, |
| 1138 first_bookmark_command_id_)); | 1152 first_bookmark_command_id_)); |
| 1139 bookmark_menu_delegate_->Init( | 1153 bookmark_menu_delegate_->Init( |
| 1140 this, bookmark_menu_, model->bookmark_bar_node(), 0, | 1154 this, bookmark_menu_, model->bookmark_bar_node(), 0, |
| 1141 BookmarkMenuDelegate::SHOW_PERMANENT_FOLDERS, | 1155 BookmarkMenuDelegate::SHOW_PERMANENT_FOLDERS, |
| 1142 bookmark_utils::LAUNCH_WRENCH_MENU); | 1156 bookmark_utils::LAUNCH_WRENCH_MENU); |
| 1143 } | 1157 } |
| OLD | NEW |