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

Side by Side Diff: chrome/browser/ui/webui/options/content_settings_handler.cc

Issue 652183006: Revert of Listen to Off The Record profiles in ContentSettingsHandler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkcr
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « base/scoped_observer.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/options/content_settings_handler.h" 5 #include "chrome/browser/ui/webui/options/content_settings_handler.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 base::Unretained(this))); 490 base::Unretained(this)));
491 491
492 content::HostZoomMap* host_zoom_map = 492 content::HostZoomMap* host_zoom_map =
493 content::HostZoomMap::GetDefaultForBrowserContext(context); 493 content::HostZoomMap::GetDefaultForBrowserContext(context);
494 host_zoom_map_subscription_ = 494 host_zoom_map_subscription_ =
495 host_zoom_map->AddZoomLevelChangedCallback( 495 host_zoom_map->AddZoomLevelChangedCallback(
496 base::Bind(&ContentSettingsHandler::OnZoomLevelChanged, 496 base::Bind(&ContentSettingsHandler::OnZoomLevelChanged,
497 base::Unretained(this))); 497 base::Unretained(this)));
498 498
499 flash_settings_manager_.reset(new PepperFlashSettingsManager(this, context)); 499 flash_settings_manager_.reset(new PepperFlashSettingsManager(this, context));
500 500 observer_.Add(Profile::FromWebUI(web_ui())->GetHostContentSettingsMap());
501 Profile* profile = Profile::FromWebUI(web_ui());
502 observer_.Add(profile->GetHostContentSettingsMap());
503 if (profile->HasOffTheRecordProfile()) {
504 observer_.Add(
505 profile->GetOffTheRecordProfile()->GetHostContentSettingsMap());
506 }
507 } 501 }
508 502
509 void ContentSettingsHandler::InitializePage() { 503 void ContentSettingsHandler::InitializePage() {
510 media_settings_ = MediaSettingsInfo(); 504 media_settings_ = MediaSettingsInfo();
511 RefreshFlashMediaSettings(); 505 RefreshFlashMediaSettings();
512 506
513 UpdateHandlersEnabledRadios(); 507 UpdateHandlersEnabledRadios();
514 UpdateAllExceptionsViewsFromModel(); 508 UpdateAllExceptionsViewsFromModel();
515 UpdateProtectedContentExceptionsButton(); 509 UpdateProtectedContentExceptionsButton();
516 } 510 }
(...skipping 11 matching lines...) Expand all
528 else 522 else
529 UpdateExceptionsViewFromModel(details.type()); 523 UpdateExceptionsViewFromModel(details.type());
530 } 524 }
531 525
532 void ContentSettingsHandler::Observe( 526 void ContentSettingsHandler::Observe(
533 int type, 527 int type,
534 const content::NotificationSource& source, 528 const content::NotificationSource& source,
535 const content::NotificationDetails& details) { 529 const content::NotificationDetails& details) {
536 switch (type) { 530 switch (type) {
537 case chrome::NOTIFICATION_PROFILE_DESTROYED: { 531 case chrome::NOTIFICATION_PROFILE_DESTROYED: {
538 Profile* profile = content::Source<Profile>(source).ptr(); 532 if (content::Source<Profile>(source).ptr()->IsOffTheRecord()) {
539 if (profile->IsOffTheRecord() &&
540 observer_.IsObserving(profile->GetHostContentSettingsMap())) {
541 web_ui()->CallJavascriptFunction( 533 web_ui()->CallJavascriptFunction(
542 "ContentSettingsExceptionsArea.OTRProfileDestroyed"); 534 "ContentSettingsExceptionsArea.OTRProfileDestroyed");
543 observer_.Remove(profile->GetHostContentSettingsMap());
544 } 535 }
545 break; 536 break;
546 } 537 }
547 538
548 case chrome::NOTIFICATION_PROFILE_CREATED: { 539 case chrome::NOTIFICATION_PROFILE_CREATED: {
549 Profile* profile = content::Source<Profile>(source).ptr(); 540 if (content::Source<Profile>(source).ptr()->IsOffTheRecord())
550 if (profile->IsOffTheRecord()) {
551 UpdateAllOTRExceptionsViewsFromModel(); 541 UpdateAllOTRExceptionsViewsFromModel();
552 observer_.Add(profile->GetHostContentSettingsMap());
553 }
554 break; 542 break;
555 } 543 }
556 544
557 case chrome::NOTIFICATION_DESKTOP_NOTIFICATION_SETTINGS_CHANGED: { 545 case chrome::NOTIFICATION_DESKTOP_NOTIFICATION_SETTINGS_CHANGED: {
558 UpdateNotificationExceptionsView(); 546 UpdateNotificationExceptionsView();
559 break; 547 break;
560 } 548 }
561 549
562 case chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED: { 550 case chrome::NOTIFICATION_PROTOCOL_HANDLER_REGISTRY_CHANGED: {
563 UpdateHandlersEnabledRadios(); 551 UpdateHandlersEnabledRadios();
(...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after
1512 1500
1513 // Exceptions apply only when the feature is enabled. 1501 // Exceptions apply only when the feature is enabled.
1514 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); 1502 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui()));
1515 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); 1503 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM);
1516 web_ui()->CallJavascriptFunction( 1504 web_ui()->CallJavascriptFunction(
1517 "ContentSettings.enableProtectedContentExceptions", 1505 "ContentSettings.enableProtectedContentExceptions",
1518 base::FundamentalValue(enable_exceptions)); 1506 base::FundamentalValue(enable_exceptions));
1519 } 1507 }
1520 1508
1521 } // namespace options 1509 } // namespace options
OLDNEW
« no previous file with comments | « base/scoped_observer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698