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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 #include "ui/base/models/button_menu_item_model.h" | 67 #include "ui/base/models/button_menu_item_model.h" |
68 #include "ui/base/resource/resource_bundle.h" | 68 #include "ui/base/resource/resource_bundle.h" |
69 #include "ui/gfx/image/image.h" | 69 #include "ui/gfx/image/image.h" |
70 #include "ui/gfx/image/image_skia.h" | 70 #include "ui/gfx/image/image_skia.h" |
71 | 71 |
72 #if defined(OS_CHROMEOS) | 72 #if defined(OS_CHROMEOS) |
73 #include "chromeos/chromeos_switches.h" | 73 #include "chromeos/chromeos_switches.h" |
74 #endif | 74 #endif |
75 | 75 |
76 #if defined(OS_WIN) | 76 #if defined(OS_WIN) |
77 #include "base/win/metro.h" | |
78 #include "base/win/shortcut.h" | 77 #include "base/win/shortcut.h" |
79 #include "base/win/windows_version.h" | 78 #include "base/win/windows_version.h" |
80 #include "chrome/browser/enumerate_modules_model_win.h" | 79 #include "chrome/browser/enumerate_modules_model_win.h" |
81 #include "chrome/browser/ui/metro_pin_tab_helper_win.h" | |
82 #include "content/public/browser/gpu_data_manager.h" | 80 #include "content/public/browser/gpu_data_manager.h" |
83 #endif | 81 #endif |
84 | 82 |
85 #if defined(USE_ASH) | 83 #if defined(USE_ASH) |
86 #include "ash/shell.h" | 84 #include "ash/shell.h" |
87 #endif | 85 #endif |
88 | 86 |
89 using base::UserMetricsAction; | 87 using base::UserMetricsAction; |
90 using content::WebContents; | 88 using content::WebContents; |
91 | 89 |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 case IDC_FULLSCREEN: { | 375 case IDC_FULLSCREEN: { |
378 int string_id = IDS_ENTER_FULLSCREEN_MAC; // Default to Enter. | 376 int string_id = IDS_ENTER_FULLSCREEN_MAC; // Default to Enter. |
379 // Note: On startup, |window()| may be NULL. | 377 // Note: On startup, |window()| may be NULL. |
380 if (browser_->window() && browser_->window()->IsFullscreen()) | 378 if (browser_->window() && browser_->window()->IsFullscreen()) |
381 string_id = IDS_EXIT_FULLSCREEN_MAC; | 379 string_id = IDS_EXIT_FULLSCREEN_MAC; |
382 return l10n_util::GetStringUTF16(string_id); | 380 return l10n_util::GetStringUTF16(string_id); |
383 } | 381 } |
384 #elif defined(OS_WIN) | 382 #elif defined(OS_WIN) |
385 case IDC_PIN_TO_START_SCREEN: { | 383 case IDC_PIN_TO_START_SCREEN: { |
386 int string_id = IDS_PIN_TO_START_SCREEN; | 384 int string_id = IDS_PIN_TO_START_SCREEN; |
387 WebContents* web_contents = | 385 // TODO(scottmg): Remove http://crbug.com/558054. |
388 browser_->tab_strip_model()->GetActiveWebContents(); | |
389 MetroPinTabHelper* tab_helper = | |
390 web_contents ? MetroPinTabHelper::FromWebContents(web_contents) | |
391 : NULL; | |
392 if (tab_helper && tab_helper->IsPinned()) | |
393 string_id = IDS_UNPIN_FROM_START_SCREEN; | |
394 return l10n_util::GetStringUTF16(string_id); | 386 return l10n_util::GetStringUTF16(string_id); |
395 } | 387 } |
396 #endif | 388 #endif |
397 case IDC_UPGRADE_DIALOG: | 389 case IDC_UPGRADE_DIALOG: |
398 return GetUpgradeDialogMenuItemName(); | 390 return GetUpgradeDialogMenuItemName(); |
399 default: | 391 default: |
400 NOTREACHED(); | 392 NOTREACHED(); |
401 return base::string16(); | 393 return base::string16(); |
402 } | 394 } |
403 } | 395 } |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
763 EnumerateModulesModel* loaded_modules = | 755 EnumerateModulesModel* loaded_modules = |
764 EnumerateModulesModel::GetInstance(); | 756 EnumerateModulesModel::GetInstance(); |
765 if (loaded_modules->confirmed_bad_modules_detected() <= 0) | 757 if (loaded_modules->confirmed_bad_modules_detected() <= 0) |
766 return false; | 758 return false; |
767 // We'll leave the app menu adornment on until the user clicks the link. | 759 // We'll leave the app menu adornment on until the user clicks the link. |
768 if (loaded_modules->modules_to_notify_about() <= 0) | 760 if (loaded_modules->modules_to_notify_about() <= 0) |
769 loaded_modules->AcknowledgeConflictNotification(); | 761 loaded_modules->AcknowledgeConflictNotification(); |
770 return true; | 762 return true; |
771 } | 763 } |
772 case IDC_PIN_TO_START_SCREEN: | 764 case IDC_PIN_TO_START_SCREEN: |
773 return base::win::IsMetroProcess(); | 765 return false; |
774 #else | 766 #else |
775 case IDC_VIEW_INCOMPATIBILITIES: | 767 case IDC_VIEW_INCOMPATIBILITIES: |
776 case IDC_PIN_TO_START_SCREEN: | 768 case IDC_PIN_TO_START_SCREEN: |
777 return false; | 769 return false; |
778 #endif | 770 #endif |
779 case IDC_UPGRADE_DIALOG: | 771 case IDC_UPGRADE_DIALOG: |
780 return browser_defaults::kShowUpgradeMenuItem && | 772 return browser_defaults::kShowUpgradeMenuItem && |
781 UpgradeDetector::GetInstance()->notify_upgrade(); | 773 UpgradeDetector::GetInstance()->notify_upgrade(); |
782 #if !defined(OS_LINUX) || defined(USE_AURA) | 774 #if !defined(OS_LINUX) || defined(USE_AURA) |
783 case IDC_BOOKMARK_PAGE: | 775 case IDC_BOOKMARK_PAGE: |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1023 ->GetZoomPercent(); | 1015 ->GetZoomPercent(); |
1024 } | 1016 } |
1025 zoom_label_ = l10n_util::GetStringFUTF16( | 1017 zoom_label_ = l10n_util::GetStringFUTF16( |
1026 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent)); | 1018 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent)); |
1027 } | 1019 } |
1028 | 1020 |
1029 void AppMenuModel::OnZoomLevelChanged( | 1021 void AppMenuModel::OnZoomLevelChanged( |
1030 const content::HostZoomMap::ZoomLevelChange& change) { | 1022 const content::HostZoomMap::ZoomLevelChange& change) { |
1031 UpdateZoomControls(); | 1023 UpdateZoomControls(); |
1032 } | 1024 } |
OLD | NEW |