Commit 540a9dff authored by Milica Selakovic's avatar Milica Selakovic Committed by Commit Bot

[Autofill assistant] Fix |GetForWebContents|

|GetForWebContents| should only retrieve RuntimeManager for given web contents
and |GetOrCreateForWebContents| should create instance if one does not exist.

Bug: 1133783
Change-Id: Ib26162b69d1b3359fc571e139ba3724ec951aa12
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2453389Reviewed-by: default avatarClemens Arbesser <arbesser@google.com>
Commit-Queue: Milica Selakovic <selakovic@google.com>
Cr-Commit-Position: refs/heads/master@{#814601}
parent 6e682107
...@@ -8,9 +8,14 @@ ...@@ -8,9 +8,14 @@
namespace autofill_assistant { namespace autofill_assistant {
// static // static
RuntimeManager* RuntimeManager::GetForWebContents( RuntimeManager* RuntimeManager::GetOrCreateForWebContents(
content::WebContents* contents) { content::WebContents* contents) {
return RuntimeManagerImpl::GetForWebContents(contents); return RuntimeManagerImpl::GetForWebContents(contents);
} }
RuntimeManager* RuntimeManager::GetForWebContents(
content::WebContents* contents) {
return RuntimeManagerImpl::FromWebContents(contents);
}
} // namespace autofill_assistant } // namespace autofill_assistant
...@@ -18,6 +18,11 @@ class RuntimeManager { ...@@ -18,6 +18,11 @@ class RuntimeManager {
// Returns the instance of RuntimeManager that was attached to the // Returns the instance of RuntimeManager that was attached to the
// specified WebContents. Creates a new instance if no instance was attached // specified WebContents. Creates a new instance if no instance was attached
// to |contents| yet. // to |contents| yet.
static RuntimeManager* GetOrCreateForWebContents(
content::WebContents* contents);
// Returns the instance of RuntimeManager that was attached to the
// specified WebContents. If no instance is attached method will return null.
static RuntimeManager* GetForWebContents(content::WebContents* contents); static RuntimeManager* GetForWebContents(content::WebContents* contents);
// Add/Remove observers // Add/Remove observers
......
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