| 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 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "chrome/browser/devtools/devtools_window.h" | 12 #include "chrome/browser/devtools/devtools_window.h" |
| 13 #include "chrome/browser/extensions/extension_view_host.h" | 13 #include "chrome/browser/extensions/extension_view_host.h" |
| 14 #include "chrome/browser/extensions/extension_view_host_factory.h" | 14 #include "chrome/browser/extensions/extension_view_host_factory.h" |
| 15 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
| 16 #import "chrome/browser/ui/cocoa/browser_window_cocoa.h" | 16 #import "chrome/browser/ui/cocoa/browser_window_cocoa.h" |
| 17 #import "chrome/browser/ui/cocoa/extensions/extension_view_mac.h" | 17 #import "chrome/browser/ui/cocoa/extensions/extension_view_mac.h" |
| 18 #import "chrome/browser/ui/cocoa/info_bubble_window.h" | 18 #import "chrome/browser/ui/cocoa/info_bubble_window.h" |
| 19 #include "chrome/common/url_constants.h" | 19 #include "chrome/common/url_constants.h" |
| 20 #include "components/web_modal/web_contents_modal_dialog_manager.h" | 20 #include "components/web_modal/web_contents_modal_dialog_manager.h" |
| 21 #include "content/public/browser/browser_context.h" | 21 #include "content/public/browser/browser_context.h" |
| 22 #include "content/public/browser/devtools_agent_host.h" | 22 #include "content/public/browser/devtools_agent_host.h" |
| 23 #include "content/public/browser/notification_details.h" | 23 #include "content/public/browser/notification_details.h" |
| 24 #include "content/public/browser/notification_source.h" | 24 #include "content/public/browser/notification_source.h" |
| 25 #include "extensions/browser/notification_types.h" | 25 #include "extensions/browser/notification_types.h" |
| 26 #include "ui/base/cocoa/cocoa_base_utils.h" |
| 26 #include "ui/base/cocoa/window_size_constants.h" | 27 #include "ui/base/cocoa/window_size_constants.h" |
| 27 | 28 |
| 28 using content::BrowserContext; | 29 using content::BrowserContext; |
| 29 using content::RenderViewHost; | 30 using content::RenderViewHost; |
| 30 using content::WebContents; | 31 using content::WebContents; |
| 31 using extensions::ExtensionViewHost; | 32 using extensions::ExtensionViewHost; |
| 32 | 33 |
| 33 namespace { | 34 namespace { |
| 34 | 35 |
| 35 // The duration for any animations that might be invoked by this controller. | 36 // The duration for any animations that might be invoked by this controller. |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 arrowLocation:(info_bubble::BubbleArrowLocation)arrowLocation | 170 arrowLocation:(info_bubble::BubbleArrowLocation)arrowLocation |
| 170 devMode:(BOOL)devMode { | 171 devMode:(BOOL)devMode { |
| 171 base::scoped_nsobject<InfoBubbleWindow> window([[InfoBubbleWindow alloc] | 172 base::scoped_nsobject<InfoBubbleWindow> window([[InfoBubbleWindow alloc] |
| 172 initWithContentRect:ui::kWindowSizeDeterminedLater | 173 initWithContentRect:ui::kWindowSizeDeterminedLater |
| 173 styleMask:NSBorderlessWindowMask | 174 styleMask:NSBorderlessWindowMask |
| 174 backing:NSBackingStoreBuffered | 175 backing:NSBackingStoreBuffered |
| 175 defer:NO]); | 176 defer:NO]); |
| 176 if (!window.get()) | 177 if (!window.get()) |
| 177 return nil; | 178 return nil; |
| 178 | 179 |
| 179 anchoredAt = [parentWindow convertBaseToScreen:anchoredAt]; | 180 anchoredAt = ui::ConvertPointFromWindowToScreen(parentWindow, anchoredAt); |
| 180 if ((self = [super initWithWindow:window | 181 if ((self = [super initWithWindow:window |
| 181 parentWindow:parentWindow | 182 parentWindow:parentWindow |
| 182 anchoredAt:anchoredAt])) { | 183 anchoredAt:anchoredAt])) { |
| 183 beingInspected_ = devMode; | 184 beingInspected_ = devMode; |
| 184 ignoreWindowDidResignKey_ = NO; | 185 ignoreWindowDidResignKey_ = NO; |
| 185 [[self bubble] setArrowLocation:arrowLocation]; | 186 [[self bubble] setArrowLocation:arrowLocation]; |
| 186 if (!gAnimationsEnabled) | 187 if (!gAnimationsEnabled) |
| 187 [window setAllowedAnimations:info_bubble::kAnimateNone]; | 188 [window setAllowedAnimations:info_bubble::kAnimateNone]; |
| 188 } | 189 } |
| 189 return self; | 190 return self; |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 return minSize; | 443 return minSize; |
| 443 } | 444 } |
| 444 | 445 |
| 445 // Private (TestingAPI) | 446 // Private (TestingAPI) |
| 446 + (NSSize)maxPopupSize { | 447 + (NSSize)maxPopupSize { |
| 447 NSSize maxSize = {ExtensionViewMac::kMaxWidth, ExtensionViewMac::kMaxHeight}; | 448 NSSize maxSize = {ExtensionViewMac::kMaxWidth, ExtensionViewMac::kMaxHeight}; |
| 448 return maxSize; | 449 return maxSize; |
| 449 } | 450 } |
| 450 | 451 |
| 451 @end | 452 @end |
| OLD | NEW |