OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/chromeos/input_method/browser_state_monitor.h" | 5 #include "chrome/browser/chromeos/input_method/browser_state_monitor.h" |
6 | 6 |
7 #include "chrome/browser/browser_process.h" | 7 #include "chrome/browser/browser_process.h" |
8 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 8 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
9 #include "chrome/browser/chromeos/language_preferences.h" | 9 #include "chrome/browser/chromeos/language_preferences.h" |
10 #include "chrome/browser/prefs/pref_service.h" | 10 #include "chrome/browser/prefs/pref_service.h" |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 DVLOG(1) << "Received chrome::NOTIFICATION_SESSION_STARTED"; | 146 DVLOG(1) << "Received chrome::NOTIFICATION_SESSION_STARTED"; |
147 SetState(InputMethodManager::STATE_BROWSER_SCREEN); | 147 SetState(InputMethodManager::STATE_BROWSER_SCREEN); |
148 break; | 148 break; |
149 } | 149 } |
150 case chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED: { | 150 case chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED: { |
151 const bool is_screen_locked = *content::Details<bool>(details).ptr(); | 151 const bool is_screen_locked = *content::Details<bool>(details).ptr(); |
152 SetState(is_screen_locked ? InputMethodManager::STATE_LOCK_SCREEN : | 152 SetState(is_screen_locked ? InputMethodManager::STATE_LOCK_SCREEN : |
153 InputMethodManager::STATE_BROWSER_SCREEN); | 153 InputMethodManager::STATE_BROWSER_SCREEN); |
154 break; | 154 break; |
155 } | 155 } |
156 case chrome::NOTIFICATION_PREF_CHANGED: { | |
157 break; // just ignore the notification. | |
158 } | |
159 default: { | 156 default: { |
160 NOTREACHED(); | 157 NOTREACHED(); |
161 break; | 158 break; |
162 } | 159 } |
163 } | 160 } |
164 // Note: browser notifications are sent in the following order. | 161 // Note: browser notifications are sent in the following order. |
165 // | 162 // |
166 // Normal login: | 163 // Normal login: |
167 // 1. chrome::NOTIFICATION_LOGIN_USER_CHANGED is sent. | 164 // 1. chrome::NOTIFICATION_LOGIN_USER_CHANGED is sent. |
168 // 2. Preferences::NotifyPrefChanged() is called. preload_engines (which | 165 // 2. Preferences::NotifyPrefChanged() is called. preload_engines (which |
(...skipping 16 matching lines...) Expand all Loading... |
185 | 182 |
186 void BrowserStateMonitor::SetState(InputMethodManager::State new_state) { | 183 void BrowserStateMonitor::SetState(InputMethodManager::State new_state) { |
187 const InputMethodManager::State old_state = state_; | 184 const InputMethodManager::State old_state = state_; |
188 state_ = new_state; | 185 state_ = new_state; |
189 if (old_state != state_) | 186 if (old_state != state_) |
190 manager_->SetState(state_); | 187 manager_->SetState(state_); |
191 } | 188 } |
192 | 189 |
193 } // namespace input_method | 190 } // namespace input_method |
194 } // namespace chromeos | 191 } // namespace chromeos |
OLD | NEW |