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/toolbar/wrench_menu_model.h" | 5 #include "chrome/browser/ui/toolbar/wrench_menu_model.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 | 537 |
538 if (extensions::FeatureSwitch::extension_action_redesign()->IsEnabled()) | 538 if (extensions::FeatureSwitch::extension_action_redesign()->IsEnabled()) |
539 CreateExtensionToolbarOverflowMenu(); | 539 CreateExtensionToolbarOverflowMenu(); |
540 | 540 |
541 AddItemWithStringId(IDC_NEW_TAB, IDS_NEW_TAB); | 541 AddItemWithStringId(IDC_NEW_TAB, IDS_NEW_TAB); |
542 AddItemWithStringId(IDC_NEW_WINDOW, IDS_NEW_WINDOW); | 542 AddItemWithStringId(IDC_NEW_WINDOW, IDS_NEW_WINDOW); |
543 | 543 |
544 if (ShouldShowNewIncognitoWindowMenuItem()) | 544 if (ShouldShowNewIncognitoWindowMenuItem()) |
545 AddItemWithStringId(IDC_NEW_INCOGNITO_WINDOW, IDS_NEW_INCOGNITO_WINDOW); | 545 AddItemWithStringId(IDC_NEW_INCOGNITO_WINDOW, IDS_NEW_INCOGNITO_WINDOW); |
546 | 546 |
547 #if defined(OS_WIN) && !defined(NDEBUG) && defined(USE_ASH) | |
548 if (base::win::GetVersion() < base::win::VERSION_WIN8 && | |
549 chrome::HOST_DESKTOP_TYPE_NATIVE != chrome::HOST_DESKTOP_TYPE_ASH) { | |
550 AddItemWithStringId(IDC_TOGGLE_ASH_DESKTOP, | |
551 ash::Shell::HasInstance() ? IDS_CLOSE_ASH_DESKTOP : | |
552 IDS_OPEN_ASH_DESKTOP); | |
553 } | |
554 #endif | |
555 | |
556 bookmark_sub_menu_model_.reset(new BookmarkSubMenuModel(this, browser_)); | 547 bookmark_sub_menu_model_.reset(new BookmarkSubMenuModel(this, browser_)); |
557 AddSubMenuWithStringId(IDC_BOOKMARKS_MENU, IDS_BOOKMARKS_MENU, | 548 AddSubMenuWithStringId(IDC_BOOKMARKS_MENU, IDS_BOOKMARKS_MENU, |
558 bookmark_sub_menu_model_.get()); | 549 bookmark_sub_menu_model_.get()); |
559 | 550 |
560 if (!browser_->profile()->IsOffTheRecord()) { | 551 if (!browser_->profile()->IsOffTheRecord()) { |
561 recent_tabs_sub_menu_model_.reset(new RecentTabsSubMenuModel(provider_, | 552 recent_tabs_sub_menu_model_.reset(new RecentTabsSubMenuModel(provider_, |
562 browser_, | 553 browser_, |
563 NULL)); | 554 NULL)); |
564 AddSubMenuWithStringId(IDC_RECENT_TABS_MENU, IDS_RECENT_TABS_MENU, | 555 AddSubMenuWithStringId(IDC_RECENT_TABS_MENU, IDS_RECENT_TABS_MENU, |
565 recent_tabs_sub_menu_model_.get()); | 556 recent_tabs_sub_menu_model_.get()); |
566 } | 557 } |
567 | 558 |
568 #if defined(OS_WIN) | 559 #if defined(OS_WIN) |
569 | 560 if (base::win::GetVersion() >= base::win::VERSION_WIN7 && |
570 #if defined(USE_AURA) | 561 content::GpuDataManager::GetInstance()->CanUseGpuBrowserCompositor()) { |
571 if (base::win::GetVersion() >= base::win::VERSION_WIN8 && | |
572 content::GpuDataManager::GetInstance()->CanUseGpuBrowserCompositor()) { | |
573 if (browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH) { | 562 if (browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH) { |
574 // Metro mode, add the 'Relaunch Chrome in desktop mode'. | 563 // ASH/Metro mode, add the 'Relaunch Chrome in desktop mode'. |
575 AddSeparator(ui::NORMAL_SEPARATOR); | 564 AddSeparator(ui::NORMAL_SEPARATOR); |
576 AddItemWithStringId(IDC_WIN8_DESKTOP_RESTART, IDS_WIN8_DESKTOP_RESTART); | 565 AddItemWithStringId(IDC_WIN_DESKTOP_RESTART, IDS_WIN_DESKTOP_RESTART); |
577 } else { | 566 } else { |
578 // In Windows 8 desktop, add the 'Relaunch Chrome in Windows 8 mode'. | 567 // In Windows 8 desktop, add the 'Relaunch Chrome in Windows 8 mode'. |
| 568 // In Windows 7 desktop, add the 'Relaunch Chrome in Windows ASH mode' |
579 AddSeparator(ui::NORMAL_SEPARATOR); | 569 AddSeparator(ui::NORMAL_SEPARATOR); |
580 AddItemWithStringId(IDC_WIN8_METRO_RESTART, IDS_WIN8_METRO_RESTART); | 570 if (base::win::GetVersion() >= base::win::VERSION_WIN8) { |
| 571 AddItemWithStringId(IDC_WIN8_METRO_RESTART, IDS_WIN8_METRO_RESTART); |
| 572 } else { |
| 573 AddItemWithStringId(IDC_WIN_CHROMEOS_RESTART, IDS_WIN_CHROMEOS_RESTART); |
| 574 } |
581 } | 575 } |
582 } | 576 } |
583 #else | |
584 if (base::win::IsMetroProcess()) { | |
585 // Metro mode, add the 'Relaunch Chrome in desktop mode'. | |
586 AddSeparator(ui::NORMAL_SEPARATOR); | |
587 AddItemWithStringId(IDC_WIN8_DESKTOP_RESTART, IDS_WIN8_DESKTOP_RESTART); | |
588 } else { | |
589 // In Windows 8 desktop, add the 'Relaunch Chrome in Windows 8 mode'. | |
590 AddSeparator(ui::NORMAL_SEPARATOR); | |
591 AddItemWithStringId(IDC_WIN8_METRO_RESTART, IDS_WIN8_METRO_RESTART); | |
592 } | |
593 #endif | 577 #endif |
594 | 578 |
595 #endif | |
596 | |
597 // Append the full menu including separators. The final separator only gets | 579 // Append the full menu including separators. The final separator only gets |
598 // appended when this is a touch menu - otherwise it would get added twice. | 580 // appended when this is a touch menu - otherwise it would get added twice. |
599 CreateCutCopyPasteMenu(); | 581 CreateCutCopyPasteMenu(); |
600 | 582 |
601 if (CommandLine::ForCurrentProcess()->HasSwitch( | 583 if (CommandLine::ForCurrentProcess()->HasSwitch( |
602 switches::kEnableDomDistiller)) { | 584 switches::kEnableDomDistiller)) { |
603 AddItemWithStringId(IDC_DISTILL_PAGE, IDS_DISTILL_PAGE); | 585 AddItemWithStringId(IDC_DISTILL_PAGE, IDS_DISTILL_PAGE); |
604 } | 586 } |
605 | 587 |
606 AddItemWithStringId(IDC_SAVE_PAGE, IDS_SAVE_PAGE); | 588 AddItemWithStringId(IDC_SAVE_PAGE, IDS_SAVE_PAGE); |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
794 ->GetZoomPercent(); | 776 ->GetZoomPercent(); |
795 } | 777 } |
796 zoom_label_ = l10n_util::GetStringFUTF16( | 778 zoom_label_ = l10n_util::GetStringFUTF16( |
797 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent)); | 779 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent)); |
798 } | 780 } |
799 | 781 |
800 void WrenchMenuModel::OnZoomLevelChanged( | 782 void WrenchMenuModel::OnZoomLevelChanged( |
801 const content::HostZoomMap::ZoomLevelChange& change) { | 783 const content::HostZoomMap::ZoomLevelChange& change) { |
802 UpdateZoomControls(); | 784 UpdateZoomControls(); |
803 } | 785 } |
OLD | NEW |