Add a minor text member to ui::MenuModel.
[chromium-blink-merge.git] / chrome / browser / chromeos / input_method / browser_state_monitor.h
blobf82468f6fae5052c2191c49d3d2462937fdbd30f
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_CHROMEOS_INPUT_METHOD_BROWSER_STATE_MONITOR_H_
6 #define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_BROWSER_STATE_MONITOR_H_
8 #include <string>
10 #include "base/basictypes.h"
11 #include "base/callback.h"
12 #include "base/compiler_specific.h"
13 #include "chromeos/ime/input_method_manager.h"
14 #include "content/public/browser/notification_observer.h"
15 #include "content/public/browser/notification_registrar.h"
17 namespace chromeos {
18 namespace input_method {
20 // Translates notifications from the browser (not logged in, logged in, etc.),
21 // into InputMethodManager::State transitions.
22 class BrowserStateMonitor : public content::NotificationObserver {
23 public:
24 // Constructs a monitor that will invoke the given observer callback whenever
25 // the InputMethodManager::State changes. Assumes that the current state is
26 // STATE_LOGIN_SCREEN. |observer| may be null.
27 explicit BrowserStateMonitor(
28 const base::Callback<void(InputMethodManager::State)>& observer);
29 virtual ~BrowserStateMonitor();
31 InputMethodManager::State state() const { return state_; }
33 // content::NotificationObserver overrides:
34 virtual void Observe(int type,
35 const content::NotificationSource& source,
36 const content::NotificationDetails& details) OVERRIDE;
38 private:
39 base::Callback<void(InputMethodManager::State)> observer_;
40 InputMethodManager::State state_;
41 content::NotificationRegistrar notification_registrar_;
43 DISALLOW_COPY_AND_ASSIGN(BrowserStateMonitor);
46 } // namespace input_method
47 } // namespace chromeos
49 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_BROWSER_STATE_MONITOR_H_