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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 @end | 68 @end |
69 | 69 |
70 class ExtensionPopupContainer : public ExtensionViewMac::Container { | 70 class ExtensionPopupContainer : public ExtensionViewMac::Container { |
71 public: | 71 public: |
72 explicit ExtensionPopupContainer(ExtensionPopupController* controller) | 72 explicit ExtensionPopupContainer(ExtensionPopupController* controller) |
73 : controller_(controller) { | 73 : controller_(controller) { |
74 } | 74 } |
75 | 75 |
76 virtual void OnExtensionSizeChanged( | 76 virtual void OnExtensionSizeChanged( |
77 ExtensionViewMac* view, | 77 ExtensionViewMac* view, |
78 const gfx::Size& new_size) OVERRIDE { | 78 const gfx::Size& new_size) override { |
79 [controller_ onSizeChanged: | 79 [controller_ onSizeChanged: |
80 NSMakeSize(new_size.width(), new_size.height())]; | 80 NSMakeSize(new_size.width(), new_size.height())]; |
81 } | 81 } |
82 | 82 |
83 virtual void OnExtensionViewDidShow(ExtensionViewMac* view) OVERRIDE { | 83 virtual void OnExtensionViewDidShow(ExtensionViewMac* view) override { |
84 [controller_ onViewDidShow]; | 84 [controller_ onViewDidShow]; |
85 } | 85 } |
86 | 86 |
87 private: | 87 private: |
88 ExtensionPopupController* controller_; // Weak; owns this. | 88 ExtensionPopupController* controller_; // Weak; owns this. |
89 }; | 89 }; |
90 | 90 |
91 class DevtoolsNotificationBridge : public content::NotificationObserver { | 91 class DevtoolsNotificationBridge : public content::NotificationObserver { |
92 public: | 92 public: |
93 explicit DevtoolsNotificationBridge(ExtensionPopupController* controller) | 93 explicit DevtoolsNotificationBridge(ExtensionPopupController* controller) |
(...skipping 22 matching lines...) Expand all Loading... |
116 // Allow the devtools to finish detaching before we close the popup. | 116 // Allow the devtools to finish detaching before we close the popup. |
117 [controller_ performSelector:@selector(close) | 117 [controller_ performSelector:@selector(close) |
118 withObject:nil | 118 withObject:nil |
119 afterDelay:0.0]; | 119 afterDelay:0.0]; |
120 } | 120 } |
121 } | 121 } |
122 | 122 |
123 virtual void Observe( | 123 virtual void Observe( |
124 int type, | 124 int type, |
125 const content::NotificationSource& source, | 125 const content::NotificationSource& source, |
126 const content::NotificationDetails& details) OVERRIDE { | 126 const content::NotificationDetails& details) override { |
127 switch (type) { | 127 switch (type) { |
128 case extensions::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING: { | 128 case extensions::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING: { |
129 if (content::Details<extensions::ExtensionViewHost>( | 129 if (content::Details<extensions::ExtensionViewHost>( |
130 [controller_ extensionViewHost]) == details) { | 130 [controller_ extensionViewHost]) == details) { |
131 [controller_ showDevTools]; | 131 [controller_ showDevTools]; |
132 } | 132 } |
133 break; | 133 break; |
134 } | 134 } |
135 default: { | 135 default: { |
136 NOTREACHED() << "Received unexpected notification"; | 136 NOTREACHED() << "Received unexpected notification"; |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 return minSize; | 434 return minSize; |
435 } | 435 } |
436 | 436 |
437 // Private (TestingAPI) | 437 // Private (TestingAPI) |
438 + (NSSize)maxPopupSize { | 438 + (NSSize)maxPopupSize { |
439 NSSize maxSize = {ExtensionViewMac::kMaxWidth, ExtensionViewMac::kMaxHeight}; | 439 NSSize maxSize = {ExtensionViewMac::kMaxWidth, ExtensionViewMac::kMaxHeight}; |
440 return maxSize; | 440 return maxSize; |
441 } | 441 } |
442 | 442 |
443 @end | 443 @end |
OLD | NEW |