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

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

Issue 9693032: [uber page] Split up initialization of handlers from initialization of webui pages (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 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 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 } 294 }
295 295
296 void ContentSettingsHandler::Initialize() { 296 void ContentSettingsHandler::Initialize() {
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::SendPageValues() {
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 580 matching lines...) Expand 10 before | Expand all | Expand 10 after
912 915
913 HostContentSettingsMap* 916 HostContentSettingsMap*
914 ContentSettingsHandler::GetOTRContentSettingsMap() { 917 ContentSettingsHandler::GetOTRContentSettingsMap() {
915 Profile* profile = Profile::FromWebUI(web_ui()); 918 Profile* profile = Profile::FromWebUI(web_ui());
916 if (profile->HasOffTheRecordProfile()) 919 if (profile->HasOffTheRecordProfile())
917 return profile->GetOffTheRecordProfile()->GetHostContentSettingsMap(); 920 return profile->GetOffTheRecordProfile()->GetHostContentSettingsMap();
918 return NULL; 921 return NULL;
919 } 922 }
920 923
921 } // namespace options2 924 } // namespace options2
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698