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

Side by Side Diff: chrome/browser/ui/webui/options2/content_settings_handler2.cc

Issue 9994005: Separate handler initialization from page initialization (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: move anything that indirectly calls JS to InitializePage Created 8 years, 8 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/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
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 // TODO(marja): clean up the options UI after the decision on the session 290 // TODO(marja): clean up the options UI after the decision on the session
291 // restore changes has stabilized. 291 // restore changes has stabilized.
292 localized_strings->SetBoolean( 292 localized_strings->SetBoolean(
293 "enable_restore_session_state", false); 293 "enable_restore_session_state", false);
294 } 294 }
295 295
296 void ContentSettingsHandler::InitializeHandler() { 296 void ContentSettingsHandler::InitializePage() {
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 notification_registrar_.Add( 304 notification_registrar_.Add(
305 this, chrome::NOTIFICATION_CONTENT_SETTINGS_CHANGED, 305 this, chrome::NOTIFICATION_CONTENT_SETTINGS_CHANGED,
306 content::NotificationService::AllSources()); 306 content::NotificationService::AllSources());
307 notification_registrar_.Add( 307 notification_registrar_.Add(
308 this, chrome::NOTIFICATION_DESKTOP_NOTIFICATION_SETTINGS_CHANGED, 308 this, chrome::NOTIFICATION_DESKTOP_NOTIFICATION_SETTINGS_CHANGED,
309 content::NotificationService::AllSources()); 309 content::NotificationService::AllSources());
310 Profile* profile = Profile::FromWebUI(web_ui()); 310 Profile* profile = Profile::FromWebUI(web_ui());
311 notification_registrar_.Add( 311 notification_registrar_.Add(
312 this, chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED, 312 this, chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED,
313 content::Source<Profile>(profile)); 313 content::Source<Profile>(profile));
314 314
315 PrefService* prefs = profile->GetPrefs(); 315 PrefService* prefs = profile->GetPrefs();
316 pref_change_registrar_.Init(prefs); 316 pref_change_registrar_.Init(prefs);
317 pref_change_registrar_.Add(prefs::kGeolocationContentSettings, this); 317 pref_change_registrar_.Add(prefs::kGeolocationContentSettings, this);
318 }
319 318
320 void ContentSettingsHandler::InitializePage() {
321 UpdateHandlersEnabledRadios(); 319 UpdateHandlersEnabledRadios();
322 UpdateAllExceptionsViewsFromModel(); 320 UpdateAllExceptionsViewsFromModel();
323 } 321 }
324 322
325 void ContentSettingsHandler::Observe( 323 void ContentSettingsHandler::Observe(
326 int type, 324 int type,
327 const content::NotificationSource& source, 325 const content::NotificationSource& source,
328 const content::NotificationDetails& details) { 326 const content::NotificationDetails& details) {
329 switch (type) { 327 switch (type) {
330 case chrome::NOTIFICATION_PROFILE_DESTROYED: { 328 case chrome::NOTIFICATION_PROFILE_DESTROYED: {
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after
917 915
918 HostContentSettingsMap* 916 HostContentSettingsMap*
919 ContentSettingsHandler::GetOTRContentSettingsMap() { 917 ContentSettingsHandler::GetOTRContentSettingsMap() {
920 Profile* profile = Profile::FromWebUI(web_ui()); 918 Profile* profile = Profile::FromWebUI(web_ui());
921 if (profile->HasOffTheRecordProfile()) 919 if (profile->HasOffTheRecordProfile())
922 return profile->GetOffTheRecordProfile()->GetHostContentSettingsMap(); 920 return profile->GetOffTheRecordProfile()->GetHostContentSettingsMap();
923 return NULL; 921 return NULL;
924 } 922 }
925 923
926 } // namespace options2 924 } // namespace options2
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698