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

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

Issue 940673002: No need to suppress ZoomBubble if !window_->IsActive(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Re-remove stale comment. 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 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 // URLs work (e.g. chrome://settings). http://crbug.com/153950 311 // URLs work (e.g. chrome://settings). http://crbug.com/153950
312 content::NavigationEntry* entry = 312 content::NavigationEntry* entry =
313 web_contents()->GetController().GetLastCommittedEntry(); 313 web_contents()->GetController().GetLastCommittedEntry();
314 if (!entry || 314 if (!entry ||
315 host != net::GetHostOrSpecFromURL( 315 host != net::GetHostOrSpecFromURL(
316 content::HostZoomMap::GetURLFromEntry(entry))) { 316 content::HostZoomMap::GetURLFromEntry(entry))) {
317 return; 317 return;
318 } 318 }
319 } 319 }
320 320
321 // The zoom bubble should not be shown for zoom changes where the host is
322 // empty.
323 bool can_show_bubble = can_show_bubble_ && !host.empty();
324
325 if (event_data_) { 321 if (event_data_) {
326 // For state changes initiated within the ZoomController, information about 322 // For state changes initiated within the ZoomController, information about
327 // the change should be sent. 323 // the change should be sent.
328 ZoomChangedEventData zoom_change_data = *event_data_; 324 ZoomChangedEventData zoom_change_data = *event_data_;
329 event_data_.reset(); 325 event_data_.reset();
330 zoom_change_data.can_show_bubble = can_show_bubble; 326 // The zoom bubble should not be shown for zoom changes where the host
327 // is empty.
328 zoom_change_data.can_show_bubble = can_show_bubble_ && !host.empty();
331 FOR_EACH_OBSERVER(ZoomObserver, observers_, 329 FOR_EACH_OBSERVER(ZoomObserver, observers_,
332 OnZoomChanged(zoom_change_data)); 330 OnZoomChanged(zoom_change_data));
333 } else { 331 } else {
334 // TODO(wjmaclean) Should we consider having HostZoomMap send both old and 332 // TODO(wjmaclean) Should we consider having HostZoomMap send both old and
335 // new zoom levels here? 333 // new zoom levels here?
336 double zoom_level = GetZoomLevel(); 334 double zoom_level = GetZoomLevel();
337 ZoomChangedEventData zoom_change_data( 335 // We never show a zoom bubble for an event we didn't generate.
338 web_contents(), zoom_level, zoom_level, zoom_mode_, can_show_bubble); 336 ZoomChangedEventData zoom_change_data(web_contents(), zoom_level,
337 zoom_level, zoom_mode_,
338 false /* can_show_bubble */);
339 FOR_EACH_OBSERVER(ZoomObserver, observers_, 339 FOR_EACH_OBSERVER(ZoomObserver, observers_,
340 OnZoomChanged(zoom_change_data)); 340 OnZoomChanged(zoom_change_data));
341 } 341 }
342 } 342 }
343 343
344 } // namespace ui_zoom 344 } // 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