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

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

Issue 451193003: Remove deprecated kBrowserActionContainerWidth pref (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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 <cmath> 7 #include <cmath>
8 #include <string> 8 #include <string>
9 9
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 if ([button extension] == extension) 372 if ([button extension] == extension)
373 return button; 373 return button;
374 } 374 }
375 NOTREACHED(); 375 NOTREACHED();
376 return nil; 376 return nil;
377 } 377 }
378 378
379 - (CGFloat)savedWidth { 379 - (CGFloat)savedWidth {
380 if (!toolbarModel_) 380 if (!toolbarModel_)
381 return 0; 381 return 0;
382 if (!profile_->GetPrefs()->HasPrefPath(
383 extensions::pref_names::kToolbarSize)) {
384 // Migration code to the new VisibleIconCount pref.
385 // TODO(mpcomplete): remove this at some point.
386 double predefinedWidth = profile_->GetPrefs()->GetDouble(
387 extensions::pref_names::kBrowserActionContainerWidth);
388 if (predefinedWidth != 0) {
389 int iconWidth = kBrowserActionWidth + kBrowserActionButtonPadding;
390 int extraWidth = kChevronWidth;
391 toolbarModel_->SetVisibleIconCount(
392 (predefinedWidth - extraWidth) / iconWidth);
393 }
394 }
Peter Kasting 2014/08/12 19:04:49 Make sure you remove any #includes (some of the pr
Devlin 2014/08/12 19:18:19 Whoops, done.
395 382
396 int savedButtonCount = toolbarModel_->GetVisibleIconCount(); 383 int savedButtonCount = toolbarModel_->GetVisibleIconCount();
397 if (savedButtonCount < 0 || // all icons are visible 384 if (savedButtonCount < 0 || // all icons are visible
398 static_cast<NSUInteger>(savedButtonCount) > [self buttonCount]) 385 static_cast<NSUInteger>(savedButtonCount) > [self buttonCount])
399 savedButtonCount = [self buttonCount]; 386 savedButtonCount = [self buttonCount];
400 return [self containerWidthWithButtonCount:savedButtonCount]; 387 return [self containerWidthWithButtonCount:savedButtonCount];
401 } 388 }
402 389
403 - (NSPoint)popupPointForBrowserAction:(const Extension*)extension { 390 - (NSPoint)popupPointForBrowserAction:(const Extension*)extension {
404 if (!extensions::ExtensionActionManager::Get(profile_)-> 391 if (!extensions::ExtensionActionManager::Get(profile_)->
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 const extensions::ExtensionList& toolbar_items = 873 const extensions::ExtensionList& toolbar_items =
887 toolbarModel_->toolbar_items(); 874 toolbarModel_->toolbar_items();
888 if (index < toolbar_items.size()) { 875 if (index < toolbar_items.size()) {
889 const Extension* extension = toolbar_items[index].get(); 876 const Extension* extension = toolbar_items[index].get();
890 return [buttons_ objectForKey:base::SysUTF8ToNSString(extension->id())]; 877 return [buttons_ objectForKey:base::SysUTF8ToNSString(extension->id())];
891 } 878 }
892 return nil; 879 return nil;
893 } 880 }
894 881
895 @end 882 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698