| Index: chrome/browser/ui/zoom/zoom_controller.cc
|
| diff --git a/chrome/browser/ui/zoom/zoom_controller.cc b/chrome/browser/ui/zoom/zoom_controller.cc
|
| index ddb8e73e09d29a420bf46da09fab87ba5887e0a3..b52581fd30e503f32c68a8b8ea3f402ae546176d 100644
|
| --- a/chrome/browser/ui/zoom/zoom_controller.cc
|
| +++ b/chrome/browser/ui/zoom/zoom_controller.cc
|
| @@ -15,10 +15,10 @@
|
| #include "content/public/browser/notification_service.h"
|
| #include "content/public/browser/web_contents.h"
|
| #include "content/public/common/page_zoom.h"
|
| +#include "grit/theme_resources.h"
|
|
|
| ZoomController::ZoomController(TabContents* tab_contents)
|
| : content::WebContentsObserver(tab_contents->web_contents()),
|
| - zoom_icon_state_(NONE),
|
| zoom_percent_(100),
|
| tab_contents_(tab_contents),
|
| observer_(NULL) {
|
| @@ -35,6 +35,17 @@ ZoomController::~ZoomController() {
|
| registrar_.RemoveAll();
|
| }
|
|
|
| +bool ZoomController::IsAtDefaultZoom() const {
|
| + return content::ZoomValuesEqual(tab_contents_->web_contents()->GetZoomLevel(),
|
| + default_zoom_level_.GetValue());
|
| +}
|
| +
|
| +int ZoomController::GetResourceForZoomLevel() const {
|
| + DCHECK(!IsAtDefaultZoom());
|
| + double zoom = tab_contents_->web_contents()->GetZoomLevel();
|
| + return zoom > default_zoom_level_.GetValue() ? IDR_ZOOM_PLUS : IDR_ZOOM_MINUS;
|
| +}
|
| +
|
| void ZoomController::DidNavigateMainFrame(
|
| const content::LoadCommittedDetails& details,
|
| const content::FrameNavigateParams& params) {
|
| @@ -62,32 +73,9 @@ void ZoomController::Observe(int type,
|
| }
|
|
|
| void ZoomController::UpdateState(bool can_show_bubble) {
|
| - double current_zoom_level = tab_contents_->web_contents()->GetZoomLevel();
|
| - double default_zoom_level = default_zoom_level_.GetValue();
|
| -
|
| - ZoomIconState state;
|
| - if (content::ZoomValuesEqual(current_zoom_level, default_zoom_level))
|
| - state = NONE;
|
| - else if (current_zoom_level > default_zoom_level)
|
| - state = ZOOM_PLUS_ICON;
|
| - else
|
| - state = ZOOM_MINUS_ICON;
|
| -
|
| bool dummy;
|
| - int zoom_percent = tab_contents_->web_contents()->
|
| - GetZoomPercent(&dummy, &dummy);
|
| -
|
| - if (state != zoom_icon_state_) {
|
| - zoom_icon_state_ = state;
|
| - if (observer_)
|
| - observer_->OnZoomIconChanged(tab_contents_, state);
|
| - }
|
| + zoom_percent_ = tab_contents_->web_contents()->GetZoomPercent(&dummy, &dummy);
|
|
|
| - if (zoom_percent != zoom_percent_) {
|
| - zoom_percent_ = zoom_percent;
|
| - if (observer_)
|
| - observer_->OnZoomChanged(tab_contents_,
|
| - zoom_percent,
|
| - can_show_bubble && state != NONE);
|
| - }
|
| + if (observer_)
|
| + observer_->OnZoomChanged(tab_contents_, can_show_bubble);
|
| }
|
|
|