| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/clean/chrome/browser/ui/web_contents/web_coordinator.h" | 5 #import "ios/clean/chrome/browser/ui/web_contents/web_coordinator.h" |
| 6 | 6 |
| 7 #include "base/mac/foundation_util.h" | 7 #include "base/mac/foundation_util.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #import "ios/clean/chrome/browser/ui/commands/context_menu_commands.h" | 9 #import "ios/clean/chrome/browser/ui/commands/context_menu_commands.h" |
| 10 #import "ios/clean/chrome/browser/ui/context_menu/context_menu_context_impl.h" | 10 #import "ios/clean/chrome/browser/ui/context_menu/context_menu_context_impl.h" |
| 11 #import "ios/clean/chrome/browser/ui/context_menu/web_context_menu_coordinator.h
" | 11 #import "ios/clean/chrome/browser/ui/context_menu/web_context_menu_coordinator.h
" |
| 12 #import "ios/clean/chrome/browser/ui/overlay_service/browser_coordinator+overlay
_support.h" |
| 12 #import "ios/clean/chrome/browser/ui/overlay_service/overlay_service.h" | 13 #import "ios/clean/chrome/browser/ui/overlay_service/overlay_service.h" |
| 13 #import "ios/clean/chrome/browser/ui/overlay_service/overlay_service_factory.h" | |
| 14 #import "ios/clean/chrome/browser/ui/web_contents/web_contents_mediator.h" | 14 #import "ios/clean/chrome/browser/ui/web_contents/web_contents_mediator.h" |
| 15 #import "ios/clean/chrome/browser/ui/web_contents/web_contents_view_controller.h
" | 15 #import "ios/clean/chrome/browser/ui/web_contents/web_contents_view_controller.h
" |
| 16 #import "ios/shared/chrome/browser/ui/browser_list/browser.h" | 16 #import "ios/shared/chrome/browser/ui/browser_list/browser.h" |
| 17 #import "ios/shared/chrome/browser/ui/commands/command_dispatcher.h" | 17 #import "ios/shared/chrome/browser/ui/commands/command_dispatcher.h" |
| 18 #import "ios/shared/chrome/browser/ui/coordinators/browser_coordinator+internal.
h" | 18 #import "ios/shared/chrome/browser/ui/coordinators/browser_coordinator+internal.
h" |
| 19 #include "ios/web/public/navigation_manager.h" | 19 #include "ios/web/public/navigation_manager.h" |
| 20 #include "ios/web/public/web_state/web_state.h" | 20 #include "ios/web/public/web_state/web_state.h" |
| 21 #import "ios/web/public/web_state/web_state_delegate_bridge.h" | 21 #import "ios/web/public/web_state/web_state_delegate_bridge.h" |
| 22 | 22 |
| 23 #if !defined(__has_feature) || !__has_feature(objc_arc) | 23 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| (...skipping 28 matching lines...) Expand all Loading... |
| 52 self.webState->SetDelegate(_webStateDelegate.get()); | 52 self.webState->SetDelegate(_webStateDelegate.get()); |
| 53 } | 53 } |
| 54 | 54 |
| 55 - (void)start { | 55 - (void)start { |
| 56 // Create the view controller and start it. | 56 // Create the view controller and start it. |
| 57 self.viewController = [[WebContentsViewController alloc] init]; | 57 self.viewController = [[WebContentsViewController alloc] init]; |
| 58 self.mediator.consumer = self.viewController; | 58 self.mediator.consumer = self.viewController; |
| 59 self.mediator.webStateList = &self.browser->web_state_list(); | 59 self.mediator.webStateList = &self.browser->web_state_list(); |
| 60 [super start]; | 60 [super start]; |
| 61 // Notify the OverlayService that this coordinator is displaying |webState|. | 61 // Notify the OverlayService that this coordinator is displaying |webState|. |
| 62 OverlayServiceFactory::GetInstance() | 62 self.overlayService->SetWebStateParentCoordinator(self, self.webState); |
| 63 ->GetForBrowserState(self.browser->browser_state()) | |
| 64 ->SetWebStateParentCoordinator(self, self.webState); | |
| 65 } | 63 } |
| 66 | 64 |
| 67 - (void)stop { | 65 - (void)stop { |
| 68 // Notify the OverlayService that this coordinator is no longer displaying | 66 // Notify the OverlayService that this coordinator is no longer displaying |
| 69 // |webState|. | 67 // |webState|. |
| 70 OverlayServiceFactory::GetInstance() | 68 self.overlayService->SetWebStateParentCoordinator(nil, self.webState); |
| 71 ->GetForBrowserState(self.browser->browser_state()) | |
| 72 ->SetWebStateParentCoordinator(nil, self.webState); | |
| 73 [super stop]; | 69 [super stop]; |
| 74 [self.mediator disconnect]; | 70 [self.mediator disconnect]; |
| 75 } | 71 } |
| 76 | 72 |
| 77 - (void)childCoordinatorDidStart:(BrowserCoordinator*)childCoordinator { | 73 - (void)childCoordinatorDidStart:(BrowserCoordinator*)childCoordinator { |
| 78 // Register to receive relevant ContextMenuCommands. | 74 // Register to receive relevant ContextMenuCommands. |
| 79 if ([childCoordinator isKindOfClass:[WebContextMenuCoordinator class]]) { | 75 if ([childCoordinator isKindOfClass:[WebContextMenuCoordinator class]]) { |
| 80 [self.browser->dispatcher() | 76 [self.browser->dispatcher() |
| 81 startDispatchingToTarget:self | 77 startDispatchingToTarget:self |
| 82 forSelector:@selector(executeContextMenuScript:)]; | 78 forSelector:@selector(executeContextMenuScript:)]; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 ContextMenuContextImpl* context = | 117 ContextMenuContextImpl* context = |
| 122 [[ContextMenuContextImpl alloc] initWithParams:params]; | 118 [[ContextMenuContextImpl alloc] initWithParams:params]; |
| 123 WebContextMenuCoordinator* contextMenu = | 119 WebContextMenuCoordinator* contextMenu = |
| 124 [[WebContextMenuCoordinator alloc] initWithContext:context]; | 120 [[WebContextMenuCoordinator alloc] initWithContext:context]; |
| 125 [self addChildCoordinator:contextMenu]; | 121 [self addChildCoordinator:contextMenu]; |
| 126 [contextMenu start]; | 122 [contextMenu start]; |
| 127 return YES; | 123 return YES; |
| 128 } | 124 } |
| 129 | 125 |
| 130 @end | 126 @end |
| OLD | NEW |