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/ui/webui/options2/content_settings_handler2.h" | 5 #include "chrome/browser/ui/webui/options2/content_settings_handler2.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 RegisterTitle(localized_strings, "contentSettingsPage", | 286 RegisterTitle(localized_strings, "contentSettingsPage", |
287 IDS_CONTENT_SETTINGS_TITLE); | 287 IDS_CONTENT_SETTINGS_TITLE); |
288 localized_strings->SetBoolean("enable_web_intents", | 288 localized_strings->SetBoolean("enable_web_intents", |
289 web_intents::IsWebIntentsEnabled()); | 289 web_intents::IsWebIntentsEnabled()); |
290 localized_strings->SetBoolean( | 290 localized_strings->SetBoolean( |
291 "enable_restore_session_state", | 291 "enable_restore_session_state", |
292 !CommandLine::ForCurrentProcess()->HasSwitch( | 292 !CommandLine::ForCurrentProcess()->HasSwitch( |
293 switches::kDisableRestoreSessionState)); | 293 switches::kDisableRestoreSessionState)); |
294 } | 294 } |
295 | 295 |
296 void ContentSettingsHandler::Initialize() { | 296 void ContentSettingsHandler::InitializeHandler() { |
297 notification_registrar_.Add( | 297 notification_registrar_.Add( |
298 this, chrome::NOTIFICATION_PROFILE_CREATED, | 298 this, chrome::NOTIFICATION_PROFILE_CREATED, |
299 content::NotificationService::AllSources()); | 299 content::NotificationService::AllSources()); |
300 notification_registrar_.Add( | 300 notification_registrar_.Add( |
301 this, chrome::NOTIFICATION_PROFILE_DESTROYED, | 301 this, chrome::NOTIFICATION_PROFILE_DESTROYED, |
302 content::NotificationService::AllSources()); | 302 content::NotificationService::AllSources()); |
303 | 303 |
304 UpdateHandlersEnabledRadios(); | |
305 UpdateAllExceptionsViewsFromModel(); | |
306 notification_registrar_.Add( | 304 notification_registrar_.Add( |
307 this, chrome::NOTIFICATION_CONTENT_SETTINGS_CHANGED, | 305 this, chrome::NOTIFICATION_CONTENT_SETTINGS_CHANGED, |
308 content::NotificationService::AllSources()); | 306 content::NotificationService::AllSources()); |
309 notification_registrar_.Add( | 307 notification_registrar_.Add( |
310 this, chrome::NOTIFICATION_DESKTOP_NOTIFICATION_SETTINGS_CHANGED, | 308 this, chrome::NOTIFICATION_DESKTOP_NOTIFICATION_SETTINGS_CHANGED, |
311 content::NotificationService::AllSources()); | 309 content::NotificationService::AllSources()); |
312 Profile* profile = Profile::FromWebUI(web_ui()); | 310 Profile* profile = Profile::FromWebUI(web_ui()); |
313 notification_registrar_.Add( | 311 notification_registrar_.Add( |
314 this, chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED, | 312 this, chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED, |
315 content::Source<Profile>(profile)); | 313 content::Source<Profile>(profile)); |
316 | 314 |
317 PrefService* prefs = profile->GetPrefs(); | 315 PrefService* prefs = profile->GetPrefs(); |
318 pref_change_registrar_.Init(prefs); | 316 pref_change_registrar_.Init(prefs); |
319 pref_change_registrar_.Add(prefs::kGeolocationContentSettings, this); | 317 pref_change_registrar_.Add(prefs::kGeolocationContentSettings, this); |
320 } | 318 } |
321 | 319 |
| 320 void ContentSettingsHandler::InitializePage() { |
| 321 UpdateHandlersEnabledRadios(); |
| 322 UpdateAllExceptionsViewsFromModel(); |
| 323 } |
| 324 |
322 void ContentSettingsHandler::Observe( | 325 void ContentSettingsHandler::Observe( |
323 int type, | 326 int type, |
324 const content::NotificationSource& source, | 327 const content::NotificationSource& source, |
325 const content::NotificationDetails& details) { | 328 const content::NotificationDetails& details) { |
326 switch (type) { | 329 switch (type) { |
327 case chrome::NOTIFICATION_PROFILE_DESTROYED: { | 330 case chrome::NOTIFICATION_PROFILE_DESTROYED: { |
328 if (content::Source<Profile>(source).ptr()->IsOffTheRecord()) { | 331 if (content::Source<Profile>(source).ptr()->IsOffTheRecord()) { |
329 web_ui()->CallJavascriptFunction( | 332 web_ui()->CallJavascriptFunction( |
330 "ContentSettingsExceptionsArea.OTRProfileDestroyed"); | 333 "ContentSettingsExceptionsArea.OTRProfileDestroyed"); |
331 } | 334 } |
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
914 | 917 |
915 HostContentSettingsMap* | 918 HostContentSettingsMap* |
916 ContentSettingsHandler::GetOTRContentSettingsMap() { | 919 ContentSettingsHandler::GetOTRContentSettingsMap() { |
917 Profile* profile = Profile::FromWebUI(web_ui()); | 920 Profile* profile = Profile::FromWebUI(web_ui()); |
918 if (profile->HasOffTheRecordProfile()) | 921 if (profile->HasOffTheRecordProfile()) |
919 return profile->GetOffTheRecordProfile()->GetHostContentSettingsMap(); | 922 return profile->GetOffTheRecordProfile()->GetHostContentSettingsMap(); |
920 return NULL; | 923 return NULL; |
921 } | 924 } |
922 | 925 |
923 } // namespace options2 | 926 } // namespace options2 |
OLD | NEW |