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/settings/settings_coordinator.h" | 5 #import "ios/clean/chrome/browser/ui/settings/settings_coordinator.h" |
6 | 6 |
7 #import "ios/chrome/browser/ui/settings/settings_navigation_controller.h" | 7 #import "ios/chrome/browser/ui/settings/settings_navigation_controller.h" |
8 #import "ios/clean/chrome/browser/ui/commands/settings_commands.h" | 8 #import "ios/clean/chrome/browser/ui/commands/settings_commands.h" |
9 #import "ios/shared/chrome/browser/coordinator_context/coordinator_context.h" | |
10 #import "ios/shared/chrome/browser/ui/browser_list/browser.h" | 9 #import "ios/shared/chrome/browser/ui/browser_list/browser.h" |
11 #import "ios/shared/chrome/browser/ui/commands/command_dispatcher.h" | 10 #import "ios/shared/chrome/browser/ui/commands/command_dispatcher.h" |
12 #import "ios/shared/chrome/browser/ui/coordinators/browser_coordinator+internal.
h" | 11 #import "ios/shared/chrome/browser/ui/coordinators/browser_coordinator+internal.
h" |
13 | 12 |
14 #if !defined(__has_feature) || !__has_feature(objc_arc) | 13 #if !defined(__has_feature) || !__has_feature(objc_arc) |
15 #error "This file requires ARC support." | 14 #error "This file requires ARC support." |
16 #endif | 15 #endif |
17 | 16 |
18 @interface SettingsCoordinator ()<SettingsNavigationControllerDelegate> | 17 @interface SettingsCoordinator ()<SettingsNavigationControllerDelegate> |
19 @property(nonatomic, strong) SettingsNavigationController* viewController; | 18 @property(nonatomic, strong) SettingsNavigationController* viewController; |
20 @end | 19 @end |
21 | 20 |
22 @implementation SettingsCoordinator | 21 @implementation SettingsCoordinator |
23 @synthesize viewController = _viewController; | 22 @synthesize viewController = _viewController; |
24 | 23 |
25 #pragma mark - BrowserCoordinator | 24 #pragma mark - BrowserCoordinator |
26 | 25 |
27 - (void)start { | 26 - (void)start { |
28 self.viewController = [SettingsNavigationController | 27 self.viewController = [SettingsNavigationController |
29 newSettingsMainControllerWithMainBrowserState:self.browser | 28 newSettingsMainControllerWithMainBrowserState:self.browser |
30 ->browser_state() | 29 ->browser_state() |
31 currentBrowserState:self.browser | 30 currentBrowserState:self.browser |
32 ->browser_state() | 31 ->browser_state() |
33 delegate:self]; | 32 delegate:self]; |
34 [self.context.baseViewController presentViewController:self.viewController | |
35 animated:self.context.animated | |
36 completion:nil]; | |
37 [super start]; | 33 [super start]; |
38 } | 34 } |
39 | 35 |
40 - (void)stop { | |
41 [super stop]; | |
42 [self.viewController.presentingViewController | |
43 dismissViewControllerAnimated:self.context.animated | |
44 completion:nil]; | |
45 } | |
46 | |
47 #pragma mark - SettingsNavigationControllerDelegate | 36 #pragma mark - SettingsNavigationControllerDelegate |
48 | 37 |
49 - (void)closeSettingsAndOpenUrl:(OpenUrlCommand*)command { | 38 - (void)closeSettingsAndOpenUrl:(OpenUrlCommand*)command { |
50 // Placeholder implementation to conform to the delegate protocol; | 39 // Placeholder implementation to conform to the delegate protocol; |
51 // for now this just closes the settings without opening a URL. | 40 // for now this just closes the settings without opening a URL. |
52 [self closeSettings]; | 41 [self closeSettings]; |
53 } | 42 } |
54 | 43 |
55 - (void)closeSettingsAndOpenNewIncognitoTab { | 44 - (void)closeSettingsAndOpenNewIncognitoTab { |
56 // Placeholder implementation to conform to the delegate protocol; | 45 // Placeholder implementation to conform to the delegate protocol; |
57 // for now this just closes the settings without opening a new tab. | 46 // for now this just closes the settings without opening a new tab. |
58 [self closeSettings]; | 47 [self closeSettings]; |
59 } | 48 } |
60 | 49 |
61 - (void)closeSettings { | 50 - (void)closeSettings { |
62 [static_cast<id>(self.browser->dispatcher()) closeSettings]; | 51 [static_cast<id>(self.browser->dispatcher()) closeSettings]; |
63 } | 52 } |
64 | 53 |
65 @end | 54 @end |
OLD | NEW |