| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 #include "chrome/browser/enumerate_modules_model_win.h" | 71 #include "chrome/browser/enumerate_modules_model_win.h" |
| 72 #include "chrome/browser/ui/metro_pin_tab_helper_win.h" | 72 #include "chrome/browser/ui/metro_pin_tab_helper_win.h" |
| 73 #include "content/public/browser/gpu_data_manager.h" | 73 #include "content/public/browser/gpu_data_manager.h" |
| 74 #endif | 74 #endif |
| 75 | 75 |
| 76 #if defined(USE_ASH) | 76 #if defined(USE_ASH) |
| 77 #include "ash/shell.h" | 77 #include "ash/shell.h" |
| 78 #endif | 78 #endif |
| 79 | 79 |
| 80 using base::UserMetricsAction; | 80 using base::UserMetricsAction; |
| 81 using content::HostZoomMap; | |
| 82 using content::WebContents; | 81 using content::WebContents; |
| 83 | 82 |
| 84 namespace { | 83 namespace { |
| 85 // Conditionally return the update app menu item title based on upgrade detector | 84 // Conditionally return the update app menu item title based on upgrade detector |
| 86 // state. | 85 // state. |
| 87 base::string16 GetUpgradeDialogMenuItemName() { | 86 base::string16 GetUpgradeDialogMenuItemName() { |
| 88 if (UpgradeDetector::GetInstance()->is_outdated_install() || | 87 if (UpgradeDetector::GetInstance()->is_outdated_install() || |
| 89 UpgradeDetector::GetInstance()->is_outdated_install_no_au()) { | 88 UpgradeDetector::GetInstance()->is_outdated_install_no_au()) { |
| 90 return l10n_util::GetStringUTF16(IDS_UPGRADE_BUBBLE_MENU_ITEM); | 89 return l10n_util::GetStringUTF16(IDS_UPGRADE_BUBBLE_MENU_ITEM); |
| 91 } else { | 90 } else { |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 | 277 |
| 279 WrenchMenuModel::WrenchMenuModel(ui::AcceleratorProvider* provider, | 278 WrenchMenuModel::WrenchMenuModel(ui::AcceleratorProvider* provider, |
| 280 Browser* browser) | 279 Browser* browser) |
| 281 : ui::SimpleMenuModel(this), | 280 : ui::SimpleMenuModel(this), |
| 282 provider_(provider), | 281 provider_(provider), |
| 283 browser_(browser), | 282 browser_(browser), |
| 284 tab_strip_model_(browser_->tab_strip_model()) { | 283 tab_strip_model_(browser_->tab_strip_model()) { |
| 285 Build(); | 284 Build(); |
| 286 UpdateZoomControls(); | 285 UpdateZoomControls(); |
| 287 | 286 |
| 287 // By asking for the HostZoomMap via the BrowserContext, we get the map |
| 288 // associated with the default storage partition, and not the one related |
| 289 // to any specialized storage partitions, e.g. those used by WebViewGuests. |
| 288 content_zoom_subscription_ = content::HostZoomMap::GetForBrowserContext( | 290 content_zoom_subscription_ = content::HostZoomMap::GetForBrowserContext( |
| 289 browser->profile())->AddZoomLevelChangedCallback( | 291 browser->profile())->AddZoomLevelChangedCallback( |
| 290 base::Bind(&WrenchMenuModel::OnZoomLevelChanged, | 292 base::Bind(&WrenchMenuModel::OnZoomLevelChanged, |
| 291 base::Unretained(this))); | 293 base::Unretained(this))); |
| 292 | 294 |
| 293 browser_zoom_subscription_ = ZoomEventManager::GetForBrowserContext( | 295 browser_zoom_subscription_ = ZoomEventManager::GetForBrowserContext( |
| 294 browser->profile())->AddZoomLevelChangedCallback( | 296 browser->profile())->AddZoomLevelChangedCallback( |
| 295 base::Bind(&WrenchMenuModel::OnZoomLevelChanged, | 297 base::Bind(&WrenchMenuModel::OnZoomLevelChanged, |
| 296 base::Unretained(this))); | 298 base::Unretained(this))); |
| 297 | 299 |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 797 ->GetZoomPercent(); | 799 ->GetZoomPercent(); |
| 798 } | 800 } |
| 799 zoom_label_ = l10n_util::GetStringFUTF16( | 801 zoom_label_ = l10n_util::GetStringFUTF16( |
| 800 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent)); | 802 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent)); |
| 801 } | 803 } |
| 802 | 804 |
| 803 void WrenchMenuModel::OnZoomLevelChanged( | 805 void WrenchMenuModel::OnZoomLevelChanged( |
| 804 const content::HostZoomMap::ZoomLevelChange& change) { | 806 const content::HostZoomMap::ZoomLevelChange& change) { |
| 805 UpdateZoomControls(); | 807 UpdateZoomControls(); |
| 806 } | 808 } |
| OLD | NEW |