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

Side by Side Diff: chrome/browser/ui/cocoa/permission_bubble/permission_bubble_controller.mm

Issue 2786943003: [Mac] Fix a potential crash in the permission bubble controller (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/permission_bubble/permission_bubble_controller. h" 5 #import "chrome/browser/ui/cocoa/permission_bubble/permission_bubble_controller. h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/mac/bind_objc_block.h" 9 #include "base/mac/bind_objc_block.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 - (void)windowWillClose:(NSNotification*)notification { 275 - (void)windowWillClose:(NSNotification*)notification {
276 [[NSNotificationCenter defaultCenter] 276 [[NSNotificationCenter defaultCenter]
277 removeObserver:self 277 removeObserver:self
278 name:NSWindowDidMoveNotification 278 name:NSWindowDidMoveNotification
279 object:nil]; 279 object:nil];
280 bridge_->OnBubbleClosing(); 280 bridge_->OnBubbleClosing();
281 [super windowWillClose:notification]; 281 [super windowWillClose:notification];
282 } 282 }
283 283
284 - (void)showWindow:(id)sender { 284 - (void)showWindow:(id)sender {
285 if ([self hasVisibleLocationBar]) { 285 LocationBarViewMac* bridge =
286 decoration_ = [[self.parentWindow windowController] locationBarBridge] 286 [[self.parentWindow windowController] locationBarBridge];
287 ->GetPageInfoDecoration(); 287 if ([self hasVisibleLocationBar] && bridge) {
288 decoration_ = bridge->GetPageInfoDecoration();
288 decoration_->SetActive(true); 289 decoration_->SetActive(true);
289 } 290 }
290 291
291 [super showWindow:sender]; 292 [super showWindow:sender];
292 } 293 }
293 294
294 - (void)close { 295 - (void)close {
295 if (decoration_) { 296 if (decoration_) {
296 decoration_->SetActive(false); 297 decoration_->SetActive(false);
297 decoration_ = nullptr; 298 decoration_ = nullptr;
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 } 658 }
658 659
659 - (IBAction)cancel:(id)sender { 660 - (IBAction)cancel:(id)sender {
660 // This is triggered by ESC when the bubble has focus. 661 // This is triggered by ESC when the bubble has focus.
661 if (delegate_) 662 if (delegate_)
662 delegate_->Closing(); 663 delegate_->Closing();
663 [super cancel:sender]; 664 [super cancel:sender];
664 } 665 }
665 666
666 @end // implementation PermissionBubbleController 667 @end // implementation PermissionBubbleController
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698