OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/content_suggestions/content_suggestions_coordinator.
h" | 5 #import "ios/chrome/browser/content_suggestions/content_suggestions_coordinator.
h" |
6 | 6 |
7 #include "base/mac/foundation_util.h" | 7 #include "base/mac/foundation_util.h" |
8 #include "base/mac/scoped_nsobject.h" | 8 #include "base/mac/scoped_nsobject.h" |
9 #include "base/metrics/user_metrics.h" | 9 #include "base/metrics/user_metrics.h" |
10 #include "base/metrics/user_metrics_action.h" | 10 #include "base/metrics/user_metrics_action.h" |
11 #include "base/strings/sys_string_conversions.h" | 11 #include "base/strings/sys_string_conversions.h" |
12 #include "components/ntp_snippets/content_suggestions_service.h" | 12 #include "components/ntp_snippets/content_suggestions_service.h" |
13 #include "components/ntp_snippets/remote/remote_suggestions_scheduler.h" | 13 #include "components/ntp_snippets/remote/remote_suggestions_scheduler.h" |
14 #include "components/ntp_tiles/metrics.h" | 14 #include "components/ntp_tiles/metrics.h" |
15 #include "components/ntp_tiles/most_visited_sites.h" | 15 #include "components/ntp_tiles/most_visited_sites.h" |
16 #include "components/reading_list/core/reading_list_model.h" | 16 #include "components/reading_list/core/reading_list_model.h" |
17 #include "components/strings/grit/components_strings.h" | 17 #include "components/strings/grit/components_strings.h" |
18 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" | 18 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" |
19 #import "ios/chrome/browser/content_suggestions/content_suggestions_header_contr
oller.h" | 19 #import "ios/chrome/browser/content_suggestions/content_suggestions_header_contr
oller.h" |
20 #import "ios/chrome/browser/content_suggestions/content_suggestions_mediator.h" | 20 #import "ios/chrome/browser/content_suggestions/content_suggestions_mediator.h" |
21 #include "ios/chrome/browser/favicon/ios_chrome_large_icon_service_factory.h" | 21 #include "ios/chrome/browser/favicon/ios_chrome_large_icon_service_factory.h" |
22 #import "ios/chrome/browser/metrics/new_tab_page_uma.h" | 22 #import "ios/chrome/browser/metrics/new_tab_page_uma.h" |
23 #include "ios/chrome/browser/ntp_snippets/ios_chrome_content_suggestions_service
_factory.h" | 23 #include "ios/chrome/browser/ntp_snippets/ios_chrome_content_suggestions_service
_factory.h" |
24 #include "ios/chrome/browser/ntp_tiles/ios_most_visited_sites_factory.h" | 24 #include "ios/chrome/browser/ntp_tiles/ios_most_visited_sites_factory.h" |
25 #include "ios/chrome/browser/reading_list/reading_list_model_factory.h" | 25 #include "ios/chrome/browser/reading_list/reading_list_model_factory.h" |
26 #import "ios/chrome/browser/ui/alert_coordinator/action_sheet_coordinator.h" | 26 #import "ios/chrome/browser/ui/alert_coordinator/action_sheet_coordinator.h" |
27 #import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h" | 27 #import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h" |
| 28 #import "ios/chrome/browser/ui/commands/browser_commands.h" |
28 #import "ios/chrome/browser/ui/commands/generic_chrome_command.h" | 29 #import "ios/chrome/browser/ui/commands/generic_chrome_command.h" |
29 #include "ios/chrome/browser/ui/commands/ios_command_ids.h" | 30 #include "ios/chrome/browser/ui/commands/ios_command_ids.h" |
30 #import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_ite
m.h" | 31 #import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_ite
m.h" |
31 #import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_mos
t_visited_item.h" | 32 #import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_mos
t_visited_item.h" |
32 #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_collectio
n_utils.h" | 33 #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_collectio
n_utils.h" |
33 #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_commands.
h" | 34 #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_commands.
h" |
34 #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_header_co
mmands.h" | 35 #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_header_co
mmands.h" |
35 #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_view_cont
roller.h" | 36 #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_view_cont
roller.h" |
36 #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_view_cont
roller_delegate.h" | 37 #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_view_cont
roller_delegate.h" |
37 #import "ios/chrome/browser/ui/content_suggestions/identifier/content_suggestion
_identifier.h" | 38 #import "ios/chrome/browser/ui/content_suggestions/identifier/content_suggestion
_identifier.h" |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 | 411 |
411 - (void)overscrollActionsController:(OverscrollActionsController*)controller | 412 - (void)overscrollActionsController:(OverscrollActionsController*)controller |
412 didTriggerAction:(OverscrollAction)action { | 413 didTriggerAction:(OverscrollAction)action { |
413 switch (action) { | 414 switch (action) { |
414 case OverscrollAction::NEW_TAB: { | 415 case OverscrollAction::NEW_TAB: { |
415 base::scoped_nsobject<GenericChromeCommand> command( | 416 base::scoped_nsobject<GenericChromeCommand> command( |
416 [[GenericChromeCommand alloc] initWithTag:IDC_NEW_TAB]); | 417 [[GenericChromeCommand alloc] initWithTag:IDC_NEW_TAB]); |
417 [self.suggestionsViewController chromeExecuteCommand:command]; | 418 [self.suggestionsViewController chromeExecuteCommand:command]; |
418 } break; | 419 } break; |
419 case OverscrollAction::CLOSE_TAB: { | 420 case OverscrollAction::CLOSE_TAB: { |
420 base::scoped_nsobject<GenericChromeCommand> command( | 421 [_dispatcher closeCurrentTab]; |
421 [[GenericChromeCommand alloc] initWithTag:IDC_CLOSE_TAB]); | |
422 [self.suggestionsViewController chromeExecuteCommand:command]; | |
423 } break; | 422 } break; |
424 case OverscrollAction::REFRESH: | 423 case OverscrollAction::REFRESH: |
425 [self reload]; | 424 [self reload]; |
426 break; | 425 break; |
427 case OverscrollAction::NONE: | 426 case OverscrollAction::NONE: |
428 NOTREACHED(); | 427 NOTREACHED(); |
429 break; | 428 break; |
430 } | 429 } |
431 } | 430 } |
432 | 431 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 TriggerHapticFeedbackForNotification(UINotificationFeedbackTypeSuccess); | 539 TriggerHapticFeedbackForNotification(UINotificationFeedbackTypeSuccess); |
541 MDCSnackbarMessage* message = [MDCSnackbarMessage | 540 MDCSnackbarMessage* message = [MDCSnackbarMessage |
542 messageWithText:l10n_util::GetNSString( | 541 messageWithText:l10n_util::GetNSString( |
543 IDS_IOS_NEW_TAB_MOST_VISITED_ITEM_REMOVED)]; | 542 IDS_IOS_NEW_TAB_MOST_VISITED_ITEM_REMOVED)]; |
544 message.action = action; | 543 message.action = action; |
545 message.category = @"MostVisitedUndo"; | 544 message.category = @"MostVisitedUndo"; |
546 [MDCSnackbarManager showMessage:message]; | 545 [MDCSnackbarManager showMessage:message]; |
547 } | 546 } |
548 | 547 |
549 @end | 548 @end |
OLD | NEW |