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