OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
6 | 6 |
7 #include "base/scoped_nsobject.h" | 7 #include "base/scoped_nsobject.h" |
8 #include "base/scoped_ptr.h" | 8 #include "base/scoped_ptr.h" |
9 #import "chrome/browser/cocoa/base_bubble_controller.h" | 9 #import "chrome/browser/cocoa/base_bubble_controller.h" |
10 #include "chrome/browser/page_info_model.h" | 10 #include "chrome/browser/page_info_model.h" |
11 | 11 |
12 // This NSWindowController subclass manages the InfoBubbleWindow and view that | 12 // This NSWindowController subclass manages the InfoBubbleWindow and view that |
13 // are displayed when the user clicks the security lock icon. | 13 // are displayed when the user clicks the security lock icon. |
14 @interface PageInfoBubbleController : BaseBubbleController { | 14 @interface PageInfoBubbleController : BaseBubbleController { |
15 @private | 15 @private |
16 // The model that generates the content displayed by the controller. | 16 // The model that generates the content displayed by the controller. |
17 scoped_ptr<PageInfoModel> model_; | 17 scoped_ptr<PageInfoModel> model_; |
18 | 18 |
19 // Thin bridge that pushes model-changed notifications from C++ to Cocoa. | 19 // Thin bridge that pushes model-changed notifications from C++ to Cocoa. |
20 scoped_ptr<PageInfoModel::PageInfoModelObserver> bridge_; | 20 scoped_ptr<PageInfoModel::PageInfoModelObserver> bridge_; |
21 | 21 |
22 // The certificate ID for the page, 0 if the page is not over HTTPS. | 22 // The certificate ID for the page, 0 if the page is not over HTTPS. |
23 int certID_; | 23 int certID_; |
24 | |
25 // Reference to the images that are placed within the UI. | |
26 scoped_nsobject<NSImage> okImage_; | |
27 scoped_nsobject<NSImage> warningMinorImage_; | |
28 scoped_nsobject<NSImage> warningMajorImage_; | |
29 scoped_nsobject<NSImage> errorImage_; | |
30 } | 24 } |
31 | 25 |
32 @property (nonatomic, assign) int certID; | 26 @property (nonatomic, assign) int certID; |
33 | 27 |
34 // Designated initializer. The new instance will take ownership of |model| and | 28 // Designated initializer. The new instance will take ownership of |model| and |
35 // |bridge|. There should be a 1:1 mapping of models to bridges. The | 29 // |bridge|. There should be a 1:1 mapping of models to bridges. The |
36 // controller will release itself when the bubble is closed. | 30 // controller will release itself when the bubble is closed. |
37 - (id)initWithPageInfoModel:(PageInfoModel*)model | 31 - (id)initWithPageInfoModel:(PageInfoModel*)model |
38 modelObserver:(PageInfoModel::PageInfoModelObserver*)bridge | 32 modelObserver:(PageInfoModel::PageInfoModelObserver*)bridge |
39 parentWindow:(NSWindow*)parentWindow; | 33 parentWindow:(NSWindow*)parentWindow; |
40 | 34 |
41 // Shows the certificate display window. Note that this will implicitly close | 35 // Shows the certificate display window. Note that this will implicitly close |
42 // the bubble because the certificate window will become key. The certificate | 36 // the bubble because the certificate window will become key. The certificate |
43 // information attaches itself as a sheet to the |parentWindow|. | 37 // information attaches itself as a sheet to the |parentWindow|. |
44 - (IBAction)showCertWindow:(id)sender; | 38 - (IBAction)showCertWindow:(id)sender; |
45 | 39 |
46 @end | 40 @end |
47 | 41 |
48 @interface PageInfoBubbleController (ExposedForUnitTesting) | 42 @interface PageInfoBubbleController (ExposedForUnitTesting) |
49 - (void)performLayout; | 43 - (void)performLayout; |
50 @end | 44 @end |
OLD | NEW |