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_LOCATION_BAR_PLUS_DECORATION_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_LOCATION_BAR_PLUS_DECORATION_H_ |
6 #define CHROME_BROWSER_UI_COCOA_LOCATION_BAR_PLUS_DECORATION_H_ | 6 #define CHROME_BROWSER_UI_COCOA_LOCATION_BAR_PLUS_DECORATION_H_ |
7 | 7 |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | |
10 #include "chrome/browser/ui/cocoa/location_bar/image_decoration.h" | 11 #include "chrome/browser/ui/cocoa/location_bar/image_decoration.h" |
11 | 12 |
13 class Browser; | |
12 class CommandUpdater; | 14 class CommandUpdater; |
15 class LocationBarViewMac; | |
16 @class MenuController; | |
17 | |
18 namespace ui { | |
19 class SimpleMenuModel; | |
20 } // namespace ui | |
13 | 21 |
14 // Note: this file is under development (see crbug.com/138118). | 22 // Note: this file is under development (see crbug.com/138118). |
15 | 23 |
16 // Plus icon on the right side of the location bar. | 24 // Plus icon on the right side of the location bar. |
17 class PlusDecoration : public ImageDecoration { | 25 class PlusDecoration : public ImageDecoration { |
18 public: | 26 public: |
19 explicit PlusDecoration(CommandUpdater* command_updater); | 27 PlusDecoration(LocationBarViewMac* owner, |
28 CommandUpdater* command_updater, | |
29 Browser* browser); | |
Scott Hess - ex-Googler
2012/08/08 15:00:14
Double-check the style guide as to whether continu
beaudoin
2012/08/08 21:38:08
Done.
| |
20 virtual ~PlusDecoration(); | 30 virtual ~PlusDecoration(); |
21 | 31 |
22 // Implement |LocationBarDecoration|. | 32 // Implement |LocationBarDecoration|. |
23 virtual bool AcceptsMousePress() OVERRIDE; | 33 virtual bool AcceptsMousePress() OVERRIDE; |
24 virtual bool OnMousePressed(NSRect frame) OVERRIDE; | 34 virtual bool OnMousePressed(NSRect frame) OVERRIDE; |
25 virtual NSString* GetToolTip() OVERRIDE; | 35 virtual NSString* GetToolTip() OVERRIDE; |
26 | 36 |
27 private: | 37 private: |
38 // Creates a menu model and a menu controller. | |
39 void CreateMenuController(); | |
40 | |
41 // Owner of the decoration, used to obtain the menu. | |
42 LocationBarViewMac* owner_; | |
43 | |
28 CommandUpdater* command_updater_; // Weak, owned by Browser. | 44 CommandUpdater* command_updater_; // Weak, owned by Browser. |
29 | 45 |
46 Browser* browser_; | |
47 | |
30 // The string to show for a tooltip. | 48 // The string to show for a tooltip. |
31 scoped_nsobject<NSString> tooltip_; | 49 scoped_nsobject<NSString> tooltip_; |
32 | 50 |
51 // Model for the menu attached to the plus decoration. | |
52 scoped_ptr<ui::SimpleMenuModel> menu_model_; | |
53 | |
54 // Controller for the menu attached to the plus decoration. | |
55 scoped_nsobject<MenuController> menuController_; | |
Scott Hess - ex-Googler
2012/08/08 15:00:14
Studly caps is for Objective-C files. Admittedly
beaudoin
2012/08/08 21:38:08
Done.
| |
56 | |
57 // Popup cell. | |
Scott Hess - ex-Googler
2012/08/08 15:00:14
Redundant comments document things multiple times!
beaudoin
2012/08/08 21:38:08
Done.
| |
58 scoped_nsobject<NSPopUpButtonCell> popUpCell_; | |
59 | |
33 DISALLOW_COPY_AND_ASSIGN(PlusDecoration); | 60 DISALLOW_COPY_AND_ASSIGN(PlusDecoration); |
34 }; | 61 }; |
35 | 62 |
36 #endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_PLUS_DECORATION_H_ | 63 #endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_PLUS_DECORATION_H_ |
OLD | NEW |