Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Side by Side Diff: chrome/browser/ui/toolbar/wrench_menu_model.cc

Issue 393133002: Migrate HostZoomMap to live in StoragePartition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to r288093. Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 278
279 WrenchMenuModel::WrenchMenuModel(ui::AcceleratorProvider* provider, 279 WrenchMenuModel::WrenchMenuModel(ui::AcceleratorProvider* provider,
280 Browser* browser) 280 Browser* browser)
281 : ui::SimpleMenuModel(this), 281 : ui::SimpleMenuModel(this),
282 provider_(provider), 282 provider_(provider),
283 browser_(browser), 283 browser_(browser),
284 tab_strip_model_(browser_->tab_strip_model()) { 284 tab_strip_model_(browser_->tab_strip_model()) {
285 Build(); 285 Build();
286 UpdateZoomControls(); 286 UpdateZoomControls();
287 287
288 // By asking for the HostZoomMap via the BrowserContext, we get the map
289 // associated with the default storage partition, and not the one related
290 // to any specialized storage partitions, e.g. those used by WebViewGuests.
288 content_zoom_subscription_ = content::HostZoomMap::GetForBrowserContext( 291 content_zoom_subscription_ = content::HostZoomMap::GetForBrowserContext(
289 browser->profile())->AddZoomLevelChangedCallback( 292 browser->profile())->AddZoomLevelChangedCallback(
290 base::Bind(&WrenchMenuModel::OnZoomLevelChanged, 293 base::Bind(&WrenchMenuModel::OnZoomLevelChanged,
291 base::Unretained(this))); 294 base::Unretained(this)));
292 295
293 browser_zoom_subscription_ = ZoomEventManager::GetForBrowserContext( 296 browser_zoom_subscription_ = ZoomEventManager::GetForBrowserContext(
294 browser->profile())->AddZoomLevelChangedCallback( 297 browser->profile())->AddZoomLevelChangedCallback(
295 base::Bind(&WrenchMenuModel::OnZoomLevelChanged, 298 base::Bind(&WrenchMenuModel::OnZoomLevelChanged,
296 base::Unretained(this))); 299 base::Unretained(this)));
297 300
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 ->GetZoomPercent(); 800 ->GetZoomPercent();
798 } 801 }
799 zoom_label_ = l10n_util::GetStringFUTF16( 802 zoom_label_ = l10n_util::GetStringFUTF16(
800 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent)); 803 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent));
801 } 804 }
802 805
803 void WrenchMenuModel::OnZoomLevelChanged( 806 void WrenchMenuModel::OnZoomLevelChanged(
804 const content::HostZoomMap::ZoomLevelChange& change) { 807 const content::HostZoomMap::ZoomLevelChange& change) {
805 UpdateZoomControls(); 808 UpdateZoomControls();
806 } 809 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698