| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/extensions/extension_host.h" | 9 #include "chrome/browser/extensions/extension_host.h" |
| 10 #include "chrome/browser/extensions/extension_process_manager.h" | 10 #include "chrome/browser/extensions/extension_process_manager.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 class DevtoolsNotificationBridge : public NotificationObserver { | 36 class DevtoolsNotificationBridge : public NotificationObserver { |
| 37 public: | 37 public: |
| 38 explicit DevtoolsNotificationBridge(ExtensionPopupController* controller) | 38 explicit DevtoolsNotificationBridge(ExtensionPopupController* controller) |
| 39 : controller_(controller) {} | 39 : controller_(controller) {} |
| 40 | 40 |
| 41 void Observe(NotificationType type, | 41 void Observe(NotificationType type, |
| 42 const NotificationSource& source, | 42 const NotificationSource& source, |
| 43 const NotificationDetails& details) { | 43 const NotificationDetails& details) { |
| 44 switch (type.value) { | 44 switch (type.value) { |
| 45 case NotificationType::EXTENSION_HOST_DID_STOP_LOADING: { | 45 case chrome::EXTENSION_HOST_DID_STOP_LOADING: { |
| 46 if (Details<ExtensionHost>([controller_ extensionHost]) == details) | 46 if (Details<ExtensionHost>([controller_ extensionHost]) == details) |
| 47 [controller_ showDevTools]; | 47 [controller_ showDevTools]; |
| 48 break; | 48 break; |
| 49 } | 49 } |
| 50 case NotificationType::DEVTOOLS_WINDOW_CLOSING: { | 50 case chrome::DEVTOOLS_WINDOW_CLOSING: { |
| 51 RenderViewHost* rvh = [controller_ extensionHost]->render_view_host(); | 51 RenderViewHost* rvh = [controller_ extensionHost]->render_view_host(); |
| 52 if (Details<RenderViewHost>(rvh) == details) | 52 if (Details<RenderViewHost>(rvh) == details) |
| 53 // Allow the devtools to finish detaching before we close the popup | 53 // Allow the devtools to finish detaching before we close the popup |
| 54 [controller_ performSelector:@selector(close) | 54 [controller_ performSelector:@selector(close) |
| 55 withObject:nil | 55 withObject:nil |
| 56 afterDelay:0.0]; | 56 afterDelay:0.0]; |
| 57 break; | 57 break; |
| 58 } | 58 } |
| 59 default: { | 59 default: { |
| 60 NOTREACHED() << "Received unexpected notification"; | 60 NOTREACHED() << "Received unexpected notification"; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 return nil; | 124 return nil; |
| 125 | 125 |
| 126 [window setDelegate:self]; | 126 [window setDelegate:self]; |
| 127 [window setContentView:view]; | 127 [window setContentView:view]; |
| 128 self = [super initWithWindow:window]; | 128 self = [super initWithWindow:window]; |
| 129 if (beingInspected_) { | 129 if (beingInspected_) { |
| 130 // Listen for the the devtools window closing. | 130 // Listen for the the devtools window closing. |
| 131 notificationBridge_.reset(new DevtoolsNotificationBridge(self)); | 131 notificationBridge_.reset(new DevtoolsNotificationBridge(self)); |
| 132 registrar_.reset(new NotificationRegistrar); | 132 registrar_.reset(new NotificationRegistrar); |
| 133 registrar_->Add(notificationBridge_.get(), | 133 registrar_->Add(notificationBridge_.get(), |
| 134 NotificationType::DEVTOOLS_WINDOW_CLOSING, | 134 chrome::DEVTOOLS_WINDOW_CLOSING, |
| 135 Source<Profile>(host->profile())); | 135 Source<Profile>(host->profile())); |
| 136 registrar_->Add(notificationBridge_.get(), | 136 registrar_->Add(notificationBridge_.get(), |
| 137 NotificationType::EXTENSION_HOST_DID_STOP_LOADING, | 137 chrome::EXTENSION_HOST_DID_STOP_LOADING, |
| 138 Source<Profile>(host->profile())); | 138 Source<Profile>(host->profile())); |
| 139 } | 139 } |
| 140 return self; | 140 return self; |
| 141 } | 141 } |
| 142 | 142 |
| 143 - (void)showDevTools { | 143 - (void)showDevTools { |
| 144 DevToolsWindow::OpenDevToolsWindow(host_->render_view_host()); | 144 DevToolsWindow::OpenDevToolsWindow(host_->render_view_host()); |
| 145 } | 145 } |
| 146 | 146 |
| 147 - (void)dealloc { | 147 - (void)dealloc { |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 return minSize; | 329 return minSize; |
| 330 } | 330 } |
| 331 | 331 |
| 332 // Private (TestingAPI) | 332 // Private (TestingAPI) |
| 333 + (NSSize)maxPopupSize { | 333 + (NSSize)maxPopupSize { |
| 334 NSSize maxSize = {ExtensionViewMac::kMaxWidth, ExtensionViewMac::kMaxHeight}; | 334 NSSize maxSize = {ExtensionViewMac::kMaxWidth, ExtensionViewMac::kMaxHeight}; |
| 335 return maxSize; | 335 return maxSize; |
| 336 } | 336 } |
| 337 | 337 |
| 338 @end | 338 @end |
| OLD | NEW |