Commit 82c47759 authored by Gregory Chatzinoff's avatar Gregory Chatzinoff Committed by Commit Bot

Remove BrowserCommands dependency from PageInfoVC.

Removes the BrowserCommands dependency from the PageInfoViewController
so that it is easier to integrate into ios/clean.

Bug: none
Change-Id: I12508c86c767ddd0933226a316787eab7ce8a97e
Reviewed-on: https://chromium-review.googlesource.com/669961Reviewed-by: default avatarRohit Rao (ping after 24h) <rohitrao@chromium.org>
Commit-Queue: Gregory Chatzinoff <gchatz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#502724}
parent 6a53e534
...@@ -51,6 +51,7 @@ source_set("coordinator") { ...@@ -51,6 +51,7 @@ source_set("coordinator") {
"//ios/chrome/browser/ui/commands", "//ios/chrome/browser/ui/commands",
"//ios/chrome/browser/ui/page_info/requirements", "//ios/chrome/browser/ui/page_info/requirements",
"//ios/web", "//ios/web",
"//ios/web:reload_type",
] ]
libs = [ "UIKit.framework" ] libs = [ "UIKit.framework" ]
} }
...@@ -17,9 +17,13 @@ ...@@ -17,9 +17,13 @@
#include "ios/chrome/browser/ui/page_info/page_info_model.h" #include "ios/chrome/browser/ui/page_info/page_info_model.h"
#import "ios/chrome/browser/ui/page_info/page_info_view_controller.h" #import "ios/chrome/browser/ui/page_info/page_info_view_controller.h"
#import "ios/chrome/browser/ui/page_info/requirements/page_info_presentation.h" #import "ios/chrome/browser/ui/page_info/requirements/page_info_presentation.h"
#import "ios/chrome/browser/ui/page_info/requirements/page_info_reloading.h"
#import "ios/chrome/browser/ui/url_loader.h" #import "ios/chrome/browser/ui/url_loader.h"
#include "ios/web/public/navigation_item.h" #include "ios/web/public/navigation_item.h"
#include "ios/web/public/navigation_manager.h"
#include "ios/web/public/reload_type.h"
#include "ios/web/public/web_client.h" #include "ios/web/public/web_client.h"
#import "ios/web/public/web_state/web_state.h"
#if !defined(__has_feature) || !__has_feature(objc_arc) #if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support." #error "This file requires ARC support."
...@@ -31,7 +35,7 @@ NSString* const kPageInfoWillShowNotification = ...@@ -31,7 +35,7 @@ NSString* const kPageInfoWillShowNotification =
NSString* const kPageInfoWillHideNotification = NSString* const kPageInfoWillHideNotification =
@"kPageInfoWillHideNotification"; @"kPageInfoWillHideNotification";
@interface PageInfoLegacyCoordinator ()<PageInfoCommands> @interface PageInfoLegacyCoordinator ()<PageInfoCommands, PageInfoReloading>
// The view controller for the Page Info UI. Nil if not visible. // The view controller for the Page Info UI. Nil if not visible.
@property(nonatomic, strong) PageInfoViewController* pageInfoViewController; @property(nonatomic, strong) PageInfoViewController* pageInfoViewController;
...@@ -114,8 +118,7 @@ NSString* const kPageInfoWillHideNotification = ...@@ -114,8 +118,7 @@ NSString* const kPageInfoWillHideNotification =
bridge:bridge bridge:bridge
sourcePoint:[view convertPoint:originPoint fromView:nil] sourcePoint:[view convertPoint:originPoint fromView:nil]
parentView:view parentView:view
dispatcher:static_cast<id<BrowserCommands, PageInfoCommands>>( dispatcher:self];
self.dispatcher)];
bridge->set_controller(self.pageInfoViewController); bridge->set_controller(self.pageInfoViewController);
} }
...@@ -140,4 +143,16 @@ NSString* const kPageInfoWillHideNotification = ...@@ -140,4 +143,16 @@ NSString* const kPageInfoWillHideNotification =
[self hidePageInfo]; [self hidePageInfo];
} }
#pragma mark - PageInfoReloading
- (void)reload {
web::WebState* webState = self.tabModel.currentTab.webState;
if (webState) {
// |check_for_repost| is true because the reload is explicitly initiated
// by the user.
webState->GetNavigationManager()->Reload(web::ReloadType::NORMAL,
true /* check_for_repost */);
}
}
@end @end
...@@ -14,7 +14,8 @@ ...@@ -14,7 +14,8 @@
#include "ios/chrome/browser/ui/page_info/page_info_model_observer.h" #include "ios/chrome/browser/ui/page_info/page_info_model_observer.h"
@class BidiContainerView; @class BidiContainerView;
@protocol BrowserCommands; @protocol PageInfoCommands;
@protocol PageInfoReloading;
class PageInfoModel; class PageInfoModel;
// TODO(crbug.com/227827) Merge 178763: PageInfoModel has been removed in // TODO(crbug.com/227827) Merge 178763: PageInfoModel has been removed in
...@@ -29,10 +30,10 @@ class PageInfoModel; ...@@ -29,10 +30,10 @@ class PageInfoModel;
bridge:(PageInfoModelObserver*)bridge bridge:(PageInfoModelObserver*)bridge
sourcePoint:(CGPoint)sourcePoint sourcePoint:(CGPoint)sourcePoint
parentView:(UIView*)parent parentView:(UIView*)parent
dispatcher:(id<BrowserCommands>)dispatcher; dispatcher:(id<PageInfoCommands, PageInfoReloading>)dispatcher;
// Dispatcher for this view controller. // Dispatcher for this view controller.
@property(nonatomic, weak) id<BrowserCommands> dispatcher; @property(nonatomic, weak) id<PageInfoCommands, PageInfoReloading> dispatcher;
// Dismisses the view. // Dismisses the view.
- (void)dismiss; - (void)dismiss;
......
...@@ -14,9 +14,10 @@ ...@@ -14,9 +14,10 @@
#include "base/threading/thread_task_runner_handle.h" #include "base/threading/thread_task_runner_handle.h"
#include "components/strings/grit/components_strings.h" #include "components/strings/grit/components_strings.h"
#import "ios/chrome/browser/ui/animation_util.h" #import "ios/chrome/browser/ui/animation_util.h"
#import "ios/chrome/browser/ui/commands/browser_commands.h" #import "ios/chrome/browser/ui/commands/page_info_commands.h"
#import "ios/chrome/browser/ui/fancy_ui/bidi_container_view.h" #import "ios/chrome/browser/ui/fancy_ui/bidi_container_view.h"
#include "ios/chrome/browser/ui/page_info/page_info_model.h" #include "ios/chrome/browser/ui/page_info/page_info_model.h"
#import "ios/chrome/browser/ui/page_info/requirements/page_info_reloading.h"
#include "ios/chrome/browser/ui/rtl_geometry.h" #include "ios/chrome/browser/ui/rtl_geometry.h"
#include "ios/chrome/browser/ui/ui_util.h" #include "ios/chrome/browser/ui/ui_util.h"
#import "ios/chrome/browser/ui/uikit_ui_util.h" #import "ios/chrome/browser/ui/uikit_ui_util.h"
...@@ -203,7 +204,7 @@ void PageInfoModelBubbleBridge::PerformLayout() { ...@@ -203,7 +204,7 @@ void PageInfoModelBubbleBridge::PerformLayout() {
bridge:(PageInfoModelObserver*)bridge bridge:(PageInfoModelObserver*)bridge
sourcePoint:(CGPoint)sourcePoint sourcePoint:(CGPoint)sourcePoint
parentView:(UIView*)parent parentView:(UIView*)parent
dispatcher:(id<BrowserCommands>)dispatcher { dispatcher:(id<PageInfoCommands, PageInfoReloading>)dispatcher {
DCHECK(parent); DCHECK(parent);
self = [super init]; self = [super init];
if (self) { if (self) {
......
...@@ -6,5 +6,6 @@ source_set("requirements") { ...@@ -6,5 +6,6 @@ source_set("requirements") {
configs += [ "//build/config/compiler:enable_arc" ] configs += [ "//build/config/compiler:enable_arc" ]
sources = [ sources = [
"page_info_presentation.h", "page_info_presentation.h",
"page_info_reloading.h",
] ]
} }
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef IOS_CHROME_BROWSER_UI_PAGE_INFO_REQUIREMENTS_PAGE_INFO_RELOADING_H_
#define IOS_CHROME_BROWSER_UI_PAGE_INFO_REQUIREMENTS_PAGE_INFO_RELOADING_H_
// PageInfoReloading contains methods related to reloading a web page.
@protocol PageInfoReloading
// Reloads the web page.
- (void)reload;
@end
#endif // IOS_CHROME_BROWSER_UI_PAGE_INFO_REQUIREMENTS_PAGE_INFO_RELOADING_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment