| 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_EXTENSIONS_EXTENSION_INSTALLED_BUBBLE_CONTROLLER
_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_INSTALLED_BUBBLE_CONTROLLER
_H_ |
| 6 #define CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_INSTALLED_BUBBLE_CONTROLLER
_H_ | 6 #define CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_INSTALLED_BUBBLE_CONTROLLER
_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #import <Cocoa/Cocoa.h> | 9 #import <Cocoa/Cocoa.h> |
| 10 | 10 |
| 11 #import "base/mac/cocoa_protocols.h" | 11 #import "base/mac/cocoa_protocols.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 13 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
| 14 #import "chrome/browser/ui/cocoa/base_bubble_controller.h" |
| 14 #include "third_party/skia/include/core/SkBitmap.h" | 15 #include "third_party/skia/include/core/SkBitmap.h" |
| 15 | 16 |
| 16 class Browser; | 17 class Browser; |
| 17 class Extension; | 18 class Extension; |
| 18 class ExtensionLoadedNotificationObserver; | 19 class ExtensionLoadedNotificationObserver; |
| 19 @class HoverCloseButton; | 20 @class HoverCloseButton; |
| 20 @class InfoBubbleView; | 21 @class InfoBubbleView; |
| 21 | 22 |
| 22 namespace extensions { | 23 namespace extensions { |
| 23 class BundleInstaller; | 24 class BundleInstaller; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 36 | 37 |
| 37 // We use a different kind of notification for each of these extension types. | 38 // We use a different kind of notification for each of these extension types. |
| 38 typedef enum { | 39 typedef enum { |
| 39 kBrowserAction, | 40 kBrowserAction, |
| 40 kGeneric, | 41 kGeneric, |
| 41 kOmniboxKeyword, | 42 kOmniboxKeyword, |
| 42 kPageAction, | 43 kPageAction, |
| 43 kBundle, | 44 kBundle, |
| 44 } ExtensionType; | 45 } ExtensionType; |
| 45 | 46 |
| 46 } | 47 } // namespace extension_installed_bubble |
| 47 | 48 |
| 48 // Controller for the extension installed bubble. This bubble pops up after | 49 // Controller for the extension installed bubble. This bubble pops up after |
| 49 // an extension has been installed to inform the user that the install happened | 50 // an extension has been installed to inform the user that the install happened |
| 50 // properly, and to let the user know how to manage this extension in the | 51 // properly, and to let the user know how to manage this extension in the |
| 51 // future. | 52 // future. |
| 52 @interface ExtensionInstalledBubbleController : | 53 @interface ExtensionInstalledBubbleController : BaseBubbleController { |
| 53 NSWindowController<NSWindowDelegate> { | |
| 54 @private | 54 @private |
| 55 NSWindow* parentWindow_; // weak | |
| 56 const Extension* extension_; // weak | 55 const Extension* extension_; // weak |
| 57 const extensions::BundleInstaller* bundle_; // weak | 56 const extensions::BundleInstaller* bundle_; // weak |
| 58 Browser* browser_; // weak | 57 Browser* browser_; // weak |
| 59 scoped_nsobject<NSImage> icon_; | 58 scoped_nsobject<NSImage> icon_; |
| 60 | 59 |
| 61 extension_installed_bubble::ExtensionType type_; | 60 extension_installed_bubble::ExtensionType type_; |
| 62 | 61 |
| 63 // We need to remove the page action immediately when the browser window | 62 // We need to remove the page action immediately when the browser window |
| 64 // closes while this bubble is still open, so the bubble's closing animation | 63 // closes while this bubble is still open, so the bubble's closing animation |
| 65 // doesn't overlap browser destruction. | 64 // doesn't overlap browser destruction. |
| 66 BOOL pageActionRemoved_; | 65 BOOL pageActionRemoved_; |
| 67 | 66 |
| 68 // Lets us register for EXTENSION_LOADED notifications. The actual | 67 // Lets us register for EXTENSION_LOADED notifications. The actual |
| 69 // notifications are sent to the observer object, which proxies them | 68 // notifications are sent to the observer object, which proxies them |
| 70 // back to the controller. | 69 // back to the controller. |
| 71 scoped_ptr<ExtensionLoadedNotificationObserver> extensionObserver_; | 70 scoped_ptr<ExtensionLoadedNotificationObserver> extensionObserver_; |
| 72 | 71 |
| 73 // References below are weak, being obtained from the nib. | 72 // References below are weak, being obtained from the nib. |
| 74 IBOutlet InfoBubbleView* infoBubbleView_; | |
| 75 IBOutlet HoverCloseButton* closeButton_; | 73 IBOutlet HoverCloseButton* closeButton_; |
| 76 IBOutlet NSImageView* iconImage_; | 74 IBOutlet NSImageView* iconImage_; |
| 77 IBOutlet NSTextField* extensionInstalledMsg_; | 75 IBOutlet NSTextField* extensionInstalledMsg_; |
| 78 // Only shown for page actions and omnibox keywords. | 76 // Only shown for page actions and omnibox keywords. |
| 79 IBOutlet NSTextField* extraInfoMsg_; | 77 IBOutlet NSTextField* extraInfoMsg_; |
| 80 IBOutlet NSTextField* extensionInstalledInfoMsg_; | 78 IBOutlet NSTextField* extensionInstalledInfoMsg_; |
| 81 // Only shown for bundle installs. | 79 // Only shown for bundle installs. |
| 82 IBOutlet NSTextField* installedHeadingMsg_; | 80 IBOutlet NSTextField* installedHeadingMsg_; |
| 83 IBOutlet NSTextField* installedItemsMsg_; | 81 IBOutlet NSTextField* installedItemsMsg_; |
| 84 IBOutlet NSTextField* failedHeadingMsg_; | 82 IBOutlet NSTextField* failedHeadingMsg_; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 103 // Displays the extension installed bubble. This callback is triggered by | 101 // Displays the extension installed bubble. This callback is triggered by |
| 104 // the extensionObserver when the extension has completed loading. | 102 // the extensionObserver when the extension has completed loading. |
| 105 - (void)showWindow:(id)sender; | 103 - (void)showWindow:(id)sender; |
| 106 | 104 |
| 107 // Clears our weak pointer to the Extension. This callback is triggered by | 105 // Clears our weak pointer to the Extension. This callback is triggered by |
| 108 // the extensionObserver when the extension is unloaded. | 106 // the extensionObserver when the extension is unloaded. |
| 109 - (void)extensionUnloaded:(id)sender; | 107 - (void)extensionUnloaded:(id)sender; |
| 110 | 108 |
| 111 @end | 109 @end |
| 112 | 110 |
| 113 @interface ExtensionInstalledBubbleController(ExposedForTesting) | 111 @interface ExtensionInstalledBubbleController (ExposedForTesting) |
| 114 | 112 |
| 115 - (void)removePageActionPreviewIfNecessary; | 113 - (void)removePageActionPreviewIfNecessary; |
| 116 - (NSWindow*)initializeWindow; | 114 - (NSWindow*)initializeWindow; |
| 117 - (int)calculateWindowHeight; | 115 - (int)calculateWindowHeight; |
| 118 - (void)setMessageFrames:(int)newWindowHeight; | 116 - (void)setMessageFrames:(int)newWindowHeight; |
| 119 - (NSRect)getExtensionInstalledMsgFrame; | 117 - (NSRect)getExtensionInstalledMsgFrame; |
| 120 - (NSRect)getExtraInfoMsgFrame; | 118 - (NSRect)getExtraInfoMsgFrame; |
| 121 - (NSRect)getExtensionInstalledInfoMsgFrame; | 119 - (NSRect)getExtensionInstalledInfoMsgFrame; |
| 122 | 120 |
| 123 @end // ExtensionInstalledBubbleController(ExposedForTesting) | 121 @end // ExtensionInstalledBubbleController(ExposedForTesting) |
| 124 | 122 |
| 125 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_INSTALLED_BUBBLE_CONTROL
LER_H_ | 123 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_INSTALLED_BUBBLE_CONTROL
LER_H_ |
| OLD | NEW |