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 "base/callback.h" | 9 #include "base/callback.h" |
10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 | 396 |
397 [extensionView_ setFrame:frame]; | 397 [extensionView_ setFrame:frame]; |
398 [extensionView_ setNeedsDisplay:YES]; | 398 [extensionView_ setNeedsDisplay:YES]; |
399 } | 399 } |
400 | 400 |
401 - (void)onViewDidShow { | 401 - (void)onViewDidShow { |
402 [self onSizeChanged:pendingSize_]; | 402 [self onSizeChanged:pendingSize_]; |
403 } | 403 } |
404 | 404 |
405 - (void)onWindowChanged { | 405 - (void)onWindowChanged { |
| 406 // The window is positioned before creating the host, to ensure the host is |
| 407 // created with the correct screen information. |
| 408 if (!host_) |
| 409 return; |
| 410 |
406 ExtensionViewMac* extensionView = | 411 ExtensionViewMac* extensionView = |
407 static_cast<ExtensionViewMac*>(host_->view()); | 412 static_cast<ExtensionViewMac*>(host_->view()); |
408 // Let the extension view know, so that it can tell plugins. | 413 // Let the extension view know, so that it can tell plugins. |
409 if (extensionView) | 414 if (extensionView) |
410 extensionView->WindowFrameChanged(); | 415 extensionView->WindowFrameChanged(); |
411 } | 416 } |
412 | 417 |
413 - (void)windowDidResize:(NSNotification*)notification { | 418 - (void)windowDidResize:(NSNotification*)notification { |
414 [self onWindowChanged]; | 419 [self onWindowChanged]; |
415 } | 420 } |
(...skipping 13 matching lines...) Expand all Loading... |
429 return minSize; | 434 return minSize; |
430 } | 435 } |
431 | 436 |
432 // Private (TestingAPI) | 437 // Private (TestingAPI) |
433 + (NSSize)maxPopupSize { | 438 + (NSSize)maxPopupSize { |
434 NSSize maxSize = {ExtensionViewMac::kMaxWidth, ExtensionViewMac::kMaxHeight}; | 439 NSSize maxSize = {ExtensionViewMac::kMaxWidth, ExtensionViewMac::kMaxHeight}; |
435 return maxSize; | 440 return maxSize; |
436 } | 441 } |
437 | 442 |
438 @end | 443 @end |
OLD | NEW |