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

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

Issue 1643963003: [Extensions UI Mac] Fix race condition in showing the icon surfacing bubble (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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/browser_actions_controller.h" 5 #import "chrome/browser/ui/cocoa/extensions/browser_actions_controller.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 } 372 }
373 373
374 if (isOverflow_) 374 if (isOverflow_)
375 toolbarActionsBar_->SetOverflowRowWidth(NSWidth([containerView_ frame])); 375 toolbarActionsBar_->SetOverflowRowWidth(NSWidth([containerView_ frame]));
376 376
377 buttons_.reset([[NSMutableArray alloc] init]); 377 buttons_.reset([[NSMutableArray alloc] init]);
378 toolbarActionsBar_->CreateActions(); 378 toolbarActionsBar_->CreateActions();
379 [self showChevronIfNecessaryInFrame:[containerView_ frame]]; 379 [self showChevronIfNecessaryInFrame:[containerView_ frame]];
380 [self updateGrippyCursors]; 380 [self updateGrippyCursors];
381 [container setIsOverflow:isOverflow_]; 381 [container setIsOverflow:isOverflow_];
382 if (ExtensionToolbarIconSurfacingBubbleDelegate::ShouldShowForProfile(
383 browser_->profile())) {
384 [containerView_ setTrackingEnabled:YES];
385 [[NSNotificationCenter defaultCenter]
386 addObserver:self
387 selector:@selector(containerMouseEntered:)
388 name:kBrowserActionsContainerMouseEntered
389 object:containerView_];
390 }
391 382
392 focusedViewIndex_ = -1; 383 focusedViewIndex_ = -1;
393 } 384 }
394 385
395 return self; 386 return self;
396 } 387 }
397 388
398 - (void)dealloc { 389 - (void)dealloc {
399 [self browserWillBeDestroyed]; 390 [self browserWillBeDestroyed];
400 [super dealloc]; 391 [super dealloc];
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 if (toolbarActionsBar_->is_highlighting()) { 556 if (toolbarActionsBar_->is_highlighting()) {
566 if (toolbarActionsBar_->highlight_type() == 557 if (toolbarActionsBar_->highlight_type() ==
567 ToolbarActionsModel::HIGHLIGHT_INFO) 558 ToolbarActionsModel::HIGHLIGHT_INFO)
568 highlight.reset( 559 highlight.reset(
569 new ui::NinePartImageIds(IMAGE_GRID(IDR_TOOLBAR_ACTION_HIGHLIGHT))); 560 new ui::NinePartImageIds(IMAGE_GRID(IDR_TOOLBAR_ACTION_HIGHLIGHT)));
570 else 561 else
571 highlight.reset( 562 highlight.reset(
572 new ui::NinePartImageIds(IMAGE_GRID(IDR_DEVELOPER_MODE_HIGHLIGHT))); 563 new ui::NinePartImageIds(IMAGE_GRID(IDR_DEVELOPER_MODE_HIGHLIGHT)));
573 } 564 }
574 [containerView_ setHighlight:std::move(highlight)]; 565 [containerView_ setHighlight:std::move(highlight)];
566 if (toolbarActionsBar_->show_icon_surfacing_bubble() &&
567 ![containerView_ trackingEnabled]) {
568 [containerView_ setTrackingEnabled:YES];
569 [[NSNotificationCenter defaultCenter]
570 addObserver:self
571 selector:@selector(containerMouseEntered:)
572 name:kBrowserActionsContainerMouseEntered
573 object:containerView_];
574 }
575 575
576 std::vector<ToolbarActionViewController*> toolbar_actions = 576 std::vector<ToolbarActionViewController*> toolbar_actions =
577 toolbarActionsBar_->GetActions(); 577 toolbarActionsBar_->GetActions();
578 for (NSUInteger i = 0; i < [buttons_ count]; ++i) { 578 for (NSUInteger i = 0; i < [buttons_ count]; ++i) {
579 ToolbarActionViewController* controller = 579 ToolbarActionViewController* controller =
580 [[self buttonAtIndex:i] viewController]; 580 [[self buttonAtIndex:i] viewController];
581 if (controller != toolbar_actions[i]) { 581 if (controller != toolbar_actions[i]) {
582 size_t j = i + 1; 582 size_t j = i + 1;
583 while (true) { 583 while (true) {
584 ToolbarActionViewController* other_controller = 584 ToolbarActionViewController* other_controller =
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
1052 } 1052 }
1053 1053
1054 #pragma mark - 1054 #pragma mark -
1055 #pragma mark Testing Methods 1055 #pragma mark Testing Methods
1056 1056
1057 - (BrowserActionButton*)buttonWithIndex:(NSUInteger)index { 1057 - (BrowserActionButton*)buttonWithIndex:(NSUInteger)index {
1058 return index < [buttons_ count] ? [buttons_ objectAtIndex:index] : nil; 1058 return index < [buttons_ count] ? [buttons_ objectAtIndex:index] : nil;
1059 } 1059 }
1060 1060
1061 @end 1061 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698