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