summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwjmaclean@chromium.org <wjmaclean@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-09 17:20:27 +0000
committerwjmaclean@chromium.org <wjmaclean@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-09 17:20:27 +0000
commitba6890a69b20926bb00dfd09484da486f3a92060 (patch)
tree3035671b53c09f4ff702990042238cce214181bc
parent71011c168f7473b1ccf410841c02386e54854e74 (diff)
downloadchromium_src-ba6890a69b20926bb00dfd09484da486f3a92060.zip
chromium_src-ba6890a69b20926bb00dfd09484da486f3a92060.tar.gz
chromium_src-ba6890a69b20926bb00dfd09484da486f3a92060.tar.bz2
Show zoom bubble for everything but an empty host.
Changes committed in r281468 were overly restrictive about when the zoom bubble can be shown. This CL restores the old behaviour, noting that the usual cases where the zoom bubble is supressed, namely for changes initiated from the wrench menu and for changes in the dev tools window, are done elsewhere in the browser. BUG=391680 Review URL: https://codereview.chromium.org/372813003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@282073 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/ui/zoom/zoom_controller.cc19
-rw-r--r--chrome/browser/ui/zoom/zoom_controller.h5
-rw-r--r--chrome/browser/ui/zoom/zoom_controller_unittest.cc4
3 files changed, 7 insertions, 21 deletions
diff --git a/chrome/browser/ui/zoom/zoom_controller.cc b/chrome/browser/ui/zoom/zoom_controller.cc
index 53def64..0e4db31c 100644
--- a/chrome/browser/ui/zoom/zoom_controller.cc
+++ b/chrome/browser/ui/zoom/zoom_controller.cc
@@ -258,17 +258,10 @@ void ZoomController::DidNavigateMainFrame(
void ZoomController::OnZoomLevelChanged(
const content::HostZoomMap::ZoomLevelChange& change) {
- UpdateStateIncludingTemporary(
- change.host,
- change.mode == content::HostZoomMap::ZOOM_CHANGED_TEMPORARY_ZOOM);
+ UpdateState(change.host);
}
void ZoomController::UpdateState(const std::string& host) {
- UpdateStateIncludingTemporary(host, false);
-}
-
-void ZoomController::UpdateStateIncludingTemporary(const std::string& host,
- bool is_temporary_zoom) {
// If |host| is empty, all observers should be updated.
if (!host.empty()) {
// Use the navigation entry's URL instead of the WebContents' so virtual
@@ -281,18 +274,16 @@ void ZoomController::UpdateStateIncludingTemporary(const std::string& host,
}
}
- // The zoom bubble can be shown for all normal, per-origin zoom changes
- // (where the host will not be empty and the zoom is not temporary), or any
- // special zoom changes (where the zoom mode will not be "default").
- bool can_show_bubble =
- zoom_mode_ != ZOOM_MODE_DEFAULT || (!host.empty() && !is_temporary_zoom);
+ // The zoom bubble can be shown for all zoom changes where the host is
+ // not empty.
+ bool can_show_bubble = !host.empty();
if (event_data_) {
// For state changes initiated within the ZoomController, information about
// the change should be sent.
ZoomChangedEventData zoom_change_data = *event_data_;
event_data_.reset();
- zoom_change_data.can_show_bubble |= can_show_bubble;
+ zoom_change_data.can_show_bubble = can_show_bubble;
FOR_EACH_OBSERVER(
ZoomObserver, observers_, OnZoomChanged(zoom_change_data));
} else {
diff --git a/chrome/browser/ui/zoom/zoom_controller.h b/chrome/browser/ui/zoom/zoom_controller.h
index 357483c..4b5602e 100644
--- a/chrome/browser/ui/zoom/zoom_controller.h
+++ b/chrome/browser/ui/zoom/zoom_controller.h
@@ -120,11 +120,6 @@ class ZoomController : public content::WebContentsObserver,
// meaning the change should apply to ~all sites. If it is not empty, the
// change only affects sites with the given host.
void UpdateState(const std::string& host);
- // Same as UpdateState, but takes into account whether a temporary zoom level
- // has been set on |host| when deciding whether to show the zoom notification
- // bubble.
- void UpdateStateIncludingTemporary(const std::string& host,
- bool is_temporary_zoom);
// The current zoom mode.
ZoomMode zoom_mode_;
diff --git a/chrome/browser/ui/zoom/zoom_controller_unittest.cc b/chrome/browser/ui/zoom/zoom_controller_unittest.cc
index 2e36d74..82e3372 100644
--- a/chrome/browser/ui/zoom/zoom_controller_unittest.cc
+++ b/chrome/browser/ui/zoom/zoom_controller_unittest.cc
@@ -110,7 +110,7 @@ TEST_F(ZoomControllerTest, Observe_ZoomController) {
old_zoom_level,
old_zoom_level,
ZoomController::ZOOM_MODE_ISOLATED,
- true /* can_show_bubble */);
+ false /* can_show_bubble */);
EXPECT_CALL(zoom_observer_, OnZoomChanged(zoom_change_data1)).Times(1);
zoom_controller_->SetZoomMode(ZoomController::ZOOM_MODE_ISOLATED);
@@ -120,7 +120,7 @@ TEST_F(ZoomControllerTest, Observe_ZoomController) {
old_zoom_level,
new_zoom_level,
ZoomController::ZOOM_MODE_ISOLATED,
- true /* can_show_bubble */);
+ false /* can_show_bubble */);
EXPECT_CALL(zoom_observer_, OnZoomChanged(zoom_change_data2)).Times(1);
zoom_controller_->SetZoomLevel(new_zoom_level);