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_PANELS_PANEL_COCOA_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_PANELS_PANEL_COCOA_H_ |
6 #define CHROME_BROWSER_UI_COCOA_PANELS_PANEL_COCOA_H_ | 6 #define CHROME_BROWSER_UI_COCOA_PANELS_PANEL_COCOA_H_ |
7 | 7 |
8 #import <Foundation/Foundation.h> | 8 #import <Foundation/Foundation.h> |
| 9 |
| 10 #include <memory> |
| 11 |
9 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
10 #include "base/macros.h" | 13 #include "base/macros.h" |
11 #include "base/memory/scoped_ptr.h" | |
12 #include "chrome/browser/ui/panels/native_panel.h" | 14 #include "chrome/browser/ui/panels/native_panel.h" |
13 #include "ui/gfx/geometry/rect.h" | 15 #include "ui/gfx/geometry/rect.h" |
14 | 16 |
15 class Panel; | 17 class Panel; |
16 @class PanelWindowControllerCocoa; | 18 @class PanelWindowControllerCocoa; |
17 | 19 |
18 // An implememtation of the native panel in Cocoa. | 20 // An implememtation of the native panel in Cocoa. |
19 // Bridges between C++ and the Cocoa NSWindow. Cross-platform code will | 21 // Bridges between C++ and the Cocoa NSWindow. Cross-platform code will |
20 // interact with this object when it needs to manipulate the window. | 22 // interact with this object when it needs to manipulate the window. |
21 class PanelCocoa : public NativePanel { | 23 class PanelCocoa : public NativePanel { |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 FRIEND_TEST_ALL_PREFIXES(PanelCocoaTest, TitlebarViewSizing); | 87 FRIEND_TEST_ALL_PREFIXES(PanelCocoaTest, TitlebarViewSizing); |
86 FRIEND_TEST_ALL_PREFIXES(PanelCocoaTest, TitlebarViewClose); | 88 FRIEND_TEST_ALL_PREFIXES(PanelCocoaTest, TitlebarViewClose); |
87 FRIEND_TEST_ALL_PREFIXES(PanelCocoaTest, MenuItems); | 89 FRIEND_TEST_ALL_PREFIXES(PanelCocoaTest, MenuItems); |
88 FRIEND_TEST_ALL_PREFIXES(PanelCocoaTest, KeyEvent); | 90 FRIEND_TEST_ALL_PREFIXES(PanelCocoaTest, KeyEvent); |
89 FRIEND_TEST_ALL_PREFIXES(PanelCocoaTest, ThemeProvider); | 91 FRIEND_TEST_ALL_PREFIXES(PanelCocoaTest, ThemeProvider); |
90 FRIEND_TEST_ALL_PREFIXES(PanelCocoaTest, SetTitle); | 92 FRIEND_TEST_ALL_PREFIXES(PanelCocoaTest, SetTitle); |
91 FRIEND_TEST_ALL_PREFIXES(PanelCocoaTest, ActivatePanel); | 93 FRIEND_TEST_ALL_PREFIXES(PanelCocoaTest, ActivatePanel); |
92 | 94 |
93 void setBoundsInternal(const gfx::Rect& bounds, bool animate); | 95 void setBoundsInternal(const gfx::Rect& bounds, bool animate); |
94 | 96 |
95 scoped_ptr<Panel> panel_; | 97 std::unique_ptr<Panel> panel_; |
96 PanelWindowControllerCocoa* controller_; // Weak, owns us. | 98 PanelWindowControllerCocoa* controller_; // Weak, owns us. |
97 | 99 |
98 // These use platform-independent screen coordinates, with (0,0) at | 100 // These use platform-independent screen coordinates, with (0,0) at |
99 // top-left of the primary screen. They have to be converted to Cocoa | 101 // top-left of the primary screen. They have to be converted to Cocoa |
100 // screen coordinates before calling Cocoa API. | 102 // screen coordinates before calling Cocoa API. |
101 gfx::Rect bounds_; | 103 gfx::Rect bounds_; |
102 | 104 |
103 // True if the panel should always stay on top of other windows. | 105 // True if the panel should always stay on top of other windows. |
104 bool always_on_top_; | 106 bool always_on_top_; |
105 | 107 |
106 bool is_shown_; // Panel is hidden on creation, Show() changes that forever. | 108 bool is_shown_; // Panel is hidden on creation, Show() changes that forever. |
107 NSInteger attention_request_id_; // identifier from requestUserAttention. | 109 NSInteger attention_request_id_; // identifier from requestUserAttention. |
108 | 110 |
109 // Indicates how the window corner should be rendered, rounded or not. | 111 // Indicates how the window corner should be rendered, rounded or not. |
110 panel::CornerStyle corner_style_; | 112 panel::CornerStyle corner_style_; |
111 | 113 |
112 DISALLOW_COPY_AND_ASSIGN(PanelCocoa); | 114 DISALLOW_COPY_AND_ASSIGN(PanelCocoa); |
113 }; | 115 }; |
114 | 116 |
115 #endif // CHROME_BROWSER_UI_COCOA_PANELS_PANEL_COCOA_H_ | 117 #endif // CHROME_BROWSER_UI_COCOA_PANELS_PANEL_COCOA_H_ |
OLD | NEW |