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

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

Issue 2019423005: Move //components/ui/zoom to top-level under //components (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 6 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
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/app_menu_model.h" 5 #include "chrome/browser/ui/toolbar/app_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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 #include "chrome/common/chrome_paths.h" 44 #include "chrome/common/chrome_paths.h"
45 #include "chrome/common/chrome_switches.h" 45 #include "chrome/common/chrome_switches.h"
46 #include "chrome/common/profiling.h" 46 #include "chrome/common/profiling.h"
47 #include "chrome/grit/chromium_strings.h" 47 #include "chrome/grit/chromium_strings.h"
48 #include "chrome/grit/generated_resources.h" 48 #include "chrome/grit/generated_resources.h"
49 #include "components/bookmarks/common/bookmark_pref_names.h" 49 #include "components/bookmarks/common/bookmark_pref_names.h"
50 #include "components/dom_distiller/core/dom_distiller_switches.h" 50 #include "components/dom_distiller/core/dom_distiller_switches.h"
51 #include "components/prefs/pref_service.h" 51 #include "components/prefs/pref_service.h"
52 #include "components/signin/core/browser/signin_manager.h" 52 #include "components/signin/core/browser/signin_manager.h"
53 #include "components/signin/core/common/profile_management_switches.h" 53 #include "components/signin/core/common/profile_management_switches.h"
54 #include "components/ui/zoom/zoom_controller.h" 54 #include "components/zoom/zoom_controller.h"
55 #include "components/ui/zoom/zoom_event_manager.h" 55 #include "components/zoom/zoom_event_manager.h"
56 #include "content/public/browser/host_zoom_map.h" 56 #include "content/public/browser/host_zoom_map.h"
57 #include "content/public/browser/navigation_entry.h" 57 #include "content/public/browser/navigation_entry.h"
58 #include "content/public/browser/notification_service.h" 58 #include "content/public/browser/notification_service.h"
59 #include "content/public/browser/notification_source.h" 59 #include "content/public/browser/notification_source.h"
60 #include "content/public/browser/notification_types.h" 60 #include "content/public/browser/notification_types.h"
61 #include "content/public/browser/user_metrics.h" 61 #include "content/public/browser/user_metrics.h"
62 #include "content/public/browser/web_contents.h" 62 #include "content/public/browser/web_contents.h"
63 #include "extensions/common/feature_switch.h" 63 #include "extensions/common/feature_switch.h"
64 #include "grit/components_strings.h" 64 #include "grit/components_strings.h"
65 #include "grit/theme_resources.h" 65 #include "grit/theme_resources.h"
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 292
293 AppMenuModel::AppMenuModel(ui::AcceleratorProvider* provider, Browser* browser) 293 AppMenuModel::AppMenuModel(ui::AcceleratorProvider* provider, Browser* browser)
294 : ui::SimpleMenuModel(this), 294 : ui::SimpleMenuModel(this),
295 uma_action_recorded_(false), 295 uma_action_recorded_(false),
296 provider_(provider), 296 provider_(provider),
297 browser_(browser) { 297 browser_(browser) {
298 Build(); 298 Build();
299 UpdateZoomControls(); 299 UpdateZoomControls();
300 300
301 browser_zoom_subscription_ = 301 browser_zoom_subscription_ =
302 ui_zoom::ZoomEventManager::GetForBrowserContext(browser->profile()) 302 zoom::ZoomEventManager::GetForBrowserContext(browser->profile())
303 ->AddZoomLevelChangedCallback(base::Bind( 303 ->AddZoomLevelChangedCallback(base::Bind(
304 &AppMenuModel::OnZoomLevelChanged, base::Unretained(this))); 304 &AppMenuModel::OnZoomLevelChanged, base::Unretained(this)));
305 305
306 browser_->tab_strip_model()->AddObserver(this); 306 browser_->tab_strip_model()->AddObserver(this);
307 307
308 registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, 308 registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED,
309 content::NotificationService::AllSources()); 309 content::NotificationService::AllSources());
310 } 310 }
311 311
312 AppMenuModel::~AppMenuModel() { 312 AppMenuModel::~AppMenuModel() {
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after
928 IDR_FULLSCREEN_MENU_BUTTON); 928 IDR_FULLSCREEN_MENU_BUTTON);
929 AddButtonItem(IDC_ZOOM_MENU, zoom_menu_item_model_.get()); 929 AddButtonItem(IDC_ZOOM_MENU, zoom_menu_item_model_.get());
930 930
931 AddSeparator(ui::UPPER_SEPARATOR); 931 AddSeparator(ui::UPPER_SEPARATOR);
932 } 932 }
933 933
934 void AppMenuModel::UpdateZoomControls() { 934 void AppMenuModel::UpdateZoomControls() {
935 int zoom_percent = 100; 935 int zoom_percent = 100;
936 if (browser_->tab_strip_model() && 936 if (browser_->tab_strip_model() &&
937 browser_->tab_strip_model()->GetActiveWebContents()) { 937 browser_->tab_strip_model()->GetActiveWebContents()) {
938 zoom_percent = ui_zoom::ZoomController::FromWebContents( 938 zoom_percent = zoom::ZoomController::FromWebContents(
939 browser_->tab_strip_model()->GetActiveWebContents()) 939 browser_->tab_strip_model()->GetActiveWebContents())
940 ->GetZoomPercent(); 940 ->GetZoomPercent();
941 } 941 }
942 zoom_label_ = base::FormatPercent(zoom_percent); 942 zoom_label_ = base::FormatPercent(zoom_percent);
943 } 943 }
944 944
945 void AppMenuModel::OnZoomLevelChanged( 945 void AppMenuModel::OnZoomLevelChanged(
946 const content::HostZoomMap::ZoomLevelChange& change) { 946 const content::HostZoomMap::ZoomLevelChange& change) {
947 UpdateZoomControls(); 947 UpdateZoomControls();
948 } 948 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/tab_helpers.cc ('k') | chrome/browser/ui/views/apps/chrome_native_app_window_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698