| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "ios/chrome/browser/ui/stack_view/stack_view_controller.h" | 5 #import "ios/chrome/browser/ui/stack_view/stack_view_controller.h" |
| 6 | 6 |
| 7 #import <QuartzCore/QuartzCore.h> | 7 #import <QuartzCore/QuartzCore.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <cmath> | 10 #include <cmath> |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 #import "ios/chrome/browser/ui/stack_view/card_stack_pinch_gesture_recognizer.h" | 41 #import "ios/chrome/browser/ui/stack_view/card_stack_pinch_gesture_recognizer.h" |
| 42 #import "ios/chrome/browser/ui/stack_view/card_view.h" | 42 #import "ios/chrome/browser/ui/stack_view/card_view.h" |
| 43 #import "ios/chrome/browser/ui/stack_view/close_button.h" | 43 #import "ios/chrome/browser/ui/stack_view/close_button.h" |
| 44 #import "ios/chrome/browser/ui/stack_view/page_animation_util.h" | 44 #import "ios/chrome/browser/ui/stack_view/page_animation_util.h" |
| 45 #import "ios/chrome/browser/ui/stack_view/stack_card.h" | 45 #import "ios/chrome/browser/ui/stack_view/stack_card.h" |
| 46 #import "ios/chrome/browser/ui/stack_view/stack_view_controller_private.h" | 46 #import "ios/chrome/browser/ui/stack_view/stack_view_controller_private.h" |
| 47 #import "ios/chrome/browser/ui/stack_view/stack_view_toolbar_controller.h" | 47 #import "ios/chrome/browser/ui/stack_view/stack_view_toolbar_controller.h" |
| 48 #import "ios/chrome/browser/ui/stack_view/title_label.h" | 48 #import "ios/chrome/browser/ui/stack_view/title_label.h" |
| 49 #import "ios/chrome/browser/ui/toolbar/new_tab_button.h" | 49 #import "ios/chrome/browser/ui/toolbar/new_tab_button.h" |
| 50 #import "ios/chrome/browser/ui/toolbar/toolbar_owner.h" | 50 #import "ios/chrome/browser/ui/toolbar/toolbar_owner.h" |
| 51 #import "ios/chrome/browser/ui/tools_menu/tools_menu_context.h" | 51 #import "ios/chrome/browser/ui/tools_menu/tools_menu_configuration.h" |
| 52 #import "ios/chrome/browser/ui/tools_menu/tools_menu_view_item.h" | 52 #import "ios/chrome/browser/ui/tools_menu/tools_menu_view_item.h" |
| 53 #import "ios/chrome/browser/ui/ui_util.h" | 53 #import "ios/chrome/browser/ui/ui_util.h" |
| 54 #import "ios/chrome/browser/ui/uikit_ui_util.h" | 54 #import "ios/chrome/browser/ui/uikit_ui_util.h" |
| 55 #import "ios/chrome/common/material_timing.h" | 55 #import "ios/chrome/common/material_timing.h" |
| 56 #include "ios/chrome/grit/ios_strings.h" | 56 #include "ios/chrome/grit/ios_strings.h" |
| 57 #include "ios/web/public/referrer.h" | 57 #include "ios/web/public/referrer.h" |
| 58 #import "net/base/mac/url_conversions.h" | 58 #import "net/base/mac/url_conversions.h" |
| 59 #include "ui/base/l10n/l10n_util.h" | 59 #include "ui/base/l10n/l10n_util.h" |
| 60 | 60 |
| 61 using base::UserMetricsAction; | 61 using base::UserMetricsAction; |
| (...skipping 2647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2709 case IDC_TOGGLE_TAB_SWITCHER: | 2709 case IDC_TOGGLE_TAB_SWITCHER: |
| 2710 [self dismissWithSelectedTabAnimation]; | 2710 [self dismissWithSelectedTabAnimation]; |
| 2711 break; | 2711 break; |
| 2712 default: | 2712 default: |
| 2713 [super chromeExecuteCommand:sender]; | 2713 [super chromeExecuteCommand:sender]; |
| 2714 break; | 2714 break; |
| 2715 } | 2715 } |
| 2716 } | 2716 } |
| 2717 | 2717 |
| 2718 - (void)showToolsMenuPopup { | 2718 - (void)showToolsMenuPopup { |
| 2719 base::scoped_nsobject<ToolsMenuContext> context( | 2719 base::scoped_nsobject<ToolsMenuConfiguration> configuration( |
| 2720 [[ToolsMenuContext alloc] initWithDisplayView:[self view]]); | 2720 [[ToolsMenuConfiguration alloc] initWithDisplayView:[self view]]); |
| 2721 [context setInTabSwitcher:YES]; | 2721 [configuration setInTabSwitcher:YES]; |
| 2722 // When checking for the existence of tabs, catch the case where the main set | 2722 // When checking for the existence of tabs, catch the case where the main set |
| 2723 // is both active and empty, but the incognito set has some cards. | 2723 // is both active and empty, but the incognito set has some cards. |
| 2724 if (([[_activeCardSet cards] count] == 0) && | 2724 if (([[_activeCardSet cards] count] == 0) && |
| 2725 (_activeCardSet == _otrCardSet || [[_otrCardSet cards] count] == 0)) | 2725 (_activeCardSet == _otrCardSet || [[_otrCardSet cards] count] == 0)) |
| 2726 [context setNoOpenedTabs:YES]; | 2726 [configuration setNoOpenedTabs:YES]; |
| 2727 if (_activeCardSet == _otrCardSet) | 2727 if (_activeCardSet == _otrCardSet) |
| 2728 [context setInIncognito:YES]; | 2728 [configuration setInIncognito:YES]; |
| 2729 [_toolbarController showToolsMenuPopupWithContext:context]; | 2729 [_toolbarController showToolsMenuPopupWithConfiguration:configuration]; |
| 2730 } | 2730 } |
| 2731 | 2731 |
| 2732 #pragma mark Notification Handlers | 2732 #pragma mark Notification Handlers |
| 2733 | 2733 |
| 2734 - (void)allModelTabsHaveClosed:(NSNotification*)notify { | 2734 - (void)allModelTabsHaveClosed:(NSNotification*)notify { |
| 2735 // Early return if the stack view is not active. This can sometimes occur if | 2735 // Early return if the stack view is not active. This can sometimes occur if |
| 2736 // |clearInternalState| triggers the deletion of a tab model. | 2736 // |clearInternalState| triggers the deletion of a tab model. |
| 2737 if (!_isActive) | 2737 if (!_isActive) |
| 2738 return; | 2738 return; |
| 2739 | 2739 |
| (...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3503 | 3503 |
| 3504 @end | 3504 @end |
| 3505 | 3505 |
| 3506 @implementation StackViewController (Testing) | 3506 @implementation StackViewController (Testing) |
| 3507 | 3507 |
| 3508 - (UIScrollView*)scrollView { | 3508 - (UIScrollView*)scrollView { |
| 3509 return _scrollView.get(); | 3509 return _scrollView.get(); |
| 3510 } | 3510 } |
| 3511 | 3511 |
| 3512 @end | 3512 @end |
| OLD | NEW |