| 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 "browser_actions_controller.h" | 5 #import "browser_actions_controller.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
| 11 #include "chrome/browser/extensions/extension_service.h" | 11 #include "chrome/browser/extensions/extension_service.h" |
| 12 #include "chrome/browser/extensions/extension_toolbar_model.h" | 12 #include "chrome/browser/extensions/extension_toolbar_model.h" |
| 13 #include "chrome/browser/prefs/pref_service.h" | 13 #include "chrome/browser/prefs/pref_service.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/browser/sessions/restore_tab_helper.h" | 15 #include "chrome/browser/sessions/session_tab_helper.h" |
| 16 #include "chrome/browser/ui/browser.h" | 16 #include "chrome/browser/ui/browser.h" |
| 17 #include "chrome/browser/ui/browser_tabstrip.h" | 17 #include "chrome/browser/ui/browser_tabstrip.h" |
| 18 #include "chrome/browser/ui/browser_window.h" | 18 #include "chrome/browser/ui/browser_window.h" |
| 19 #import "chrome/browser/ui/cocoa/extensions/browser_action_button.h" | 19 #import "chrome/browser/ui/cocoa/extensions/browser_action_button.h" |
| 20 #import "chrome/browser/ui/cocoa/extensions/browser_actions_container_view.h" | 20 #import "chrome/browser/ui/cocoa/extensions/browser_actions_container_view.h" |
| 21 #import "chrome/browser/ui/cocoa/extensions/extension_popup_controller.h" | 21 #import "chrome/browser/ui/cocoa/extensions/extension_popup_controller.h" |
| 22 #import "chrome/browser/ui/cocoa/image_button_cell.h" | 22 #import "chrome/browser/ui/cocoa/image_button_cell.h" |
| 23 #import "chrome/browser/ui/cocoa/menu_button.h" | 23 #import "chrome/browser/ui/cocoa/menu_button.h" |
| 24 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 24 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 25 #include "chrome/common/chrome_notification_types.h" | 25 #include "chrome/common/chrome_notification_types.h" |
| (...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 844 [containerView_ setCanDragLeft:[hiddenButtons_ count] > 0]; | 844 [containerView_ setCanDragLeft:[hiddenButtons_ count] > 0]; |
| 845 [containerView_ setCanDragRight:[self visibleButtonCount] > 0]; | 845 [containerView_ setCanDragRight:[self visibleButtonCount] > 0]; |
| 846 [[containerView_ window] invalidateCursorRectsForView:containerView_]; | 846 [[containerView_ window] invalidateCursorRectsForView:containerView_]; |
| 847 } | 847 } |
| 848 | 848 |
| 849 - (int)currentTabId { | 849 - (int)currentTabId { |
| 850 TabContents* selected_tab = chrome::GetActiveTabContents(browser_); | 850 TabContents* selected_tab = chrome::GetActiveTabContents(browser_); |
| 851 if (!selected_tab) | 851 if (!selected_tab) |
| 852 return -1; | 852 return -1; |
| 853 | 853 |
| 854 return selected_tab->restore_tab_helper()->session_id().id(); | 854 return selected_tab->session_tab_helper()->session_id().id(); |
| 855 } | 855 } |
| 856 | 856 |
| 857 #pragma mark - | 857 #pragma mark - |
| 858 #pragma mark Testing Methods | 858 #pragma mark Testing Methods |
| 859 | 859 |
| 860 - (NSButton*)buttonWithIndex:(NSUInteger)index { | 860 - (NSButton*)buttonWithIndex:(NSUInteger)index { |
| 861 if (profile_->IsOffTheRecord()) | 861 if (profile_->IsOffTheRecord()) |
| 862 index = toolbarModel_->IncognitoIndexToOriginal(index); | 862 index = toolbarModel_->IncognitoIndexToOriginal(index); |
| 863 const extensions::ExtensionList& toolbar_items = | 863 const extensions::ExtensionList& toolbar_items = |
| 864 toolbarModel_->toolbar_items(); | 864 toolbarModel_->toolbar_items(); |
| 865 if (index < toolbar_items.size()) { | 865 if (index < toolbar_items.size()) { |
| 866 const Extension* extension = toolbar_items[index]; | 866 const Extension* extension = toolbar_items[index]; |
| 867 return [buttons_ objectForKey:base::SysUTF8ToNSString(extension->id())]; | 867 return [buttons_ objectForKey:base::SysUTF8ToNSString(extension->id())]; |
| 868 } | 868 } |
| 869 return nil; | 869 return nil; |
| 870 } | 870 } |
| 871 | 871 |
| 872 @end | 872 @end |
| OLD | NEW |