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" |
11 #include "base/debug/debugging_flags.h" | 11 #include "base/debug/debugging_flags.h" |
| 12 #include "base/debug/profiler.h" |
12 #include "base/macros.h" | 13 #include "base/macros.h" |
13 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
14 #include "base/prefs/pref_service.h" | 15 #include "base/prefs/pref_service.h" |
15 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
16 #include "base/strings/string_util.h" | 17 #include "base/strings/string_util.h" |
17 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
18 #include "build/build_config.h" | 19 #include "build/build_config.h" |
19 #include "chrome/app/chrome_command_ids.h" | 20 #include "chrome/app/chrome_command_ids.h" |
20 #include "chrome/browser/browser_process.h" | 21 #include "chrome/browser/browser_process.h" |
21 #include "chrome/browser/defaults.h" | 22 #include "chrome/browser/defaults.h" |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 #if defined(OS_CHROMEOS) | 279 #if defined(OS_CHROMEOS) |
279 AddItemWithStringId(IDC_TAKE_SCREENSHOT, IDS_TAKE_SCREENSHOT); | 280 AddItemWithStringId(IDC_TAKE_SCREENSHOT, IDS_TAKE_SCREENSHOT); |
280 #endif | 281 #endif |
281 encoding_menu_model_.reset(new EncodingMenuModel(browser)); | 282 encoding_menu_model_.reset(new EncodingMenuModel(browser)); |
282 AddSubMenuWithStringId(IDC_ENCODING_MENU, IDS_ENCODING_MENU, | 283 AddSubMenuWithStringId(IDC_ENCODING_MENU, IDS_ENCODING_MENU, |
283 encoding_menu_model_.get()); | 284 encoding_menu_model_.get()); |
284 | 285 |
285 AddSeparator(ui::NORMAL_SEPARATOR); | 286 AddSeparator(ui::NORMAL_SEPARATOR); |
286 AddItemWithStringId(IDC_DEV_TOOLS, IDS_DEV_TOOLS); | 287 AddItemWithStringId(IDC_DEV_TOOLS, IDS_DEV_TOOLS); |
287 | 288 |
288 #if BUILDFLAG(ENABLE_PROFILING) && !defined(NO_TCMALLOC) | 289 if (base::debug::IsProfilingSupported()) { |
289 AddSeparator(ui::NORMAL_SEPARATOR); | 290 AddSeparator(ui::NORMAL_SEPARATOR); |
290 AddCheckItemWithStringId(IDC_PROFILING_ENABLED, IDS_PROFILING_ENABLED); | 291 AddCheckItemWithStringId(IDC_PROFILING_ENABLED, IDS_PROFILING_ENABLED); |
291 #endif | 292 } |
292 } | 293 } |
293 | 294 |
294 //////////////////////////////////////////////////////////////////////////////// | 295 //////////////////////////////////////////////////////////////////////////////// |
295 // AppMenuModel | 296 // AppMenuModel |
296 | 297 |
297 AppMenuModel::AppMenuModel(ui::AcceleratorProvider* provider, Browser* browser) | 298 AppMenuModel::AppMenuModel(ui::AcceleratorProvider* provider, Browser* browser) |
298 : ui::SimpleMenuModel(this), | 299 : ui::SimpleMenuModel(this), |
299 uma_action_recorded_(false), | 300 uma_action_recorded_(false), |
300 provider_(provider), | 301 provider_(provider), |
301 browser_(browser) { | 302 browser_(browser) { |
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
942 ->GetZoomPercent(); | 943 ->GetZoomPercent(); |
943 } | 944 } |
944 zoom_label_ = l10n_util::GetStringFUTF16( | 945 zoom_label_ = l10n_util::GetStringFUTF16( |
945 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent)); | 946 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent)); |
946 } | 947 } |
947 | 948 |
948 void AppMenuModel::OnZoomLevelChanged( | 949 void AppMenuModel::OnZoomLevelChanged( |
949 const content::HostZoomMap::ZoomLevelChange& change) { | 950 const content::HostZoomMap::ZoomLevelChange& change) { |
950 UpdateZoomControls(); | 951 UpdateZoomControls(); |
951 } | 952 } |
OLD | NEW |