| 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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 | 276 |
| 277 WrenchMenuModel::WrenchMenuModel(ui::AcceleratorProvider* provider, | 277 WrenchMenuModel::WrenchMenuModel(ui::AcceleratorProvider* provider, |
| 278 Browser* browser) | 278 Browser* browser) |
| 279 : ui::SimpleMenuModel(this), | 279 : ui::SimpleMenuModel(this), |
| 280 provider_(provider), | 280 provider_(provider), |
| 281 browser_(browser), | 281 browser_(browser), |
| 282 tab_strip_model_(browser_->tab_strip_model()) { | 282 tab_strip_model_(browser_->tab_strip_model()) { |
| 283 Build(); | 283 Build(); |
| 284 UpdateZoomControls(); | 284 UpdateZoomControls(); |
| 285 | 285 |
| 286 // By asking for the HostZoomMap via the BrowserContext, we get the map |
| 287 // associated with the default storage partition, and not the one related |
| 288 // to any specialized storage partitions, e.g. those used by WebViewGuests. |
| 286 content_zoom_subscription_ = | 289 content_zoom_subscription_ = |
| 287 content::HostZoomMap::GetDefaultForBrowserContext(browser->profile()) | 290 content::HostZoomMap::GetDefaultForBrowserContext(browser->profile()) |
| 288 ->AddZoomLevelChangedCallback(base::Bind( | 291 ->AddZoomLevelChangedCallback(base::Bind( |
| 289 &WrenchMenuModel::OnZoomLevelChanged, base::Unretained(this))); | 292 &WrenchMenuModel::OnZoomLevelChanged, base::Unretained(this))); |
| 290 | 293 |
| 291 browser_zoom_subscription_ = ZoomEventManager::GetForBrowserContext( | 294 browser_zoom_subscription_ = ZoomEventManager::GetForBrowserContext( |
| 292 browser->profile())->AddZoomLevelChangedCallback( | 295 browser->profile())->AddZoomLevelChangedCallback( |
| 293 base::Bind(&WrenchMenuModel::OnZoomLevelChanged, | 296 base::Bind(&WrenchMenuModel::OnZoomLevelChanged, |
| 294 base::Unretained(this))); | 297 base::Unretained(this))); |
| 295 | 298 |
| (...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 785 ->GetZoomPercent(); | 788 ->GetZoomPercent(); |
| 786 } | 789 } |
| 787 zoom_label_ = l10n_util::GetStringFUTF16( | 790 zoom_label_ = l10n_util::GetStringFUTF16( |
| 788 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent)); | 791 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent)); |
| 789 } | 792 } |
| 790 | 793 |
| 791 void WrenchMenuModel::OnZoomLevelChanged( | 794 void WrenchMenuModel::OnZoomLevelChanged( |
| 792 const content::HostZoomMap::ZoomLevelChange& change) { | 795 const content::HostZoomMap::ZoomLevelChange& change) { |
| 793 UpdateZoomControls(); | 796 UpdateZoomControls(); |
| 794 } | 797 } |
| OLD | NEW |