OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/app/steps/root_coordinator+application_step.h" | 5 #import "ios/clean/chrome/app/steps/root_coordinator+application_step.h" |
6 | 6 |
| 7 #include "base/memory/ptr_util.h" |
7 #import "base/supports_user_data.h" | 8 #import "base/supports_user_data.h" |
8 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" | 9 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" |
9 #import "ios/chrome/browser/web_state_list/web_state_list.h" | 10 #import "ios/chrome/browser/web_state_list/web_state_list.h" |
10 #import "ios/clean/chrome/app/application_state.h" | 11 #import "ios/clean/chrome/app/application_state.h" |
11 #import "ios/shared/chrome/browser/ui/browser_list/browser.h" | 12 #import "ios/shared/chrome/browser/ui/browser_list/browser.h" |
12 #import "ios/shared/chrome/browser/ui/browser_list/browser_list.h" | 13 #import "ios/shared/chrome/browser/ui/browser_list/browser_list.h" |
13 #import "ios/shared/chrome/browser/ui/coordinators/browser_coordinator+internal.
h" | 14 #import "ios/shared/chrome/browser/ui/coordinators/browser_coordinator+internal.
h" |
14 #import "ios/web/public/navigation_manager.h" | 15 #import "ios/web/public/navigation_manager.h" |
15 #include "ios/web/public/web_state/web_state.h" | 16 #include "ios/web/public/web_state/web_state.h" |
16 | 17 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 // Size the main view controller to fit the whole screen. | 67 // Size the main view controller to fit the whole screen. |
67 [self.viewController.view setFrame:state.window.bounds]; | 68 [self.viewController.view setFrame:state.window.bounds]; |
68 | 69 |
69 // Tell the application state to use this object to open URLs. | 70 // Tell the application state to use this object to open URLs. |
70 state.URLOpener = self; | 71 state.URLOpener = self; |
71 | 72 |
72 // Show the window. | 73 // Show the window. |
73 state.window.hidden = NO; | 74 state.window.hidden = NO; |
74 | 75 |
75 // Make sure this object stays alive. | 76 // Make sure this object stays alive. |
76 state.persistentState->SetUserData(kRootCoordinatorContainerKey, | 77 state.persistentState->SetUserData( |
77 new RootCoordinatorContainer(self)); | 78 kRootCoordinatorContainerKey, |
| 79 base::MakeUnique<RootCoordinatorContainer>(self)); |
78 | 80 |
79 // Add a termination step to remove this object. | 81 // Add a termination step to remove this object. |
80 [[state terminationSteps] addObject:[[StopRootCoordinator alloc] init]]; | 82 [[state terminationSteps] addObject:[[StopRootCoordinator alloc] init]]; |
81 } | 83 } |
82 | 84 |
83 @end | 85 @end |
84 | 86 |
85 @implementation StopRootCoordinator | 87 @implementation StopRootCoordinator |
86 | 88 |
87 - (BOOL)canRunInState:(ApplicationState*)state { | 89 - (BOOL)canRunInState:(ApplicationState*)state { |
88 return state.phase = APPLICATION_TERMINATING; | 90 return state.phase = APPLICATION_TERMINATING; |
89 } | 91 } |
90 | 92 |
91 - (void)runInState:(ApplicationState*)state { | 93 - (void)runInState:(ApplicationState*)state { |
92 state.persistentState->RemoveUserData(kRootCoordinatorContainerKey); | 94 state.persistentState->RemoveUserData(kRootCoordinatorContainerKey); |
93 } | 95 } |
94 | 96 |
95 @end | 97 @end |
OLD | NEW |