Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(200)

Side by Side Diff: chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm

Issue 1016473002: Make LoadMonitoringExtensionHostQueue remove itself as an ExtensionHost observer at the correct tim… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Another rename Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 void Observe(int type, 123 void Observe(int type,
124 const content::NotificationSource& source, 124 const content::NotificationSource& source,
125 const content::NotificationDetails& details) override { 125 const content::NotificationDetails& details) override {
126 switch (type) { 126 switch (type) {
127 case extensions::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING: { 127 case extensions::NOTIFICATION_EXTENSION_HOST_DID_STOP_FIRST_LOAD: {
128 if (content::Details<extensions::ExtensionViewHost>( 128 if (content::Details<extensions::ExtensionViewHost>(
129 [controller_ extensionViewHost]) == details) { 129 [controller_ extensionViewHost]) == details) {
130 [controller_ showDevTools]; 130 [controller_ showDevTools];
131 } 131 }
132 break; 132 break;
133 } 133 }
134 default: { 134 default: {
135 NOTREACHED() << "Received unexpected notification"; 135 NOTREACHED() << "Received unexpected notification";
136 break; 136 break;
137 } 137 }
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 selector:@selector(extensionViewFrameChanged) 302 selector:@selector(extensionViewFrameChanged)
303 name:NSViewFrameDidChangeNotification 303 name:NSViewFrameDidChangeNotification
304 object:extensionView_]; 304 object:extensionView_];
305 305
306 notificationBridge_.reset(new DevtoolsNotificationBridge(self)); 306 notificationBridge_.reset(new DevtoolsNotificationBridge(self));
307 registrar_.reset(new content::NotificationRegistrar); 307 registrar_.reset(new content::NotificationRegistrar);
308 if (beingInspected_) { 308 if (beingInspected_) {
309 // Listen for the extension to finish loading so the dev tools can be 309 // Listen for the extension to finish loading so the dev tools can be
310 // opened. 310 // opened.
311 registrar_->Add(notificationBridge_.get(), 311 registrar_->Add(notificationBridge_.get(),
312 extensions::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, 312 extensions::NOTIFICATION_EXTENSION_HOST_DID_STOP_FIRST_LOAD,
313 content::Source<BrowserContext>(host_->browser_context())); 313 content::Source<BrowserContext>(host_->browser_context()));
314 } 314 }
315 } 315 }
316 316
317 - (void)extensionViewFrameChanged { 317 - (void)extensionViewFrameChanged {
318 // If there are no changes in the width or height of the frame, then ignore. 318 // If there are no changes in the width or height of the frame, then ignore.
319 if (NSEqualSizes([extensionView_ frame].size, extensionFrame_.size)) 319 if (NSEqualSizes([extensionView_ frame].size, extensionFrame_.size))
320 return; 320 return;
321 321
322 extensionFrame_ = [extensionView_ frame]; 322 extensionFrame_ = [extensionView_ frame];
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 // the notification is fired (and consequently the view contents have loaded). 374 // the notification is fired (and consequently the view contents have loaded).
375 if (![window isVisible]) { 375 if (![window isVisible]) {
376 [self showWindow:self]; 376 [self showWindow:self];
377 } 377 }
378 } 378 }
379 379
380 - (void)onSizeChanged:(NSSize)newSize { 380 - (void)onSizeChanged:(NSSize)newSize {
381 // When we update the size, the window will become visible. Stay hidden until 381 // When we update the size, the window will become visible. Stay hidden until
382 // the host is loaded. 382 // the host is loaded.
383 pendingSize_ = newSize; 383 pendingSize_ = newSize;
384 if (!host_ || !host_->did_stop_loading()) 384 if (!host_ || !host_->has_loaded_once())
385 return; 385 return;
386 386
387 // No need to use CA here, our caller calls us repeatedly to animate the 387 // No need to use CA here, our caller calls us repeatedly to animate the
388 // resizing. 388 // resizing.
389 NSRect frame = [extensionView_ frame]; 389 NSRect frame = [extensionView_ frame];
390 frame.size = newSize; 390 frame.size = newSize;
391 391
392 // |new_size| is in pixels. Convert to view units. 392 // |new_size| is in pixels. Convert to view units.
393 frame.size = [extensionView_ convertSize:frame.size fromView:nil]; 393 frame.size = [extensionView_ convertSize:frame.size fromView:nil];
394 394
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 return minSize; 432 return minSize;
433 } 433 }
434 434
435 // Private (TestingAPI) 435 // Private (TestingAPI)
436 + (NSSize)maxPopupSize { 436 + (NSSize)maxPopupSize {
437 NSSize maxSize = {ExtensionViewMac::kMaxWidth, ExtensionViewMac::kMaxHeight}; 437 NSSize maxSize = {ExtensionViewMac::kMaxWidth, ExtensionViewMac::kMaxHeight};
438 return maxSize; 438 return maxSize;
439 } 439 }
440 440
441 @end 441 @end
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_view_host.cc ('k') | chrome/browser/ui/cocoa/extensions/extension_view_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698