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/prefs/prefs_tab_helper.h" | 5 #include "chrome/browser/ui/prefs/prefs_tab_helper.h" |
6 | 6 |
7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
8 #include "base/stringprintf.h" | 8 #include "base/stringprintf.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 per_tab_pref_change_registrar_.Init(per_tab_prefs_.get()); | 357 per_tab_pref_change_registrar_.Init(per_tab_prefs_.get()); |
358 for (int i = 0; i < kPerTabPrefsToObserveLength; ++i) { | 358 for (int i = 0; i < kPerTabPrefsToObserveLength; ++i) { |
359 per_tab_pref_change_registrar_.Add(kPerTabPrefsToObserve[i], this); | 359 per_tab_pref_change_registrar_.Add(kPerTabPrefsToObserve[i], this); |
360 } | 360 } |
361 | 361 |
362 renderer_preferences_util::UpdateFromSystemSettings( | 362 renderer_preferences_util::UpdateFromSystemSettings( |
363 web_contents()->GetMutableRendererPrefs(), GetProfile()); | 363 web_contents()->GetMutableRendererPrefs(), GetProfile()); |
364 | 364 |
365 registrar_.Add(this, chrome::NOTIFICATION_USER_STYLE_SHEET_UPDATED, | 365 registrar_.Add(this, chrome::NOTIFICATION_USER_STYLE_SHEET_UPDATED, |
366 content::NotificationService::AllSources()); | 366 content::NotificationService::AllSources()); |
367 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 367 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) |
368 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, | 368 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, |
369 content::Source<ThemeService>( | 369 content::Source<ThemeService>( |
370 ThemeServiceFactory::GetForProfile(GetProfile()))); | 370 ThemeServiceFactory::GetForProfile(GetProfile()))); |
371 #endif | 371 #endif |
372 } | 372 } |
373 | 373 |
374 PrefsTabHelper::~PrefsTabHelper() { | 374 PrefsTabHelper::~PrefsTabHelper() { |
375 } | 375 } |
376 | 376 |
377 // static | 377 // static |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 per_tab_pref_change_registrar_.RemoveAll(); | 577 per_tab_pref_change_registrar_.RemoveAll(); |
578 } | 578 } |
579 | 579 |
580 void PrefsTabHelper::Observe(int type, | 580 void PrefsTabHelper::Observe(int type, |
581 const content::NotificationSource& source, | 581 const content::NotificationSource& source, |
582 const content::NotificationDetails& details) { | 582 const content::NotificationDetails& details) { |
583 switch (type) { | 583 switch (type) { |
584 case chrome::NOTIFICATION_USER_STYLE_SHEET_UPDATED: | 584 case chrome::NOTIFICATION_USER_STYLE_SHEET_UPDATED: |
585 UpdateWebPreferences(); | 585 UpdateWebPreferences(); |
586 break; | 586 break; |
587 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 587 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) |
588 case chrome::NOTIFICATION_BROWSER_THEME_CHANGED: { | 588 case chrome::NOTIFICATION_BROWSER_THEME_CHANGED: { |
589 UpdateRendererPreferences(); | 589 UpdateRendererPreferences(); |
590 break; | 590 break; |
591 } | 591 } |
592 #endif | 592 #endif |
593 case chrome::NOTIFICATION_PREF_CHANGED: { | 593 case chrome::NOTIFICATION_PREF_CHANGED: { |
594 std::string* pref_name_in = content::Details<std::string>(details).ptr(); | 594 std::string* pref_name_in = content::Details<std::string>(details).ptr(); |
595 DCHECK(content::Source<PrefService>(source).ptr() == | 595 DCHECK(content::Source<PrefService>(source).ptr() == |
596 GetProfile()->GetPrefs() || | 596 GetProfile()->GetPrefs() || |
597 content::Source<PrefService>(source).ptr() == per_tab_prefs_); | 597 content::Source<PrefService>(source).ptr() == per_tab_prefs_); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
657 | 657 |
658 void PrefsTabHelper::UpdateRendererPreferences() { | 658 void PrefsTabHelper::UpdateRendererPreferences() { |
659 renderer_preferences_util::UpdateFromSystemSettings( | 659 renderer_preferences_util::UpdateFromSystemSettings( |
660 web_contents()->GetMutableRendererPrefs(), GetProfile()); | 660 web_contents()->GetMutableRendererPrefs(), GetProfile()); |
661 web_contents()->GetRenderViewHost()->SyncRendererPrefs(); | 661 web_contents()->GetRenderViewHost()->SyncRendererPrefs(); |
662 } | 662 } |
663 | 663 |
664 Profile* PrefsTabHelper::GetProfile() { | 664 Profile* PrefsTabHelper::GetProfile() { |
665 return Profile::FromBrowserContext(web_contents()->GetBrowserContext()); | 665 return Profile::FromBrowserContext(web_contents()->GetBrowserContext()); |
666 } | 666 } |
OLD | NEW |