| 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/app_menu_model.h" | 5 #include "chrome/browser/ui/toolbar/app_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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 #include "content/public/browser/notification_source.h" | 61 #include "content/public/browser/notification_source.h" |
| 62 #include "content/public/browser/notification_types.h" | 62 #include "content/public/browser/notification_types.h" |
| 63 #include "content/public/browser/web_contents.h" | 63 #include "content/public/browser/web_contents.h" |
| 64 #include "ui/base/l10n/l10n_util.h" | 64 #include "ui/base/l10n/l10n_util.h" |
| 65 #include "ui/base/layout.h" | 65 #include "ui/base/layout.h" |
| 66 #include "ui/base/models/button_menu_item_model.h" | 66 #include "ui/base/models/button_menu_item_model.h" |
| 67 #include "ui/base/resource/resource_bundle.h" | 67 #include "ui/base/resource/resource_bundle.h" |
| 68 #include "ui/gfx/image/image.h" | 68 #include "ui/gfx/image/image.h" |
| 69 #include "ui/gfx/image/image_skia.h" | 69 #include "ui/gfx/image/image_skia.h" |
| 70 | 70 |
| 71 #if defined(GOOGLE_CHROME_BUILD) |
| 72 #include "base/feature_list.h" |
| 73 #endif |
| 74 |
| 71 #if defined(OS_CHROMEOS) | 75 #if defined(OS_CHROMEOS) |
| 72 #include "chromeos/chromeos_switches.h" | 76 #include "chromeos/chromeos_switches.h" |
| 73 #endif | 77 #endif |
| 74 | 78 |
| 75 #if defined(OS_WIN) | 79 #if defined(OS_WIN) |
| 76 #include "base/win/shortcut.h" | 80 #include "base/win/shortcut.h" |
| 77 #include "base/win/windows_version.h" | 81 #include "base/win/windows_version.h" |
| 78 #include "chrome/browser/win/enumerate_modules_model.h" | 82 #include "chrome/browser/win/enumerate_modules_model.h" |
| 79 #include "content/public/browser/gpu_data_manager.h" | 83 #include "content/public/browser/gpu_data_manager.h" |
| 80 #endif | 84 #endif |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 AddItemWithStringId(IDC_ZOOM_PLUS, IDS_ZOOM_PLUS); | 126 AddItemWithStringId(IDC_ZOOM_PLUS, IDS_ZOOM_PLUS); |
| 123 AddItemWithStringId(IDC_ZOOM_NORMAL, IDS_ZOOM_NORMAL); | 127 AddItemWithStringId(IDC_ZOOM_NORMAL, IDS_ZOOM_NORMAL); |
| 124 AddItemWithStringId(IDC_ZOOM_MINUS, IDS_ZOOM_MINUS); | 128 AddItemWithStringId(IDC_ZOOM_MINUS, IDS_ZOOM_MINUS); |
| 125 } | 129 } |
| 126 | 130 |
| 127 //////////////////////////////////////////////////////////////////////////////// | 131 //////////////////////////////////////////////////////////////////////////////// |
| 128 // HelpMenuModel | 132 // HelpMenuModel |
| 129 | 133 |
| 130 #if defined(GOOGLE_CHROME_BUILD) | 134 #if defined(GOOGLE_CHROME_BUILD) |
| 131 | 135 |
| 136 const base::Feature kIncludeBetaForumMenuItem{ |
| 137 "IncludeBetaForumMenuItem", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 138 |
| 132 class AppMenuModel::HelpMenuModel : public ui::SimpleMenuModel { | 139 class AppMenuModel::HelpMenuModel : public ui::SimpleMenuModel { |
| 133 public: | 140 public: |
| 134 HelpMenuModel(ui::SimpleMenuModel::Delegate* delegate, | 141 HelpMenuModel(ui::SimpleMenuModel::Delegate* delegate, |
| 135 Browser* browser) | 142 Browser* browser) |
| 136 : SimpleMenuModel(delegate) { | 143 : SimpleMenuModel(delegate) { |
| 137 Build(browser); | 144 Build(browser); |
| 138 } | 145 } |
| 139 | 146 |
| 140 private: | 147 private: |
| 141 void Build(Browser* browser) { | 148 void Build(Browser* browser) { |
| 142 #if defined(OS_CHROMEOS) && defined(OFFICIAL_BUILD) | 149 #if defined(OS_CHROMEOS) && defined(OFFICIAL_BUILD) |
| 143 int help_string_id = IDS_GET_HELP; | 150 int help_string_id = IDS_GET_HELP; |
| 144 #else | 151 #else |
| 145 int help_string_id = IDS_HELP_PAGE; | 152 int help_string_id = IDS_HELP_PAGE; |
| 146 #endif | 153 #endif |
| 147 AddItem(IDC_ABOUT, l10n_util::GetStringUTF16(IDS_ABOUT)); | 154 AddItem(IDC_ABOUT, l10n_util::GetStringUTF16(IDS_ABOUT)); |
| 148 AddItemWithStringId(IDC_HELP_PAGE_VIA_MENU, help_string_id); | 155 AddItemWithStringId(IDC_HELP_PAGE_VIA_MENU, help_string_id); |
| 156 if (base::FeatureList::IsEnabled(kIncludeBetaForumMenuItem)) |
| 157 AddItem(IDC_SHOW_BETA_FORUM, l10n_util::GetStringUTF16(IDS_BETA_FORUM)); |
| 149 if (browser_defaults::kShowHelpMenuItemIcon) { | 158 if (browser_defaults::kShowHelpMenuItemIcon) { |
| 150 ui::ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 159 ui::ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 151 SetIcon(GetIndexOfCommandId(IDC_HELP_PAGE_VIA_MENU), | 160 SetIcon(GetIndexOfCommandId(IDC_HELP_PAGE_VIA_MENU), |
| 152 rb.GetNativeImageNamed(IDR_HELP_MENU)); | 161 rb.GetNativeImageNamed(IDR_HELP_MENU)); |
| 153 } | 162 } |
| 154 AddItemWithStringId(IDC_FEEDBACK, IDS_FEEDBACK); | 163 AddItemWithStringId(IDC_FEEDBACK, IDS_FEEDBACK); |
| 155 } | 164 } |
| 156 | 165 |
| 157 DISALLOW_COPY_AND_ASSIGN(HelpMenuModel); | 166 DISALLOW_COPY_AND_ASSIGN(HelpMenuModel); |
| 158 }; | 167 }; |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 | 544 |
| 536 // Help menu. | 545 // Help menu. |
| 537 case IDC_HELP_PAGE_VIA_MENU: | 546 case IDC_HELP_PAGE_VIA_MENU: |
| 538 base::RecordAction(UserMetricsAction("ShowHelpTabViaWrenchMenu")); | 547 base::RecordAction(UserMetricsAction("ShowHelpTabViaWrenchMenu")); |
| 539 | 548 |
| 540 if (!uma_action_recorded_) | 549 if (!uma_action_recorded_) |
| 541 UMA_HISTOGRAM_MEDIUM_TIMES("WrenchMenu.TimeToAction.HelpPage", delta); | 550 UMA_HISTOGRAM_MEDIUM_TIMES("WrenchMenu.TimeToAction.HelpPage", delta); |
| 542 LogMenuAction(MENU_ACTION_HELP_PAGE_VIA_MENU); | 551 LogMenuAction(MENU_ACTION_HELP_PAGE_VIA_MENU); |
| 543 break; | 552 break; |
| 544 #if defined(GOOGLE_CHROME_BUILD) | 553 #if defined(GOOGLE_CHROME_BUILD) |
| 554 case IDC_SHOW_BETA_FORUM: |
| 555 if (!uma_action_recorded_) |
| 556 UMA_HISTOGRAM_MEDIUM_TIMES("WrenchMenu.TimeToAction.BetaForum", delta); |
| 557 LogMenuAction(MENU_ACTION_BETA_FORUM); |
| 558 break; |
| 545 case IDC_FEEDBACK: | 559 case IDC_FEEDBACK: |
| 546 if (!uma_action_recorded_) | 560 if (!uma_action_recorded_) |
| 547 UMA_HISTOGRAM_MEDIUM_TIMES("WrenchMenu.TimeToAction.Feedback", delta); | 561 UMA_HISTOGRAM_MEDIUM_TIMES("WrenchMenu.TimeToAction.Feedback", delta); |
| 548 LogMenuAction(MENU_ACTION_FEEDBACK); | 562 LogMenuAction(MENU_ACTION_FEEDBACK); |
| 549 break; | 563 break; |
| 550 #endif | 564 #endif |
| 551 | 565 |
| 552 case IDC_TOGGLE_REQUEST_TABLET_SITE: | 566 case IDC_TOGGLE_REQUEST_TABLET_SITE: |
| 553 if (!uma_action_recorded_) { | 567 if (!uma_action_recorded_) { |
| 554 UMA_HISTOGRAM_MEDIUM_TIMES("WrenchMenu.TimeToAction.RequestTabletSite", | 568 UMA_HISTOGRAM_MEDIUM_TIMES("WrenchMenu.TimeToAction.RequestTabletSite", |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 842 browser_->tab_strip_model()->GetActiveWebContents()) | 856 browser_->tab_strip_model()->GetActiveWebContents()) |
| 843 ->GetZoomPercent(); | 857 ->GetZoomPercent(); |
| 844 } | 858 } |
| 845 zoom_label_ = base::FormatPercent(zoom_percent); | 859 zoom_label_ = base::FormatPercent(zoom_percent); |
| 846 } | 860 } |
| 847 | 861 |
| 848 void AppMenuModel::OnZoomLevelChanged( | 862 void AppMenuModel::OnZoomLevelChanged( |
| 849 const content::HostZoomMap::ZoomLevelChange& change) { | 863 const content::HostZoomMap::ZoomLevelChange& change) { |
| 850 UpdateZoomControls(); | 864 UpdateZoomControls(); |
| 851 } | 865 } |
| OLD | NEW |