Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Side by Side Diff: chrome/browser/chromeos/input_method/browser_state_monitor.cc

Issue 10968064: Move the NOTIFICATION_APP_TERMINATING notification from content to chrome, since it's fired by chro… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: cros compile Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 24 matching lines...) Expand all
35 content::NotificationService::AllSources()); 35 content::NotificationService::AllSources());
36 notification_registrar_.Add(this, 36 notification_registrar_.Add(this,
37 chrome::NOTIFICATION_SESSION_STARTED, 37 chrome::NOTIFICATION_SESSION_STARTED,
38 content::NotificationService::AllSources()); 38 content::NotificationService::AllSources());
39 notification_registrar_.Add(this, 39 notification_registrar_.Add(this,
40 chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED, 40 chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED,
41 content::NotificationService::AllSources()); 41 content::NotificationService::AllSources());
42 // We should not use ALL_BROWSERS_CLOSING here since logout might be cancelled 42 // We should not use ALL_BROWSERS_CLOSING here since logout might be cancelled
43 // by JavaScript after ALL_BROWSERS_CLOSING is sent (crosbug.com/11055). 43 // by JavaScript after ALL_BROWSERS_CLOSING is sent (crosbug.com/11055).
44 notification_registrar_.Add(this, 44 notification_registrar_.Add(this,
45 content::NOTIFICATION_APP_TERMINATING, 45 chrome::NOTIFICATION_APP_TERMINATING,
46 content::NotificationService::AllSources()); 46 content::NotificationService::AllSources());
47 47
48 manager_->SetState(state_); 48 manager_->SetState(state_);
49 manager_->AddObserver(this); 49 manager_->AddObserver(this);
50 } 50 }
51 51
52 BrowserStateMonitor::~BrowserStateMonitor() { 52 BrowserStateMonitor::~BrowserStateMonitor() {
53 manager_->RemoveObserver(this); 53 manager_->RemoveObserver(this);
54 } 54 }
55 55
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 } 116 }
117 117
118 void BrowserStateMonitor::InputMethodPropertyChanged( 118 void BrowserStateMonitor::InputMethodPropertyChanged(
119 InputMethodManager* manager) {} 119 InputMethodManager* manager) {}
120 120
121 void BrowserStateMonitor::Observe( 121 void BrowserStateMonitor::Observe(
122 int type, 122 int type,
123 const content::NotificationSource& source, 123 const content::NotificationSource& source,
124 const content::NotificationDetails& details) { 124 const content::NotificationDetails& details) {
125 switch (type) { 125 switch (type) {
126 case content::NOTIFICATION_APP_TERMINATING: { 126 case chrome::NOTIFICATION_APP_TERMINATING: {
127 SetState(InputMethodManager::STATE_TERMINATING); 127 SetState(InputMethodManager::STATE_TERMINATING);
128 break; 128 break;
129 } 129 }
130 case chrome::NOTIFICATION_LOGIN_USER_CHANGED: { 130 case chrome::NOTIFICATION_LOGIN_USER_CHANGED: {
131 // The user logged in, but the browser window for user session is not yet 131 // The user logged in, but the browser window for user session is not yet
132 // ready. An initial input method hasn't been set to the manager. 132 // ready. An initial input method hasn't been set to the manager.
133 // Note that the notification is also sent when Chrome crashes/restarts 133 // Note that the notification is also sent when Chrome crashes/restarts
134 // as of writing, but it might be changed in the future (therefore we need 134 // as of writing, but it might be changed in the future (therefore we need
135 // to listen to NOTIFICATION_SESSION_STARTED as well.) 135 // to listen to NOTIFICATION_SESSION_STARTED as well.)
136 DVLOG(1) << "Received chrome::NOTIFICATION_LOGIN_USER_CHANGED"; 136 DVLOG(1) << "Received chrome::NOTIFICATION_LOGIN_USER_CHANGED";
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 185
186 void BrowserStateMonitor::SetState(InputMethodManager::State new_state) { 186 void BrowserStateMonitor::SetState(InputMethodManager::State new_state) {
187 const InputMethodManager::State old_state = state_; 187 const InputMethodManager::State old_state = state_;
188 state_ = new_state; 188 state_ = new_state;
189 if (old_state != state_) 189 if (old_state != state_)
190 manager_->SetState(state_); 190 manager_->SetState(state_);
191 } 191 }
192 192
193 } // namespace input_method 193 } // namespace input_method
194 } // namespace chromeos 194 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698