| 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 #import "chrome/browser/ui/cocoa/extensions/browser_action_button.h" | 18 #import "chrome/browser/ui/cocoa/extensions/browser_action_button.h" |
| 19 #import "chrome/browser/ui/cocoa/extensions/browser_actions_container_view.h" | 19 #import "chrome/browser/ui/cocoa/extensions/browser_actions_container_view.h" |
| 20 #import "chrome/browser/ui/cocoa/extensions/chevron_menu_button.h" | 20 #import "chrome/browser/ui/cocoa/extensions/chevron_menu_button.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_wrapper.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" |
| 26 #include "chrome/common/extensions/extension_action.h" | 26 #include "chrome/common/extensions/extension_action.h" |
| 27 #include "chrome/common/pref_names.h" | 27 #include "chrome/common/pref_names.h" |
| 28 #include "content/public/browser/notification_observer.h" | 28 #include "content/public/browser/notification_observer.h" |
| 29 #include "content/public/browser/notification_registrar.h" | 29 #include "content/public/browser/notification_registrar.h" |
| 30 #include "content/public/browser/notification_details.h" | 30 #include "content/public/browser/notification_details.h" |
| 31 #include "content/public/browser/notification_source.h" | 31 #include "content/public/browser/notification_source.h" |
| 32 #include "grit/theme_resources.h" | 32 #include "grit/theme_resources.h" |
| 33 #include "grit/theme_resources_standard.h" | 33 #include "grit/theme_resources_standard.h" |
| 34 #import "third_party/GTM/AppKit/GTMNSAnimation+Duration.h" | 34 #import "third_party/GTM/AppKit/GTMNSAnimation+Duration.h" |
| (...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 834 [chevronMenuButton_ setAttachedMenu:overflowMenu_]; | 834 [chevronMenuButton_ setAttachedMenu:overflowMenu_]; |
| 835 } | 835 } |
| 836 | 836 |
| 837 - (void)updateGrippyCursors { | 837 - (void)updateGrippyCursors { |
| 838 [containerView_ setCanDragLeft:[hiddenButtons_ count] > 0]; | 838 [containerView_ setCanDragLeft:[hiddenButtons_ count] > 0]; |
| 839 [containerView_ setCanDragRight:[self visibleButtonCount] > 0]; | 839 [containerView_ setCanDragRight:[self visibleButtonCount] > 0]; |
| 840 [[containerView_ window] invalidateCursorRectsForView:containerView_]; | 840 [[containerView_ window] invalidateCursorRectsForView:containerView_]; |
| 841 } | 841 } |
| 842 | 842 |
| 843 - (int)currentTabId { | 843 - (int)currentTabId { |
| 844 TabContentsWrapper* selected_tab = browser_->GetSelectedTabContentsWrapper(); | 844 TabContents* selected_tab = browser_->GetActiveTabContents(); |
| 845 if (!selected_tab) | 845 if (!selected_tab) |
| 846 return -1; | 846 return -1; |
| 847 | 847 |
| 848 return selected_tab->restore_tab_helper()->session_id().id(); | 848 return selected_tab->restore_tab_helper()->session_id().id(); |
| 849 } | 849 } |
| 850 | 850 |
| 851 #pragma mark - | 851 #pragma mark - |
| 852 #pragma mark Testing Methods | 852 #pragma mark Testing Methods |
| 853 | 853 |
| 854 - (NSButton*)buttonWithIndex:(NSUInteger)index { | 854 - (NSButton*)buttonWithIndex:(NSUInteger)index { |
| 855 if (profile_->IsOffTheRecord()) | 855 if (profile_->IsOffTheRecord()) |
| 856 index = toolbarModel_->IncognitoIndexToOriginal(index); | 856 index = toolbarModel_->IncognitoIndexToOriginal(index); |
| 857 if (index < toolbarModel_->size()) { | 857 if (index < toolbarModel_->size()) { |
| 858 const Extension* extension = toolbarModel_->GetExtensionByIndex(index); | 858 const Extension* extension = toolbarModel_->GetExtensionByIndex(index); |
| 859 return [buttons_ objectForKey:base::SysUTF8ToNSString(extension->id())]; | 859 return [buttons_ objectForKey:base::SysUTF8ToNSString(extension->id())]; |
| 860 } | 860 } |
| 861 return nil; | 861 return nil; |
| 862 } | 862 } |
| 863 | 863 |
| 864 @end | 864 @end |
| OLD | NEW |