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

Unified Diff: chrome/browser/ui/views/toolbar/app_menu.cc

Issue 1803003003: [UI Views] Check menu() in ZoomView (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/toolbar/app_menu.cc
diff --git a/chrome/browser/ui/views/toolbar/app_menu.cc b/chrome/browser/ui/views/toolbar/app_menu.cc
index 6200059dccd5d8e387388f2b884c6b877a9e6f0f..0a740c3cae693a957067a6b24fa4bd747a257d9b 100644
--- a/chrome/browser/ui/views/toolbar/app_menu.cc
+++ b/chrome/browser/ui/views/toolbar/app_menu.cc
@@ -647,17 +647,19 @@ class AppMenu::ZoomView : public AppMenuView {
}
}
- // Overridden from AppMenuObserver.
- void AppMenuDestroyed() override { AppMenuView::AppMenuDestroyed(); }
Devlin 2016/03/15 21:39:22 Drive-by: this was a bit silly.
-
private:
+ content::WebContents* GetActiveWebContents() const {
+ return menu() ?
+ menu()->browser_->tab_strip_model()->GetActiveWebContents() :
+ nullptr;
+ }
+
void OnZoomLevelChanged(const content::HostZoomMap::ZoomLevelChange& change) {
UpdateZoomControls();
}
void UpdateZoomControls() {
- WebContents* selected_tab =
- menu()->browser_->tab_strip_model()->GetActiveWebContents();
+ WebContents* selected_tab = GetActiveWebContents();
int zoom = 100;
if (selected_tab) {
auto zoom_controller =
@@ -685,8 +687,7 @@ class AppMenu::ZoomView : public AppMenuView {
int max_w = 0;
- WebContents* selected_tab =
- menu()->browser_->tab_strip_model()->GetActiveWebContents();
+ WebContents* selected_tab = GetActiveWebContents();
if (selected_tab) {
auto zoom_controller =
ui_zoom::ZoomController::FromWebContents(selected_tab);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698