| 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 <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 14 matching lines...) Expand all Loading... |
| 25 #import "chrome/browser/ui/cocoa/extensions/extension_popup_controller.h" | 25 #import "chrome/browser/ui/cocoa/extensions/extension_popup_controller.h" |
| 26 #import "chrome/browser/ui/cocoa/image_button_cell.h" | 26 #import "chrome/browser/ui/cocoa/image_button_cell.h" |
| 27 #import "chrome/browser/ui/cocoa/menu_button.h" | 27 #import "chrome/browser/ui/cocoa/menu_button.h" |
| 28 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 28 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 29 #include "chrome/common/extensions/api/extension_action/action_info.h" | 29 #include "chrome/common/extensions/api/extension_action/action_info.h" |
| 30 #include "chrome/common/pref_names.h" | 30 #include "chrome/common/pref_names.h" |
| 31 #include "content/public/browser/notification_details.h" | 31 #include "content/public/browser/notification_details.h" |
| 32 #include "content/public/browser/notification_observer.h" | 32 #include "content/public/browser/notification_observer.h" |
| 33 #include "content/public/browser/notification_registrar.h" | 33 #include "content/public/browser/notification_registrar.h" |
| 34 #include "content/public/browser/notification_source.h" | 34 #include "content/public/browser/notification_source.h" |
| 35 #include "extensions/browser/pref_names.h" |
| 35 #include "grit/theme_resources.h" | 36 #include "grit/theme_resources.h" |
| 36 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMNSAnimation+Duration.h
" | 37 #import "third_party/google_toolbox_for_mac/src/AppKit/GTMNSAnimation+Duration.h
" |
| 37 | 38 |
| 38 using extensions::Extension; | 39 using extensions::Extension; |
| 39 using extensions::ExtensionList; | 40 using extensions::ExtensionList; |
| 40 | 41 |
| 41 NSString* const kBrowserActionVisibilityChangedNotification = | 42 NSString* const kBrowserActionVisibilityChangedNotification = |
| 42 @"BrowserActionVisibilityChangedNotification"; | 43 @"BrowserActionVisibilityChangedNotification"; |
| 43 | 44 |
| 44 namespace { | 45 namespace { |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 if ([button extension] == extension) | 380 if ([button extension] == extension) |
| 380 return button; | 381 return button; |
| 381 } | 382 } |
| 382 NOTREACHED(); | 383 NOTREACHED(); |
| 383 return nil; | 384 return nil; |
| 384 } | 385 } |
| 385 | 386 |
| 386 - (CGFloat)savedWidth { | 387 - (CGFloat)savedWidth { |
| 387 if (!toolbarModel_) | 388 if (!toolbarModel_) |
| 388 return 0; | 389 return 0; |
| 389 if (!profile_->GetPrefs()->HasPrefPath(prefs::kExtensionToolbarSize)) { | 390 if (!profile_->GetPrefs()->HasPrefPath( |
| 391 extensions::pref_names::kToolbarSize)) { |
| 390 // Migration code to the new VisibleIconCount pref. | 392 // Migration code to the new VisibleIconCount pref. |
| 391 // TODO(mpcomplete): remove this at some point. | 393 // TODO(mpcomplete): remove this at some point. |
| 392 double predefinedWidth = | 394 double predefinedWidth = profile_->GetPrefs()->GetDouble( |
| 393 profile_->GetPrefs()->GetDouble(prefs::kBrowserActionContainerWidth); | 395 extensions::pref_names::kBrowserActionContainerWidth); |
| 394 if (predefinedWidth != 0) { | 396 if (predefinedWidth != 0) { |
| 395 int iconWidth = kBrowserActionWidth + kBrowserActionButtonPadding; | 397 int iconWidth = kBrowserActionWidth + kBrowserActionButtonPadding; |
| 396 int extraWidth = kChevronWidth; | 398 int extraWidth = kChevronWidth; |
| 397 toolbarModel_->SetVisibleIconCount( | 399 toolbarModel_->SetVisibleIconCount( |
| 398 (predefinedWidth - extraWidth) / iconWidth); | 400 (predefinedWidth - extraWidth) / iconWidth); |
| 399 } | 401 } |
| 400 } | 402 } |
| 401 | 403 |
| 402 int savedButtonCount = toolbarModel_->GetVisibleIconCount(); | 404 int savedButtonCount = toolbarModel_->GetVisibleIconCount(); |
| 403 if (savedButtonCount < 0 || // all icons are visible | 405 if (savedButtonCount < 0 || // all icons are visible |
| (...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 883 const extensions::ExtensionList& toolbar_items = | 885 const extensions::ExtensionList& toolbar_items = |
| 884 toolbarModel_->toolbar_items(); | 886 toolbarModel_->toolbar_items(); |
| 885 if (index < toolbar_items.size()) { | 887 if (index < toolbar_items.size()) { |
| 886 const Extension* extension = toolbar_items[index].get(); | 888 const Extension* extension = toolbar_items[index].get(); |
| 887 return [buttons_ objectForKey:base::SysUTF8ToNSString(extension->id())]; | 889 return [buttons_ objectForKey:base::SysUTF8ToNSString(extension->id())]; |
| 888 } | 890 } |
| 889 return nil; | 891 return nil; |
| 890 } | 892 } |
| 891 | 893 |
| 892 @end | 894 @end |
| OLD | NEW |