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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 devMode:(BOOL)devMode { | 278 devMode:(BOOL)devMode { |
279 DCHECK([NSThread isMainThread]); | 279 DCHECK([NSThread isMainThread]); |
280 DCHECK(browser); | 280 DCHECK(browser); |
281 if (!browser) | 281 if (!browser) |
282 return nil; | 282 return nil; |
283 | 283 |
284 // If we click the browser/page action again, we should close the popup. | 284 // If we click the browser/page action again, we should close the popup. |
285 // Make Mac behavior the same with Windows and others. | 285 // Make Mac behavior the same with Windows and others. |
286 if (gPopup) { | 286 if (gPopup) { |
287 std::string extension_id = url.host(); | 287 std::string extension_id = url.host(); |
288 if (url.SchemeIs(content::kChromeUIScheme) && | |
289 url.host() == chrome::kChromeUIExtensionInfoHost) | |
290 extension_id = url.path().substr(1); | |
291 extensions::ExtensionViewHost* host = [gPopup extensionViewHost]; | 288 extensions::ExtensionViewHost* host = [gPopup extensionViewHost]; |
292 if (extension_id == host->extension_id()) { | 289 if (extension_id == host->extension_id()) { |
293 [gPopup close]; | 290 [gPopup close]; |
294 return nil; | 291 return nil; |
295 } | 292 } |
296 } | 293 } |
297 | 294 |
298 extensions::ExtensionViewHost* host = | 295 extensions::ExtensionViewHost* host = |
299 extensions::ExtensionViewHostFactory::CreatePopupHost(url, browser); | 296 extensions::ExtensionViewHostFactory::CreatePopupHost(url, browser); |
300 DCHECK(host); | 297 DCHECK(host); |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 return minSize; | 432 return minSize; |
436 } | 433 } |
437 | 434 |
438 // Private (TestingAPI) | 435 // Private (TestingAPI) |
439 + (NSSize)maxPopupSize { | 436 + (NSSize)maxPopupSize { |
440 NSSize maxSize = {ExtensionViewMac::kMaxWidth, ExtensionViewMac::kMaxHeight}; | 437 NSSize maxSize = {ExtensionViewMac::kMaxWidth, ExtensionViewMac::kMaxHeight}; |
441 return maxSize; | 438 return maxSize; |
442 } | 439 } |
443 | 440 |
444 @end | 441 @end |
OLD | NEW |