| OLD | NEW |
| 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 #ifndef CHROME_BROWSER_UI_COCOA_TOOLBAR_BACK_FORWARD_MENU_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_TOOLBAR_BACK_FORWARD_MENU_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_UI_COCOA_TOOLBAR_BACK_FORWARD_MENU_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_COCOA_TOOLBAR_BACK_FORWARD_MENU_CONTROLLER_H_ |
| 7 | 7 |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 | 9 |
| 10 #include <memory> |
| 11 |
| 10 #include "base/mac/scoped_nsobject.h" | 12 #include "base/mac/scoped_nsobject.h" |
| 11 #include "base/memory/scoped_ptr.h" | |
| 12 #import "chrome/browser/ui/cocoa/has_weak_browser_pointer.h" | 13 #import "chrome/browser/ui/cocoa/has_weak_browser_pointer.h" |
| 13 #include "chrome/browser/ui/toolbar/back_forward_menu_model.h" | 14 #include "chrome/browser/ui/toolbar/back_forward_menu_model.h" |
| 14 | 15 |
| 15 @class MenuButton; | 16 @class MenuButton; |
| 16 | 17 |
| 17 typedef BackForwardMenuModel::ModelType BackForwardMenuType; | 18 typedef BackForwardMenuModel::ModelType BackForwardMenuType; |
| 18 const BackForwardMenuType BACK_FORWARD_MENU_TYPE_BACK = | 19 const BackForwardMenuType BACK_FORWARD_MENU_TYPE_BACK = |
| 19 BackForwardMenuModel::BACKWARD_MENU; | 20 BackForwardMenuModel::BACKWARD_MENU; |
| 20 const BackForwardMenuType BACK_FORWARD_MENU_TYPE_FORWARD = | 21 const BackForwardMenuType BACK_FORWARD_MENU_TYPE_FORWARD = |
| 21 BackForwardMenuModel::FORWARD_MENU; | 22 BackForwardMenuModel::FORWARD_MENU; |
| 22 | 23 |
| 23 // A class that manages the back/forward menu (and delayed-menu button, and | 24 // A class that manages the back/forward menu (and delayed-menu button, and |
| 24 // model). | 25 // model). |
| 25 // Implement HasWeakBrowserPointer so we can clean up if the Browser is | 26 // Implement HasWeakBrowserPointer so we can clean up if the Browser is |
| 26 // destroyed. | 27 // destroyed. |
| 27 @interface BackForwardMenuController | 28 @interface BackForwardMenuController |
| 28 : NSObject<NSMenuDelegate, HasWeakBrowserPointer> { | 29 : NSObject<NSMenuDelegate, HasWeakBrowserPointer> { |
| 29 @private | 30 @private |
| 30 BackForwardMenuType type_; | 31 BackForwardMenuType type_; |
| 31 MenuButton* button_; // Weak; comes from nib. | 32 MenuButton* button_; // Weak; comes from nib. |
| 32 scoped_ptr<BackForwardMenuModel> model_; | 33 std::unique_ptr<BackForwardMenuModel> model_; |
| 33 base::scoped_nsobject<NSMenu> backForwardMenu_; | 34 base::scoped_nsobject<NSMenu> backForwardMenu_; |
| 34 } | 35 } |
| 35 | 36 |
| 36 // Type (back or forwards); can only be set on initialization. | 37 // Type (back or forwards); can only be set on initialization. |
| 37 @property(readonly, nonatomic) BackForwardMenuType type; | 38 @property(readonly, nonatomic) BackForwardMenuType type; |
| 38 | 39 |
| 39 - (id)initWithBrowser:(Browser*)browser | 40 - (id)initWithBrowser:(Browser*)browser |
| 40 modelType:(BackForwardMenuType)type | 41 modelType:(BackForwardMenuType)type |
| 41 button:(MenuButton*)button; | 42 button:(MenuButton*)button; |
| 42 | 43 |
| 43 @end // @interface BackForwardMenuController | 44 @end // @interface BackForwardMenuController |
| 44 | 45 |
| 45 #endif // CHROME_BROWSER_UI_COCOA_TOOLBAR_BACK_FORWARD_MENU_CONTROLLER_H_ | 46 #endif // CHROME_BROWSER_UI_COCOA_TOOLBAR_BACK_FORWARD_MENU_CONTROLLER_H_ |
| OLD | NEW |