| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #import "chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller.h" | 5 #import "chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/mac/bundle_locations.h" | 8 #include "base/mac/bundle_locations.h" |
| 9 #include "base/mac/mac_util.h" | 9 #include "base/mac/mac_util.h" |
| 10 #include "base/string16.h" | 10 #include "base/string16.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 controller_(controller), | 68 controller_(controller), |
| 69 map_(map) { | 69 map_(map) { |
| 70 map_->AddZoomLevelChangedCallback(callback_); | 70 map_->AddZoomLevelChangedCallback(callback_); |
| 71 } | 71 } |
| 72 | 72 |
| 73 ~ZoomLevelObserver() { | 73 ~ZoomLevelObserver() { |
| 74 map_->RemoveZoomLevelChangedCallback(callback_); | 74 map_->RemoveZoomLevelChangedCallback(callback_); |
| 75 } | 75 } |
| 76 | 76 |
| 77 private: | 77 private: |
| 78 void OnZoomLevelChanged(const std::string& host) { | 78 void OnZoomLevelChanged(const HostZoomMap::ZoomLevelChange& change) { |
| 79 WrenchMenuModel* wrenchMenuModel = [controller_ wrenchMenuModel]; | 79 WrenchMenuModel* wrenchMenuModel = [controller_ wrenchMenuModel]; |
| 80 wrenchMenuModel->UpdateZoomControls(); | 80 wrenchMenuModel->UpdateZoomControls(); |
| 81 const string16 level = | 81 const string16 level = |
| 82 wrenchMenuModel->GetLabelForCommandId(IDC_ZOOM_PERCENT_DISPLAY); | 82 wrenchMenuModel->GetLabelForCommandId(IDC_ZOOM_PERCENT_DISPLAY); |
| 83 [[controller_ zoomDisplay] setTitle:SysUTF16ToNSString(level)]; | 83 [[controller_ zoomDisplay] setTitle:SysUTF16ToNSString(level)]; |
| 84 } | 84 } |
| 85 | 85 |
| 86 content::HostZoomMap::ZoomLevelChangedCallback callback_; | 86 content::HostZoomMap::ZoomLevelChangedCallback callback_; |
| 87 | 87 |
| 88 WrenchMenuController* controller_; // Weak; owns this. | 88 WrenchMenuController* controller_; // Weak; owns this. |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 controller_ = controller; | 356 controller_ = controller; |
| 357 } | 357 } |
| 358 return self; | 358 return self; |
| 359 } | 359 } |
| 360 | 360 |
| 361 - (IBAction)dispatchWrenchMenuCommand:(id)sender { | 361 - (IBAction)dispatchWrenchMenuCommand:(id)sender { |
| 362 [controller_ dispatchWrenchMenuCommand:sender]; | 362 [controller_ dispatchWrenchMenuCommand:sender]; |
| 363 } | 363 } |
| 364 | 364 |
| 365 @end // @implementation WrenchMenuButtonViewController | 365 @end // @implementation WrenchMenuButtonViewController |
| OLD | NEW |