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

Side by Side Diff: chrome/browser/managed_mode.cc

Issue 10779042: Move notifications only used in chrome/ to chrome/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix oops Created 8 years, 5 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/managed_mode.h" 5 #include "chrome/browser/managed_mode.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/extensions/extension_system.h" 9 #include "chrome/browser/extensions/extension_system.h"
10 #include "chrome/browser/prefs/pref_service.h" 10 #include "chrome/browser/prefs/pref_service.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 105
106 if (browsers_to_close_.empty()) { 106 if (browsers_to_close_.empty()) {
107 SetInManagedMode(original_profile); 107 SetInManagedMode(original_profile);
108 callback.Run(true); 108 callback.Run(true);
109 return; 109 return;
110 } 110 }
111 // Remember the profile we're trying to manage while we wait for other 111 // Remember the profile we're trying to manage while we wait for other
112 // browsers to close. 112 // browsers to close.
113 managed_profile_ = original_profile; 113 managed_profile_ = original_profile;
114 callbacks_.push_back(callback); 114 callbacks_.push_back(callback);
115 registrar_.Add(this, content::NOTIFICATION_CLOSE_ALL_BROWSERS_REQUEST, 115 registrar_.Add(this, chrome::NOTIFICATION_CLOSE_ALL_BROWSERS_REQUEST,
116 content::NotificationService::AllSources()); 116 content::NotificationService::AllSources());
117 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_CLOSE_CANCELLED, 117 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_CLOSE_CANCELLED,
118 content::NotificationService::AllSources()); 118 content::NotificationService::AllSources());
119 for (std::set<Browser*>::const_iterator i = browsers_to_close_.begin(); 119 for (std::set<Browser*>::const_iterator i = browsers_to_close_.begin();
120 i != browsers_to_close_.end(); ++i) { 120 i != browsers_to_close_.end(); ++i) {
121 (*i)->window()->Close(); 121 (*i)->window()->Close();
122 } 122 }
123 } 123 }
124 124
125 // static 125 // static
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 } 199 }
200 200
201 void ManagedMode::Observe(int type, 201 void ManagedMode::Observe(int type,
202 const content::NotificationSource& source, 202 const content::NotificationSource& source,
203 const content::NotificationDetails& details) { 203 const content::NotificationDetails& details) {
204 // Return early if we don't have any queued callbacks. 204 // Return early if we don't have any queued callbacks.
205 if (callbacks_.empty()) 205 if (callbacks_.empty())
206 return; 206 return;
207 207
208 switch (type) { 208 switch (type) {
209 case content::NOTIFICATION_CLOSE_ALL_BROWSERS_REQUEST: { 209 case chrome::NOTIFICATION_CLOSE_ALL_BROWSERS_REQUEST: {
210 FinalizeEnter(false); 210 FinalizeEnter(false);
211 return; 211 return;
212 } 212 }
213 case chrome::NOTIFICATION_BROWSER_CLOSE_CANCELLED: { 213 case chrome::NOTIFICATION_BROWSER_CLOSE_CANCELLED: {
214 Browser* browser = content::Source<Browser>(source).ptr(); 214 Browser* browser = content::Source<Browser>(source).ptr();
215 if (browsers_to_close_.find(browser) != browsers_to_close_.end()) 215 if (browsers_to_close_.find(browser) != browsers_to_close_.end())
216 FinalizeEnter(false); 216 FinalizeEnter(false);
217 return; 217 return;
218 } 218 }
219 default: { 219 default: {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 g_browser_process->local_state()->SetBoolean(prefs::kInManagedMode, false); 260 g_browser_process->local_state()->SetBoolean(prefs::kInManagedMode, false);
261 } 261 }
262 managed_profile_ = newly_managed_profile; 262 managed_profile_ = newly_managed_profile;
263 263
264 // This causes the avatar and the profile menu to get updated. 264 // This causes the avatar and the profile menu to get updated.
265 content::NotificationService::current()->Notify( 265 content::NotificationService::current()->Notify(
266 chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED, 266 chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED,
267 content::NotificationService::AllBrowserContextsAndSources(), 267 content::NotificationService::AllBrowserContextsAndSources(),
268 content::NotificationService::NoDetails()); 268 content::NotificationService::NoDetails());
269 } 269 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698