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_browser_event_router.h" | 11 #include "chrome/browser/extensions/extension_browser_event_router.h" |
12 #include "chrome/browser/extensions/extension_service.h" | 12 #include "chrome/browser/extensions/extension_service.h" |
13 #include "chrome/browser/extensions/extension_toolbar_model.h" | 13 #include "chrome/browser/extensions/extension_toolbar_model.h" |
14 #include "chrome/browser/prefs/pref_service.h" | 14 #include "chrome/browser/prefs/pref_service.h" |
15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
16 #include "chrome/browser/sessions/restore_tab_helper.h" | 16 #include "chrome/browser/sessions/restore_tab_helper.h" |
17 #include "chrome/browser/ui/browser.h" | 17 #include "chrome/browser/ui/browser.h" |
| 18 #include "chrome/browser/ui/browser_tabstrip.h" |
18 #import "chrome/browser/ui/cocoa/extensions/browser_action_button.h" | 19 #import "chrome/browser/ui/cocoa/extensions/browser_action_button.h" |
19 #import "chrome/browser/ui/cocoa/extensions/browser_actions_container_view.h" | 20 #import "chrome/browser/ui/cocoa/extensions/browser_actions_container_view.h" |
20 #import "chrome/browser/ui/cocoa/extensions/extension_popup_controller.h" | 21 #import "chrome/browser/ui/cocoa/extensions/extension_popup_controller.h" |
21 #import "chrome/browser/ui/cocoa/image_button_cell.h" | 22 #import "chrome/browser/ui/cocoa/image_button_cell.h" |
22 #import "chrome/browser/ui/cocoa/menu_button.h" | 23 #import "chrome/browser/ui/cocoa/menu_button.h" |
23 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 24 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
24 #include "chrome/common/chrome_notification_types.h" | 25 #include "chrome/common/chrome_notification_types.h" |
25 #include "chrome/common/extensions/extension_action.h" | 26 #include "chrome/common/extensions/extension_action.h" |
26 #include "chrome/common/pref_names.h" | 27 #include "chrome/common/pref_names.h" |
27 #include "content/public/browser/notification_observer.h" | 28 #include "content/public/browser/notification_observer.h" |
(...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
830 [chevronMenuButton_ setAttachedMenu:overflowMenu_]; | 831 [chevronMenuButton_ setAttachedMenu:overflowMenu_]; |
831 } | 832 } |
832 | 833 |
833 - (void)updateGrippyCursors { | 834 - (void)updateGrippyCursors { |
834 [containerView_ setCanDragLeft:[hiddenButtons_ count] > 0]; | 835 [containerView_ setCanDragLeft:[hiddenButtons_ count] > 0]; |
835 [containerView_ setCanDragRight:[self visibleButtonCount] > 0]; | 836 [containerView_ setCanDragRight:[self visibleButtonCount] > 0]; |
836 [[containerView_ window] invalidateCursorRectsForView:containerView_]; | 837 [[containerView_ window] invalidateCursorRectsForView:containerView_]; |
837 } | 838 } |
838 | 839 |
839 - (int)currentTabId { | 840 - (int)currentTabId { |
840 TabContents* selected_tab = browser_->GetActiveTabContents(); | 841 TabContents* selected_tab = chrome::GetActiveTabContents(browser_); |
841 if (!selected_tab) | 842 if (!selected_tab) |
842 return -1; | 843 return -1; |
843 | 844 |
844 return selected_tab->restore_tab_helper()->session_id().id(); | 845 return selected_tab->restore_tab_helper()->session_id().id(); |
845 } | 846 } |
846 | 847 |
847 #pragma mark - | 848 #pragma mark - |
848 #pragma mark Testing Methods | 849 #pragma mark Testing Methods |
849 | 850 |
850 - (NSButton*)buttonWithIndex:(NSUInteger)index { | 851 - (NSButton*)buttonWithIndex:(NSUInteger)index { |
851 if (profile_->IsOffTheRecord()) | 852 if (profile_->IsOffTheRecord()) |
852 index = toolbarModel_->IncognitoIndexToOriginal(index); | 853 index = toolbarModel_->IncognitoIndexToOriginal(index); |
853 if (index < toolbarModel_->size()) { | 854 if (index < toolbarModel_->size()) { |
854 const Extension* extension = toolbarModel_->GetExtensionByIndex(index); | 855 const Extension* extension = toolbarModel_->GetExtensionByIndex(index); |
855 return [buttons_ objectForKey:base::SysUTF8ToNSString(extension->id())]; | 856 return [buttons_ objectForKey:base::SysUTF8ToNSString(extension->id())]; |
856 } | 857 } |
857 return nil; | 858 return nil; |
858 } | 859 } |
859 | 860 |
860 @end | 861 @end |
OLD | NEW |