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

Side by Side Diff: components/ui/zoom/zoom_controller.cc

Issue 884063004: Reset manual zoom mode on navigation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « chrome/browser/ui/zoom/zoom_controller_browsertest.cc ('k') | no next file » | 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 "components/ui/zoom/zoom_controller.h" 5 #include "components/ui/zoom/zoom_controller.h"
6 6
7 #include "components/ui/zoom/zoom_event_manager.h" 7 #include "components/ui/zoom/zoom_event_manager.h"
8 #include "components/ui/zoom/zoom_observer.h" 8 #include "components/ui/zoom/zoom_observer.h"
9 #include "content/public/browser/host_zoom_map.h" 9 #include "content/public/browser/host_zoom_map.h"
10 #include "content/public/browser/navigation_details.h" 10 #include "content/public/browser/navigation_details.h"
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 break; 229 break;
230 } 230 }
231 } 231 }
232 // Any event data we've stored should have been consumed by this point. 232 // Any event data we've stored should have been consumed by this point.
233 DCHECK(!event_data_); 233 DCHECK(!event_data_);
234 234
235 zoom_mode_ = new_mode; 235 zoom_mode_ = new_mode;
236 } 236 }
237 237
238 void ZoomController::ResetZoomModeOnNavigationIfNeeded(const GURL& url) { 238 void ZoomController::ResetZoomModeOnNavigationIfNeeded(const GURL& url) {
239 if (zoom_mode_ != ZOOM_MODE_ISOLATED) 239 if (zoom_mode_ != ZOOM_MODE_ISOLATED && zoom_mode_ != ZOOM_MODE_MANUAL)
240 return; 240 return;
241 241
242 int render_process_id = web_contents()->GetRenderProcessHost()->GetID(); 242 int render_process_id = web_contents()->GetRenderProcessHost()->GetID();
243 int render_view_id = web_contents()->GetRenderViewHost()->GetRoutingID(); 243 int render_view_id = web_contents()->GetRenderViewHost()->GetRoutingID();
244 content::HostZoomMap* zoom_map = 244 content::HostZoomMap* zoom_map =
245 content::HostZoomMap::GetForWebContents(web_contents()); 245 content::HostZoomMap::GetForWebContents(web_contents());
246 zoom_level_ = zoom_map->GetDefaultZoomLevel();
246 double old_zoom_level = zoom_map->GetZoomLevel(web_contents()); 247 double old_zoom_level = zoom_map->GetZoomLevel(web_contents());
247 double new_zoom_level = zoom_map->GetZoomLevelForHostAndScheme( 248 double new_zoom_level = zoom_map->GetZoomLevelForHostAndScheme(
248 url.scheme(), net::GetHostOrSpecFromURL(url)); 249 url.scheme(), net::GetHostOrSpecFromURL(url));
249 event_data_.reset(new ZoomChangedEventData( 250 event_data_.reset(new ZoomChangedEventData(
250 web_contents(), old_zoom_level, new_zoom_level, ZOOM_MODE_DEFAULT, 251 web_contents(), old_zoom_level, new_zoom_level, ZOOM_MODE_DEFAULT,
251 false /* can_show_bubble */)); 252 false /* can_show_bubble */));
252 // The call to ClearTemporaryZoomLevel() doesn't generate any events from 253 // The call to ClearTemporaryZoomLevel() doesn't generate any events from
253 // HostZoomMap, but the call to UpdateState() at the end of this function 254 // HostZoomMap, but the call to UpdateState() at the end of this function
254 // will notify our observers. 255 // will notify our observers.
255 // Note: it's possible the render_process/view ids have disappeared (e.g. 256 // Note: it's possible the render_process/view ids have disappeared (e.g.
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 // new zoom levels here? 331 // new zoom levels here?
331 double zoom_level = GetZoomLevel(); 332 double zoom_level = GetZoomLevel();
332 ZoomChangedEventData zoom_change_data( 333 ZoomChangedEventData zoom_change_data(
333 web_contents(), zoom_level, zoom_level, zoom_mode_, can_show_bubble); 334 web_contents(), zoom_level, zoom_level, zoom_mode_, can_show_bubble);
334 FOR_EACH_OBSERVER(ZoomObserver, observers_, 335 FOR_EACH_OBSERVER(ZoomObserver, observers_,
335 OnZoomChanged(zoom_change_data)); 336 OnZoomChanged(zoom_change_data));
336 } 337 }
337 } 338 }
338 339
339 } // namespace ui_zoom 340 } // namespace ui_zoom
OLDNEW
« no previous file with comments | « chrome/browser/ui/zoom/zoom_controller_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698