OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_INFOBARS_INFOBAR_COCOA_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_INFOBARS_INFOBAR_COCOA_H_ |
6 #define CHROME_BROWSER_UI_COCOA_INFOBARS_INFOBAR_COCOA_H_ | 6 #define CHROME_BROWSER_UI_COCOA_INFOBARS_INFOBAR_COCOA_H_ |
7 | 7 |
8 #include "base/mac/scoped_nsobject.h" | 8 #include "base/mac/scoped_nsobject.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "components/infobars/core/infobar.h" | 11 #include "components/infobars/core/infobar.h" |
12 | 12 |
13 @class InfoBarController; | 13 @class InfoBarController; |
14 | 14 |
15 // The cocoa specific implementation of InfoBar. The real info bar logic is | 15 // The cocoa specific implementation of InfoBar. The real info bar logic is |
16 // actually in InfoBarController. | 16 // actually in InfoBarController. |
17 class InfoBarCocoa : public infobars::InfoBar { | 17 class InfoBarCocoa : public infobars::InfoBar { |
18 public: | 18 public: |
19 explicit InfoBarCocoa(scoped_ptr<infobars::InfoBarDelegate> delegate); | 19 explicit InfoBarCocoa(std::unique_ptr<infobars::InfoBarDelegate> delegate); |
20 | 20 |
21 ~InfoBarCocoa() override; | 21 ~InfoBarCocoa() override; |
22 | 22 |
23 InfoBarController* controller() const { return controller_; } | 23 InfoBarController* controller() const { return controller_; } |
24 | 24 |
25 void set_controller(InfoBarController* controller) { | 25 void set_controller(InfoBarController* controller) { |
26 controller_.reset([controller retain]); | 26 controller_.reset([controller retain]); |
27 } | 27 } |
28 | 28 |
29 // These functions allow access to protected InfoBar functions. | 29 // These functions allow access to protected InfoBar functions. |
30 infobars::InfoBarManager* OwnerCocoa(); | 30 infobars::InfoBarManager* OwnerCocoa(); |
31 | 31 |
32 base::WeakPtr<InfoBarCocoa> GetWeakPtr(); | 32 base::WeakPtr<InfoBarCocoa> GetWeakPtr(); |
33 | 33 |
34 private: | 34 private: |
35 // The Objective-C class that contains most of the info bar logic. | 35 // The Objective-C class that contains most of the info bar logic. |
36 base::scoped_nsobject<InfoBarController> controller_; | 36 base::scoped_nsobject<InfoBarController> controller_; |
37 | 37 |
38 // Used to vend the link back to this for |controller_|. | 38 // Used to vend the link back to this for |controller_|. |
39 base::WeakPtrFactory<InfoBarCocoa> weak_ptr_factory_; | 39 base::WeakPtrFactory<InfoBarCocoa> weak_ptr_factory_; |
40 | 40 |
41 DISALLOW_COPY_AND_ASSIGN(InfoBarCocoa); | 41 DISALLOW_COPY_AND_ASSIGN(InfoBarCocoa); |
42 }; | 42 }; |
43 | 43 |
44 #endif // CHROME_BROWSER_UI_COCOA_INFOBARS_INFOBAR_COCOA_H_ | 44 #endif // CHROME_BROWSER_UI_COCOA_INFOBARS_INFOBAR_COCOA_H_ |
OLD | NEW |