Chromium Code Reviews| 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/commands/overlay_commands.h" | 10 #import "ios/clean/chrome/browser/ui/commands/overlay_commands.h" |
| 11 #import "ios/clean/chrome/browser/ui/context_menu/context_menu_context_impl.h" | 11 #import "ios/clean/chrome/browser/ui/context_menu/context_menu_context_impl.h" |
| 12 #import "ios/clean/chrome/browser/ui/context_menu/web_context_menu_coordinator.h " | 12 #import "ios/clean/chrome/browser/ui/context_menu/web_context_menu_coordinator.h " |
| 13 #import "ios/clean/chrome/browser/ui/dialogs/java_script_dialogs/web_java_script _dialog_presenter.h" | |
| 13 #import "ios/clean/chrome/browser/ui/overlays/overlay_queue.h" | 14 #import "ios/clean/chrome/browser/ui/overlays/overlay_queue.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_mediator.h" |
| 15 #import "ios/clean/chrome/browser/ui/web_contents/web_contents_view_controller.h " | 16 #import "ios/clean/chrome/browser/ui/web_contents/web_contents_view_controller.h " |
| 16 #import "ios/shared/chrome/browser/ui/browser_list/browser.h" | 17 #import "ios/shared/chrome/browser/ui/browser_list/browser.h" |
| 17 #import "ios/shared/chrome/browser/ui/commands/command_dispatcher.h" | 18 #import "ios/shared/chrome/browser/ui/commands/command_dispatcher.h" |
| 18 #import "ios/shared/chrome/browser/ui/coordinators/browser_coordinator+internal. h" | 19 #import "ios/shared/chrome/browser/ui/coordinators/browser_coordinator+internal. h" |
| 19 #include "ios/web/public/navigation_manager.h" | 20 #include "ios/web/public/navigation_manager.h" |
| 20 #include "ios/web/public/web_state/web_state.h" | 21 #include "ios/web/public/web_state/web_state.h" |
| 21 #import "ios/web/public/web_state/web_state_delegate_bridge.h" | 22 #import "ios/web/public/web_state/web_state_delegate_bridge.h" |
| 22 | 23 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 116 | 117 |
| 117 - (void)openContextMenuImage:(ContextMenuContext*)context { | 118 - (void)openContextMenuImage:(ContextMenuContext*)context { |
| 118 ContextMenuContextImpl* contextImpl = | 119 ContextMenuContextImpl* contextImpl = |
| 119 base::mac::ObjCCastStrict<ContextMenuContextImpl>(context); | 120 base::mac::ObjCCastStrict<ContextMenuContextImpl>(context); |
| 120 web::NavigationManager::WebLoadParams loadParams(contextImpl.imageURL); | 121 web::NavigationManager::WebLoadParams loadParams(contextImpl.imageURL); |
| 121 self.webState->GetNavigationManager()->LoadURLWithParams(loadParams); | 122 self.webState->GetNavigationManager()->LoadURLWithParams(loadParams); |
| 122 } | 123 } |
| 123 | 124 |
| 124 #pragma mark - CRWWebStateDelegate | 125 #pragma mark - CRWWebStateDelegate |
| 125 | 126 |
| 127 - (web::JavaScriptDialogPresenter*)javaScriptDialogPresenterForWebState: | |
| 128 (web::WebState*)webState { | |
| 129 [self createDialogHelpers]; | |
| 130 return WebJavaScriptDialogPresenter::FromWebState(webState); | |
| 131 } | |
| 132 | |
| 126 - (BOOL)webState:(web::WebState*)webState | 133 - (BOOL)webState:(web::WebState*)webState |
| 127 handleContextMenu:(const web::ContextMenuParams&)params { | 134 handleContextMenu:(const web::ContextMenuParams&)params { |
| 128 ContextMenuContextImpl* context = | 135 ContextMenuContextImpl* context = |
| 129 [[ContextMenuContextImpl alloc] initWithParams:params]; | 136 [[ContextMenuContextImpl alloc] initWithParams:params]; |
| 130 WebContextMenuCoordinator* contextMenu = | 137 WebContextMenuCoordinator* contextMenu = |
| 131 [[WebContextMenuCoordinator alloc] initWithContext:context]; | 138 [[WebContextMenuCoordinator alloc] initWithContext:context]; |
| 132 [self addChildCoordinator:contextMenu]; | 139 [self addChildCoordinator:contextMenu]; |
| 133 [contextMenu start]; | 140 [contextMenu start]; |
| 134 return YES; | 141 return YES; |
| 135 } | 142 } |
| 136 | 143 |
| 137 #pragma mark - OverlayPresentationCommands | 144 #pragma mark - OverlayPresentationCommands |
| 138 | 145 |
| 139 - (void)startNextOverlayForWebState:(web::WebState*)webState { | 146 - (void)startNextOverlayForWebState:(web::WebState*)webState { |
| 140 DCHECK_EQ(self.webState, webState); | 147 DCHECK_EQ(self.webState, webState); |
| 141 [self startNextOverlay]; | 148 [self startNextOverlay]; |
| 142 } | 149 } |
| 143 | 150 |
| 144 #pragma mark - | 151 #pragma mark - |
| 145 | 152 |
| 146 - (void)createDialogHelpers { | 153 - (void)createDialogHelpers { |
| 147 id<OverlaySchedulerCommands> overlayDispatcher = | 154 id<OverlaySchedulerCommands> overlayDispatcher = |
| 148 static_cast<id<OverlaySchedulerCommands>>(self.browser->dispatcher()); | 155 static_cast<id<OverlaySchedulerCommands>>(self.browser->dispatcher()); |
| 149 OverlayQueue::CreateForWebState(self.webState, overlayDispatcher); | 156 OverlayQueue::CreateForWebState(self.webState, overlayDispatcher); |
| 157 WebJavaScriptDialogPresenter::CreateForWebState(self.webState); | |
|
marq (ping after 24h)
2017/06/14 11:28:39
This implies the presenter will be created when an
kkhorimoto
2017/06/23 06:34:03
This function doesn't exist anymore since the Over
| |
| 150 } | 158 } |
| 151 | 159 |
| 152 - (void)startNextOverlay { | 160 - (void)startNextOverlay { |
| 153 OverlayQueue* queue = OverlayQueue::FromWebState(self.webState); | 161 OverlayQueue* queue = OverlayQueue::FromWebState(self.webState); |
| 154 if (queue->HasQueuedOverlays() && !queue->IsShowingOverlay()) | 162 if (queue->HasQueuedOverlays() && !queue->IsShowingOverlay()) |
| 155 queue->StartNextOverlay(self); | 163 queue->StartNextOverlay(self); |
| 156 } | 164 } |
| 157 | 165 |
| 158 @end | 166 @end |
| OLD | NEW |