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/browser_actions_controller.h" | 5 #import "chrome/browser/ui/cocoa/extensions/browser_actions_controller.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
10 #include "chrome/browser/extensions/extension_message_bubble_controller.h" | 10 #include "chrome/browser/extensions/extension_message_bubble_controller.h" |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 name:kBrowserActionsContainerMouseEntered | 386 name:kBrowserActionsContainerMouseEntered |
387 object:containerView_]; | 387 object:containerView_]; |
388 } | 388 } |
389 | 389 |
390 focusedViewIndex_ = -1; | 390 focusedViewIndex_ = -1; |
391 } | 391 } |
392 | 392 |
393 return self; | 393 return self; |
394 } | 394 } |
395 | 395 |
396 - (void)dealloc { | 396 - (void)browserWillBeDestroyed { |
| 397 [overflowMenu_ setDelegate:nil]; |
397 // Explicitly destroy the ToolbarActionsBar so all buttons get removed with a | 398 // Explicitly destroy the ToolbarActionsBar so all buttons get removed with a |
398 // valid BrowserActionsController, and so we can verify state before | 399 // valid BrowserActionsController, and so we can verify state before |
399 // destruction. | 400 // destruction. |
400 toolbarActionsBar_->DeleteActions(); | 401 toolbarActionsBar_->DeleteActions(); |
401 toolbarActionsBar_.reset(); | 402 toolbarActionsBar_.reset(); |
402 DCHECK_EQ(0u, [buttons_ count]); | 403 DCHECK_EQ(0u, [buttons_ count]); |
403 [[NSNotificationCenter defaultCenter] removeObserver:self]; | 404 [[NSNotificationCenter defaultCenter] removeObserver:self]; |
404 [super dealloc]; | 405 browser_ = nullptr; |
405 } | 406 } |
406 | 407 |
407 - (void)update { | 408 - (void)update { |
408 toolbarActionsBar_->Update(); | 409 toolbarActionsBar_->Update(); |
409 } | 410 } |
410 | 411 |
411 - (NSUInteger)buttonCount { | 412 - (NSUInteger)buttonCount { |
412 return [buttons_ count]; | 413 return [buttons_ count]; |
413 } | 414 } |
414 | 415 |
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1027 } | 1028 } |
1028 | 1029 |
1029 #pragma mark - | 1030 #pragma mark - |
1030 #pragma mark Testing Methods | 1031 #pragma mark Testing Methods |
1031 | 1032 |
1032 - (BrowserActionButton*)buttonWithIndex:(NSUInteger)index { | 1033 - (BrowserActionButton*)buttonWithIndex:(NSUInteger)index { |
1033 return index < [buttons_ count] ? [buttons_ objectAtIndex:index] : nil; | 1034 return index < [buttons_ count] ? [buttons_ objectAtIndex:index] : nil; |
1034 } | 1035 } |
1035 | 1036 |
1036 @end | 1037 @end |
OLD | NEW |