summaryrefslogtreecommitdiffstats
path: root/content/renderer/ime_event_guard.h
blob: c3854b175393dc7d214f62d2352eeac84bd5464e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright 2013 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 CONTENT_RENDERER_IME_EVENT_GUARD_H_
#define CONTENT_RENDERER_IME_EVENT_GUARD_H_

namespace content {
class RenderWidget;

// Simple RAII object for guarding IME updates. Calls OnImeGuardStart on
// construction and OnImeGuardFinish on destruction.
class ImeEventGuard {
 public:
  explicit ImeEventGuard(RenderWidget* widget);
  ImeEventGuard(RenderWidget* widget, bool show_ime, bool from_ime);
  ~ImeEventGuard();

  bool show_ime() const { return show_ime_; }
  bool from_ime() const { return from_ime_; }
  void set_show_ime(bool show_ime) { show_ime_ = show_ime; }
  void set_from_ime(bool from_ime) { from_ime_ = from_ime; }

 private:
  RenderWidget* widget_;
  bool show_ime_;
  bool from_ime_;
};
}

#endif  // CONTENT_RENDERER_IME_EVENT_GUARD_H_