| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/memory/scoped_nsobject.h" | 7 #include "base/memory/scoped_nsobject.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #import "chrome/browser/ui/cocoa/base_bubble_controller.h" | 9 #import "chrome/browser/ui/cocoa/base_bubble_controller.h" |
| 10 | 10 |
| 11 class PageInfoModel; | 11 class PageInfoModel; |
| 12 class PageInfoModelObserver; | 12 class PageInfoModelObserver; |
| 13 | 13 |
| 14 namespace content { | 14 namespace content { |
| 15 class PageNavigator; | 15 class PageNavigator; |
| 16 class WebContents; |
| 16 } | 17 } |
| 17 | 18 |
| 18 // This NSWindowController subclass manages the InfoBubbleWindow and view that | 19 // This NSWindowController subclass manages the InfoBubbleWindow and view that |
| 19 // are displayed when the user clicks the security lock icon. | 20 // are displayed when the user clicks the security lock icon. |
| 20 @interface PageInfoBubbleController : BaseBubbleController { | 21 @interface PageInfoBubbleController : BaseBubbleController { |
| 21 @private | 22 @private |
| 22 // The model that generates the content displayed by the controller. | 23 // The model that generates the content displayed by the controller. |
| 23 scoped_ptr<PageInfoModel> model_; | 24 scoped_ptr<PageInfoModel> model_; |
| 24 | 25 |
| 25 // Thin bridge that pushes model-changed notifications from C++ to Cocoa. | 26 // Thin bridge that pushes model-changed notifications from C++ to Cocoa. |
| 26 scoped_ptr<PageInfoModelObserver> bridge_; | 27 scoped_ptr<PageInfoModelObserver> bridge_; |
| 27 | 28 |
| 28 // The certificate ID for the page, 0 if the page is not over HTTPS. | 29 // The certificate ID for the page, 0 if the page is not over HTTPS. |
| 29 int certID_; | 30 int certID_; |
| 30 | 31 |
| 32 // The WebContents that created the bubble. |
| 33 content::WebContents* webContents_; |
| 34 |
| 31 // Used for loading pages. | 35 // Used for loading pages. |
| 32 content::PageNavigator* navigator_; | 36 content::PageNavigator* navigator_; |
| 33 } | 37 } |
| 34 | 38 |
| 35 @property(nonatomic, assign) int certID; | 39 @property(nonatomic, assign) int certID; |
| 36 | 40 |
| 37 // Designated initializer. The new instance will take ownership of |model| and | 41 // Designated initializer. The new instance will take ownership of |model| and |
| 38 // |bridge|. There should be a 1:1 mapping of models to bridges. The | 42 // |bridge|. There should be a 1:1 mapping of models to bridges. The |
| 39 // controller will release itself when the bubble is closed. |parentWindow| | 43 // controller will release itself when the bubble is closed. |parentWindow| |
| 40 // cannot be nil. | 44 // cannot be nil. |
| 41 - (id)initWithPageInfoModel:(PageInfoModel*)model | 45 - (id)initWithPageInfoModel:(PageInfoModel*)model |
| 42 modelObserver:(PageInfoModelObserver*)bridge | 46 modelObserver:(PageInfoModelObserver*)bridge |
| 43 parentWindow:(NSWindow*)parentWindow | 47 parentWindow:(NSWindow*)parentWindow |
| 48 webContents:(content::WebContents*)webContents |
| 44 navigator:(content::PageNavigator*)navigator; | 49 navigator:(content::PageNavigator*)navigator; |
| 45 | 50 |
| 46 | 51 |
| 47 // Shows the certificate display window. Note that this will implicitly close | 52 // Shows the certificate display window. Note that this will implicitly close |
| 48 // the bubble because the certificate window will become key. The certificate | 53 // the bubble because the certificate window will become key. The certificate |
| 49 // information attaches itself as a sheet to the |parentWindow|. | 54 // information attaches itself as a sheet to the |parentWindow|. |
| 50 - (IBAction)showCertWindow:(id)sender; | 55 - (IBAction)showCertWindow:(id)sender; |
| 51 | 56 |
| 52 // Opens the help center link that explains the contents of the page info. | 57 // Opens the help center link that explains the contents of the page info. |
| 53 - (IBAction)showHelpPage:(id)sender; | 58 - (IBAction)showHelpPage:(id)sender; |
| 54 | 59 |
| 55 @end | 60 @end |
| 56 | 61 |
| 57 @interface PageInfoBubbleController (ExposedForUnitTesting) | 62 @interface PageInfoBubbleController (ExposedForUnitTesting) |
| 58 - (void)performLayout; | 63 - (void)performLayout; |
| 59 @end | 64 @end |
| OLD | NEW |