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

Side by Side Diff: chrome/browser/profiles/profile.cc

Issue 10824020: Move PROFILE_DESTROYED notification to ProfileDestroyer and observe it in ExtensionProcessManager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: destroy original profile->destroy incognito EPM 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/profiles/profile.h" 5 #include "chrome/browser/profiles/profile.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "chrome/browser/prefs/pref_service.h" 10 #include "chrome/browser/prefs/pref_service.h"
11 #include "chrome/browser/sync/profile_sync_service.h" 11 #include "chrome/browser/sync/profile_sync_service.h"
12 #include "chrome/browser/sync/sync_prefs.h" 12 #include "chrome/browser/sync/sync_prefs.h"
13 #include "chrome/common/chrome_notification_types.h"
13 #include "chrome/common/pref_names.h" 14 #include "chrome/common/pref_names.h"
15 #include "content/public/browser/notification_service.h"
16 #include "content/public/browser/notification_source.h"
14 #include "content/public/browser/web_contents.h" 17 #include "content/public/browser/web_contents.h"
15 #include "content/public/browser/web_ui.h" 18 #include "content/public/browser/web_ui.h"
16 19
17 #if defined(OS_CHROMEOS) 20 #if defined(OS_CHROMEOS)
18 #include "base/command_line.h" 21 #include "base/command_line.h"
19 #include "chrome/common/chrome_switches.h" 22 #include "chrome/common/chrome_switches.h"
20 #endif 23 #endif
21 24
22 Profile::Profile() 25 Profile::Profile()
23 : restored_last_session_(false), 26 : restored_last_session_(false),
27 sent_destroyed_notification_(false),
24 accessibility_pause_level_(0) { 28 accessibility_pause_level_(0) {
25 } 29 }
26 30
27 // static 31 // static
28 Profile* Profile::FromBrowserContext(content::BrowserContext* browser_context) { 32 Profile* Profile::FromBrowserContext(content::BrowserContext* browser_context) {
29 // This is safe; this is the only implementation of the browser context. 33 // This is safe; this is the only implementation of the browser context.
30 return static_cast<Profile*>(browser_context); 34 return static_cast<Profile*>(browser_context);
31 } 35 }
32 36
33 // static 37 // static
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 return is_guest_session; 114 return is_guest_session;
111 #else 115 #else
112 return false; 116 return false;
113 #endif 117 #endif
114 } 118 }
115 119
116 bool Profile::IsSyncAccessible() { 120 bool Profile::IsSyncAccessible() {
117 browser_sync::SyncPrefs prefs(GetPrefs()); 121 browser_sync::SyncPrefs prefs(GetPrefs());
118 return ProfileSyncService::IsSyncEnabled() && !prefs.IsManaged(); 122 return ProfileSyncService::IsSyncEnabled() && !prefs.IsManaged();
119 } 123 }
124
125 void Profile::MaybeSendDestroyedNotification() {
126 if (!sent_destroyed_notification_) {
127 sent_destroyed_notification_ = true;
128 content::NotificationService::current()->Notify(
129 chrome::NOTIFICATION_PROFILE_DESTROYED,
130 content::Source<Profile>(this),
131 content::NotificationService::NoDetails());
132 }
133 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698