forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add util to get the LayoutGuideCenter
The layout guide center is inferred from a Browser object. This CL adds a method to quickly retrieve it. Bug: 1304193 Change-Id: I57fe059549138df666594700aad566a7d51ed3d9 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3924342 Commit-Queue: Louis Romero <lpromero@google.com> Reviewed-by: Mark Cogan <marq@chromium.org> Cr-Commit-Position: refs/heads/main@{#1052908}
- Loading branch information
Showing
9 changed files
with
70 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Copyright 2022 The Chromium Authors | ||
// 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_MAIN_LAYOUT_GUIDE_UTIL_H_ | ||
#define IOS_CHROME_BROWSER_UI_MAIN_LAYOUT_GUIDE_UTIL_H_ | ||
|
||
class Browser; | ||
@class LayoutGuideCenter; | ||
|
||
// Returns the layout guide center assigned to the given `browser`. | ||
LayoutGuideCenter* LayoutGuideCenterForBrowser(Browser* browser); | ||
|
||
#endif // IOS_CHROME_BROWSER_UI_MAIN_LAYOUT_GUIDE_UTIL_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright 2022 The Chromium Authors | ||
// 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/main/layout_guide_util.h" | ||
|
||
#import "ios/chrome/browser/browser_state/chrome_browser_state.h" | ||
#import "ios/chrome/browser/ui/main/layout_guide_scene_agent.h" | ||
#import "ios/chrome/browser/ui/main/scene_state.h" | ||
#import "ios/chrome/browser/ui/main/scene_state_browser_agent.h" | ||
|
||
#if !defined(__has_feature) || !__has_feature(objc_arc) | ||
#error "This file requires ARC support." | ||
#endif | ||
|
||
LayoutGuideCenter* LayoutGuideCenterForBrowser(Browser* browser) { | ||
SceneState* sceneState = | ||
SceneStateBrowserAgent::FromBrowser(browser)->GetSceneState(); | ||
LayoutGuideSceneAgent* layoutGuideSceneAgent = | ||
[LayoutGuideSceneAgent agentFromScene:sceneState]; | ||
ChromeBrowserState* browserState = browser->GetBrowserState(); | ||
if (browserState && browserState->IsOffTheRecord()) { | ||
return layoutGuideSceneAgent.incognitoLayoutGuideCenter; | ||
} else { | ||
return layoutGuideSceneAgent.layoutGuideCenter; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters