OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_io_data.h" | 5 #include "chrome/browser/profiles/profile_io_data.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "chrome/browser/net/chrome_dns_cert_provenance_checker_factory.h" | 22 #include "chrome/browser/net/chrome_dns_cert_provenance_checker_factory.h" |
23 #include "chrome/browser/net/chrome_net_log.h" | 23 #include "chrome/browser/net/chrome_net_log.h" |
24 #include "chrome/browser/net/chrome_network_delegate.h" | 24 #include "chrome/browser/net/chrome_network_delegate.h" |
25 #include "chrome/browser/net/pref_proxy_config_service.h" | 25 #include "chrome/browser/net/pref_proxy_config_service.h" |
26 #include "chrome/browser/net/proxy_service_factory.h" | 26 #include "chrome/browser/net/proxy_service_factory.h" |
27 #include "chrome/browser/notifications/desktop_notification_service_factory.h" | 27 #include "chrome/browser/notifications/desktop_notification_service_factory.h" |
28 #include "chrome/browser/prefs/pref_service.h" | 28 #include "chrome/browser/prefs/pref_service.h" |
29 #include "chrome/browser/prerender/prerender_manager.h" | 29 #include "chrome/browser/prerender/prerender_manager.h" |
30 #include "chrome/browser/profiles/profile.h" | 30 #include "chrome/browser/profiles/profile.h" |
31 #include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h" | 31 #include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h" |
| 32 #include "chrome/common/chrome_notification_types.h" |
32 #include "chrome/common/chrome_switches.h" | 33 #include "chrome/common/chrome_switches.h" |
33 #include "chrome/common/pref_names.h" | 34 #include "chrome/common/pref_names.h" |
34 #include "chrome/common/url_constants.h" | 35 #include "chrome/common/url_constants.h" |
35 #include "content/browser/browser_thread.h" | 36 #include "content/browser/browser_thread.h" |
36 #include "content/browser/host_zoom_map.h" | 37 #include "content/browser/host_zoom_map.h" |
37 #include "content/browser/renderer_host/resource_dispatcher_host.h" | 38 #include "content/browser/renderer_host/resource_dispatcher_host.h" |
38 #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h" | 39 #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h" |
39 #include "content/browser/resource_context.h" | 40 #include "content/browser/resource_context.h" |
40 #include "content/common/notification_service.h" | 41 #include "content/common/notification_service.h" |
41 #include "net/http/http_util.h" | 42 #include "net/http/http_util.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 // the notifications. All methods of ProfileGetter must be invoked on the UI | 87 // the notifications. All methods of ProfileGetter must be invoked on the UI |
87 // thread. | 88 // thread. |
88 class ProfileGetter | 89 class ProfileGetter |
89 : public base::RefCountedThreadSafe<ProfileGetter, | 90 : public base::RefCountedThreadSafe<ProfileGetter, |
90 BrowserThread::DeleteOnUIThread>, | 91 BrowserThread::DeleteOnUIThread>, |
91 public NotificationObserver { | 92 public NotificationObserver { |
92 public: | 93 public: |
93 explicit ProfileGetter(Profile* profile) : profile_(profile) { | 94 explicit ProfileGetter(Profile* profile) : profile_(profile) { |
94 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 95 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
95 registrar_.Add(this, | 96 registrar_.Add(this, |
96 NotificationType::PROFILE_DESTROYED, | 97 chrome::NOTIFICATION_PROFILE_DESTROYED, |
97 Source<Profile>(profile_)); | 98 Source<Profile>(profile_)); |
98 } | 99 } |
99 | 100 |
100 // NotificationObserver implementation. | 101 // NotificationObserver implementation. |
101 void Observe(NotificationType type, | 102 void Observe(int type, |
102 const NotificationSource& source, | 103 const NotificationSource& source, |
103 const NotificationDetails& details) { | 104 const NotificationDetails& details) { |
104 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 105 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
105 if (NotificationType::PROFILE_DESTROYED == type) { | 106 if (chrome::NOTIFICATION_PROFILE_DESTROYED == type) { |
106 Profile* profile = Source<Profile>(source).ptr(); | 107 Profile* profile = Source<Profile>(source).ptr(); |
107 if (profile_ == profile) | 108 if (profile_ == profile) |
108 profile_ = NULL; | 109 profile_ = NULL; |
109 } | 110 } |
110 } | 111 } |
111 | 112 |
112 Profile* get() { | 113 Profile* get() { |
113 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 114 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
114 return profile_; | 115 return profile_; |
115 } | 116 } |
(...skipping 11 matching lines...) Expand all Loading... |
127 | 128 |
128 virtual ~ChromeCookieMonsterDelegate() {} | 129 virtual ~ChromeCookieMonsterDelegate() {} |
129 | 130 |
130 void OnCookieChangedAsyncHelper( | 131 void OnCookieChangedAsyncHelper( |
131 const net::CookieMonster::CanonicalCookie& cookie, | 132 const net::CookieMonster::CanonicalCookie& cookie, |
132 bool removed, | 133 bool removed, |
133 net::CookieMonster::Delegate::ChangeCause cause) { | 134 net::CookieMonster::Delegate::ChangeCause cause) { |
134 if (profile_getter_->get()) { | 135 if (profile_getter_->get()) { |
135 ChromeCookieDetails cookie_details(&cookie, removed, cause); | 136 ChromeCookieDetails cookie_details(&cookie, removed, cause); |
136 NotificationService::current()->Notify( | 137 NotificationService::current()->Notify( |
137 NotificationType::COOKIE_CHANGED, | 138 chrome::NOTIFICATION_COOKIE_CHANGED, |
138 Source<Profile>(profile_getter_->get()), | 139 Source<Profile>(profile_getter_->get()), |
139 Details<ChromeCookieDetails>(&cookie_details)); | 140 Details<ChromeCookieDetails>(&cookie_details)); |
140 } | 141 } |
141 } | 142 } |
142 | 143 |
143 scoped_refptr<ProfileGetter> profile_getter_; | 144 scoped_refptr<ProfileGetter> profile_getter_; |
144 }; | 145 }; |
145 | 146 |
146 class ProtocolHandlerRegistryInterceptor | 147 class ProtocolHandlerRegistryInterceptor |
147 : public net::URLRequestJobFactory::Interceptor { | 148 : public net::URLRequestJobFactory::Interceptor { |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 context->set_blob_storage_context(profile_params_->blob_storage_context); | 511 context->set_blob_storage_context(profile_params_->blob_storage_context); |
511 context->set_file_system_context(profile_params_->file_system_context); | 512 context->set_file_system_context(profile_params_->file_system_context); |
512 context->set_extension_info_map(profile_params_->extension_info_map); | 513 context->set_extension_info_map(profile_params_->extension_info_map); |
513 } | 514 } |
514 | 515 |
515 void ProfileIOData::ShutdownOnUIThread() { | 516 void ProfileIOData::ShutdownOnUIThread() { |
516 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 517 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
517 enable_referrers_.Destroy(); | 518 enable_referrers_.Destroy(); |
518 clear_local_state_on_exit_.Destroy(); | 519 clear_local_state_on_exit_.Destroy(); |
519 } | 520 } |
OLD | NEW |