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

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

Issue 1009613002: [Toolbar UI Mac] Fix omnibox minimum width (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Avi's 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/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/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 [newButton setTarget:self]; 466 [newButton setTarget:self];
467 [newButton setAction:@selector(browserActionClicked:)]; 467 [newButton setAction:@selector(browserActionClicked:)];
468 [buttons_ insertObject:newButton atIndex:index]; 468 [buttons_ insertObject:newButton atIndex:index];
469 469
470 [[NSNotificationCenter defaultCenter] 470 [[NSNotificationCenter defaultCenter]
471 addObserver:self 471 addObserver:self
472 selector:@selector(actionButtonDragging:) 472 selector:@selector(actionButtonDragging:)
473 name:kBrowserActionButtonDraggingNotification 473 name:kBrowserActionButtonDraggingNotification
474 object:newButton]; 474 object:newButton];
475 475
476 [containerView_ setMaxWidth:toolbarActionsBar_->GetMaximumWidth()]; 476 [containerView_ setMaxDesiredWidth:toolbarActionsBar_->GetMaximumWidth()];
477 } 477 }
478 478
479 - (void)redraw { 479 - (void)redraw {
480 if (![self updateContainerVisibility]) 480 if (![self updateContainerVisibility])
481 return; // Container is hidden; no need to update. 481 return; // Container is hidden; no need to update.
482 482
483 std::vector<ToolbarActionViewController*> toolbar_actions = 483 std::vector<ToolbarActionViewController*> toolbar_actions =
484 toolbarActionsBar_->toolbar_actions(); 484 toolbarActionsBar_->toolbar_actions();
485 for (NSUInteger i = 0; i < [buttons_ count]; ++i) { 485 for (NSUInteger i = 0; i < [buttons_ count]; ++i) {
486 if ([[buttons_ objectAtIndex:i] viewController] != toolbar_actions[i]) { 486 if ([[buttons_ objectAtIndex:i] viewController] != toolbar_actions[i]) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 } 521 }
522 } 522 }
523 523
524 - (void)removeViewForAction:(ToolbarActionViewController*)action { 524 - (void)removeViewForAction:(ToolbarActionViewController*)action {
525 BrowserActionButton* button = [self buttonForId:action->GetId()]; 525 BrowserActionButton* button = [self buttonForId:action->GetId()];
526 526
527 [button removeFromSuperview]; 527 [button removeFromSuperview];
528 [button onRemoved]; 528 [button onRemoved];
529 [buttons_ removeObject:button]; 529 [buttons_ removeObject:button];
530 530
531 [containerView_ setMaxWidth:toolbarActionsBar_->GetMaximumWidth()]; 531 [containerView_ setMaxDesiredWidth:toolbarActionsBar_->GetMaximumWidth()];
532 } 532 }
533 533
534 - (void)removeAllViews { 534 - (void)removeAllViews {
535 for (BrowserActionButton* button in buttons_.get()) { 535 for (BrowserActionButton* button in buttons_.get()) {
536 [button removeFromSuperview]; 536 [button removeFromSuperview];
537 [button onRemoved]; 537 [button onRemoved];
538 } 538 }
539 [buttons_ removeAllObjects]; 539 [buttons_ removeAllObjects];
540 } 540 }
541 541
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
868 - (ToolbarActionsBar*)toolbarActionsBar { 868 - (ToolbarActionsBar*)toolbarActionsBar {
869 return toolbarActionsBar_.get(); 869 return toolbarActionsBar_.get();
870 } 870 }
871 871
872 + (BrowserActionsController*)fromToolbarActionsBarDelegate: 872 + (BrowserActionsController*)fromToolbarActionsBarDelegate:
873 (ToolbarActionsBarDelegate*)delegate { 873 (ToolbarActionsBarDelegate*)delegate {
874 return static_cast<ToolbarActionsBarBridge*>(delegate)->controller_for_test(); 874 return static_cast<ToolbarActionsBarBridge*>(delegate)->controller_for_test();
875 } 875 }
876 876
877 @end 877 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698