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 #import "chrome/browser/ui/cocoa/extensions/extension_popup_controller.h" | 5 #import "chrome/browser/ui/cocoa/extensions/extension_popup_controller.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "chrome/browser/debugger/devtools_window.h" | 9 #include "chrome/browser/debugger/devtools_window.h" |
10 #include "chrome/browser/extensions/extension_host.h" | 10 #include "chrome/browser/extensions/extension_host.h" |
11 #include "chrome/browser/extensions/extension_process_manager.h" | 11 #include "chrome/browser/extensions/extension_process_manager.h" |
12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
14 #import "chrome/browser/ui/cocoa/browser_window_cocoa.h" | 14 #import "chrome/browser/ui/cocoa/browser_window_cocoa.h" |
15 #import "chrome/browser/ui/cocoa/extensions/extension_view_mac.h" | 15 #import "chrome/browser/ui/cocoa/extensions/extension_view_mac.h" |
16 #import "chrome/browser/ui/cocoa/info_bubble_window.h" | 16 #import "chrome/browser/ui/cocoa/info_bubble_window.h" |
17 #include "chrome/common/chrome_notification_types.h" | 17 #include "chrome/common/chrome_notification_types.h" |
18 #include "content/public/browser/notification_details.h" | 18 #include "content/public/browser/notification_details.h" |
19 #include "content/public/browser/notification_registrar.h" | 19 #include "content/public/browser/notification_registrar.h" |
20 #include "content/public/browser/notification_source.h" | 20 #include "content/public/browser/notification_source.h" |
| 21 #include "ui/base/cocoa/window_size_constants.h" |
21 | 22 |
22 using content::RenderViewHost; | 23 using content::RenderViewHost; |
23 | 24 |
24 namespace { | 25 namespace { |
25 // The duration for any animations that might be invoked by this controller. | 26 // The duration for any animations that might be invoked by this controller. |
26 const NSTimeInterval kAnimationDuration = 0.2; | 27 const NSTimeInterval kAnimationDuration = 0.2; |
27 | 28 |
28 // There should only be one extension popup showing at one time. Keep a | 29 // There should only be one extension popup showing at one time. Keep a |
29 // reference to it here. | 30 // reference to it here. |
30 static ExtensionPopupController* gPopup; | 31 static ExtensionPopupController* gPopup; |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 | 123 |
123 @implementation ExtensionPopupController | 124 @implementation ExtensionPopupController |
124 | 125 |
125 - (id)initWithHost:(ExtensionHost*)host | 126 - (id)initWithHost:(ExtensionHost*)host |
126 parentWindow:(NSWindow*)parentWindow | 127 parentWindow:(NSWindow*)parentWindow |
127 anchoredAt:(NSPoint)anchoredAt | 128 anchoredAt:(NSPoint)anchoredAt |
128 arrowLocation:(info_bubble::BubbleArrowLocation)arrowLocation | 129 arrowLocation:(info_bubble::BubbleArrowLocation)arrowLocation |
129 devMode:(BOOL)devMode { | 130 devMode:(BOOL)devMode { |
130 scoped_nsobject<InfoBubbleWindow> window( | 131 scoped_nsobject<InfoBubbleWindow> window( |
131 [[InfoBubbleWindow alloc] | 132 [[InfoBubbleWindow alloc] |
132 initWithContentRect:NSZeroRect | 133 initWithContentRect:ui::kWindowSizeDeterminedLater |
133 styleMask:NSBorderlessWindowMask | 134 styleMask:NSBorderlessWindowMask |
134 backing:NSBackingStoreBuffered | 135 backing:NSBackingStoreBuffered |
135 defer:YES]); | 136 defer:YES]); |
136 if (!window.get()) | 137 if (!window.get()) |
137 return nil; | 138 return nil; |
138 anchoredAt = [parentWindow convertBaseToScreen:anchoredAt]; | 139 anchoredAt = [parentWindow convertBaseToScreen:anchoredAt]; |
139 if ((self = [super initWithWindow:window | 140 if ((self = [super initWithWindow:window |
140 parentWindow:parentWindow | 141 parentWindow:parentWindow |
141 anchoredAt:anchoredAt])) { | 142 anchoredAt:anchoredAt])) { |
142 host_.reset(host); | 143 host_.reset(host); |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 return minSize; | 369 return minSize; |
369 } | 370 } |
370 | 371 |
371 // Private (TestingAPI) | 372 // Private (TestingAPI) |
372 + (NSSize)maxPopupSize { | 373 + (NSSize)maxPopupSize { |
373 NSSize maxSize = {ExtensionViewMac::kMaxWidth, ExtensionViewMac::kMaxHeight}; | 374 NSSize maxSize = {ExtensionViewMac::kMaxWidth, ExtensionViewMac::kMaxHeight}; |
374 return maxSize; | 375 return maxSize; |
375 } | 376 } |
376 | 377 |
377 @end | 378 @end |
OLD | NEW |