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

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

Issue 9416070: Move creation and ownership of HostZoomMap to content instead of having every embedder do this. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix mac/cros browsertests Created 8 years, 10 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
« no previous file with comments | « chrome/browser/ui/gtk/browser_toolbar_gtk.cc ('k') | chrome/browser/ui/views/wrench_menu.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 17 matching lines...) Expand all
28 #include "chrome/browser/ui/browser_window.h" 28 #include "chrome/browser/ui/browser_window.h"
29 #include "chrome/browser/ui/global_error.h" 29 #include "chrome/browser/ui/global_error.h"
30 #include "chrome/browser/ui/global_error_service.h" 30 #include "chrome/browser/ui/global_error_service.h"
31 #include "chrome/browser/ui/global_error_service_factory.h" 31 #include "chrome/browser/ui/global_error_service_factory.h"
32 #include "chrome/browser/ui/toolbar/encoding_menu_controller.h" 32 #include "chrome/browser/ui/toolbar/encoding_menu_controller.h"
33 #include "chrome/browser/upgrade_detector.h" 33 #include "chrome/browser/upgrade_detector.h"
34 #include "chrome/common/chrome_paths.h" 34 #include "chrome/common/chrome_paths.h"
35 #include "chrome/common/chrome_switches.h" 35 #include "chrome/common/chrome_switches.h"
36 #include "chrome/common/pref_names.h" 36 #include "chrome/common/pref_names.h"
37 #include "chrome/common/profiling.h" 37 #include "chrome/common/profiling.h"
38 #include "content/public/browser/host_zoom_map.h"
38 #include "content/public/browser/notification_service.h" 39 #include "content/public/browser/notification_service.h"
39 #include "content/public/browser/notification_source.h" 40 #include "content/public/browser/notification_source.h"
40 #include "content/public/browser/notification_types.h" 41 #include "content/public/browser/notification_types.h"
41 #include "content/public/browser/user_metrics.h" 42 #include "content/public/browser/user_metrics.h"
42 #include "content/public/browser/web_contents.h" 43 #include "content/public/browser/web_contents.h"
43 #include "grit/chromium_strings.h" 44 #include "grit/chromium_strings.h"
44 #include "grit/generated_resources.h" 45 #include "grit/generated_resources.h"
45 #include "grit/theme_resources.h" 46 #include "grit/theme_resources.h"
46 #include "third_party/skia/include/core/SkBitmap.h" 47 #include "third_party/skia/include/core/SkBitmap.h"
47 #include "ui/base/l10n/l10n_util.h" 48 #include "ui/base/l10n/l10n_util.h"
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 provider_(provider), 203 provider_(provider),
203 browser_(browser), 204 browser_(browser),
204 tabstrip_model_(browser_->tabstrip_model()) { 205 tabstrip_model_(browser_->tabstrip_model()) {
205 Build(); 206 Build();
206 UpdateZoomControls(); 207 UpdateZoomControls();
207 208
208 tabstrip_model_->AddObserver(this); 209 tabstrip_model_->AddObserver(this);
209 210
210 registrar_.Add( 211 registrar_.Add(
211 this, content::NOTIFICATION_ZOOM_LEVEL_CHANGED, 212 this, content::NOTIFICATION_ZOOM_LEVEL_CHANGED,
212 content::Source<HostZoomMap>(browser_->profile()->GetHostZoomMap())); 213 content::Source<HostZoomMap>(
214 HostZoomMap::GetForBrowserContext(browser_->profile())));
213 registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, 215 registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED,
214 content::NotificationService::AllSources()); 216 content::NotificationService::AllSources());
215 } 217 }
216 218
217 WrenchMenuModel::~WrenchMenuModel() { 219 WrenchMenuModel::~WrenchMenuModel() {
218 if (tabstrip_model_) 220 if (tabstrip_model_)
219 tabstrip_model_->RemoveObserver(this); 221 tabstrip_model_->RemoveObserver(this);
220 } 222 }
221 223
222 bool WrenchMenuModel::DoesCommandIdDismissMenu(int command_id) const { 224 bool WrenchMenuModel::DoesCommandIdDismissMenu(int command_id) const {
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 &enable_increment, &enable_decrement); 573 &enable_increment, &enable_decrement);
572 } 574 }
573 zoom_label_ = l10n_util::GetStringFUTF16( 575 zoom_label_ = l10n_util::GetStringFUTF16(
574 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent)); 576 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent));
575 } 577 }
576 578
577 string16 WrenchMenuModel::GetSyncMenuLabel() const { 579 string16 WrenchMenuModel::GetSyncMenuLabel() const {
578 return sync_ui_util::GetSyncMenuLabel(ProfileSyncServiceFactory:: 580 return sync_ui_util::GetSyncMenuLabel(ProfileSyncServiceFactory::
579 GetInstance()->GetForProfile(browser_->profile()->GetOriginalProfile())); 581 GetInstance()->GetForProfile(browser_->profile()->GetOriginalProfile()));
580 } 582 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/browser_toolbar_gtk.cc ('k') | chrome/browser/ui/views/wrench_menu.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698