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