blob: f2dec8fa4b152b944ba6ea5c748b554f869007fc [file] [log] [blame]
// Copyright 2021 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 COMPONENTS_AUTOFILL_ASSISTANT_BROWSER_SUPPRESS_KEYBOARD_RAII_H_
#define COMPONENTS_AUTOFILL_ASSISTANT_BROWSER_SUPPRESS_KEYBOARD_RAII_H_
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_observer.h"
namespace autofill_assistant {
// RAII object that suppresses the keyboard when the object is allocated and
// frees it when it gets deallocated.
class SuppressKeyboardRAII : public content::WebContentsObserver {
public:
SuppressKeyboardRAII(content::WebContents* web_contents);
~SuppressKeyboardRAII() override;
SuppressKeyboardRAII(const SuppressKeyboardRAII&) = delete;
SuppressKeyboardRAII& operator=(const SuppressKeyboardRAII&) = delete;
// Overrides content::WebContentsObserver:
void RenderFrameCreated(content::RenderFrameHost* render_frame_host) override;
private:
void SuppressKeyboard(bool suppress);
};
} // namespace autofill_assistant
#endif // COMPONENTS_AUTOFILL_ASSISTANT_BROWSER_SUPPRESS_KEYBOARD_RAII_H_