Commit d16e3722 authored by Sebastien Lalancette's avatar Sebastien Lalancette Committed by Commit Bot

[Sharing] Created Command for QR Code Generation Activity.

This command will be invoked by the QR code activity from the
activity service, and will be in charge of starting up a
QRCodeCoordinator.

Bug: 1064990
Change-Id: Ib0a98c0e51c1df901176dbb304e77ca4d52591e9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2122480
Commit-Queue: Sebastien Lalancette <seblalancette@chromium.org>
Reviewed-by: default avatarMark Cogan <marq@chromium.org>
Cr-Commit-Position: refs/heads/master@{#754035}
parent d34213e5
......@@ -38,6 +38,7 @@
#import "ios/chrome/browser/ui/commands/infobar_commands.h"
#import "ios/chrome/browser/ui/commands/page_info_commands.h"
#import "ios/chrome/browser/ui/commands/password_breach_commands.h"
#import "ios/chrome/browser/ui/commands/qr_generation_commands.h"
#import "ios/chrome/browser/ui/commands/text_zoom_commands.h"
#import "ios/chrome/browser/ui/download/ar_quick_look_coordinator.h"
#import "ios/chrome/browser/ui/download/features.h"
......@@ -81,6 +82,7 @@
BrowserCoordinatorCommands,
FormInputAccessoryCoordinatorNavigator,
PageInfoCommands,
QRGenerationCommands,
RepostFormTabHelperDelegate,
ToolbarAccessoryCoordinatorDelegate,
URLLoadingDelegate,
......@@ -219,6 +221,8 @@
forProtocol:@protocol(BrowserCoordinatorCommands)];
[self.dispatcher startDispatchingToTarget:self
forProtocol:@protocol(PageInfoCommands)];
[self.dispatcher startDispatchingToTarget:self
forProtocol:@protocol(QRGenerationCommands)];
[self installDelegatesForAllWebStates];
[self installDelegatesForBrowser];
[self addWebStateListObserver];
......@@ -713,6 +717,12 @@
[self hidePageInfo];
}
#pragma mark - QRGenerationCommands
- (void)generateQRCode:(GenerateQRCodeCommand*)command {
// TODO(crbug.com/1064990): Implement Coordinator and starting here.
}
#pragma mark - FormInputAccessoryCoordinatorNavigator
- (void)openPasswordSettings {
......
......@@ -14,6 +14,8 @@ source_set("commands") {
"command_dispatcher.h",
"command_dispatcher.mm",
"find_in_page_commands.h",
"generate_qr_code_command.h",
"generate_qr_code_command.mm",
"infobar_commands.h",
"load_query_commands.h",
"omnibox_suggestion_commands.h",
......@@ -22,6 +24,7 @@ source_set("commands") {
"page_info_commands.h",
"password_breach_commands.h",
"popup_menu_commands.h",
"qr_generation_commands.h",
"qr_scanner_commands.h",
"reading_list_add_command.h",
"reading_list_add_command.mm",
......
// Copyright 2020 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_COMMANDS_GENERATE_QR_CODE_COMMAND_H_
#define IOS_CHROME_BROWSER_UI_COMMANDS_GENERATE_QR_CODE_COMMAND_H_
#import <Foundation/Foundation.h>
#include "url/gurl.h"
// Command sent to generate a QR code for a given URL.
@interface GenerateQRCodeCommand : NSObject
// Initializes a command containing the URL to generate a QR code for along with
// that URL's page title.
- (instancetype)initWithURL:(const GURL&)URL
title:(NSString*)title NS_DESIGNATED_INITIALIZER;
// Mark inherited initializer as unavailable to prevent calling it by mistake.
- (instancetype)init NS_UNAVAILABLE;
// URL for the QR code.
@property(nonatomic, readonly) const GURL& URL;
// Title of the page, which can be used for display purposes.
@property(copy, nonatomic, readonly) NSString* title;
@end
#endif // IOS_CHROME_BROWSER_UI_COMMANDS_GENERATE_QR_CODE_COMMAND_H_
\ No newline at end of file
// Copyright 2020 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.
#import "ios/chrome/browser/ui/commands/generate_qr_code_command.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
@implementation GenerateQRCodeCommand {
GURL _URL;
}
- (instancetype)initWithURL:(const GURL&)URL title:(NSString*)title {
if (self = [super init]) {
_URL = URL;
_title = title;
}
return self;
}
@end
// Copyright 2020 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_COMMANDS_QR_GENERATION_COMMANDS_H_
#define IOS_CHROME_BROWSER_UI_COMMANDS_QR_GENERATION_COMMANDS_H_
#import "ios/chrome/browser/ui/commands/generate_qr_code_command.h"
// QRGenerationCommands contains commands related to generating QR codes.
@protocol QRGenerationCommands <NSObject>
// Generates a QR code based on the |command| properties and displays it.
- (void)generateQRCode:(GenerateQRCodeCommand*)command;
@end
#endif // IOS_CHROME_BROWSER_UI_COMMANDS_QR_GENERATION_COMMANDS_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