OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/tab_contents/tab_contents_wrapper.h" | 5 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
9 #include "chrome/browser/autocomplete_history_manager.h" | 9 #include "chrome/browser/autocomplete_history_manager.h" |
10 #include "chrome/browser/autofill/autofill_manager.h" | 10 #include "chrome/browser/autofill/autofill_manager.h" |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 } | 144 } |
145 | 145 |
146 // Set-up the showing of the omnibox search infobar if applicable. | 146 // Set-up the showing of the omnibox search infobar if applicable. |
147 if (OmniboxSearchHint::IsEnabled(contents->profile())) | 147 if (OmniboxSearchHint::IsEnabled(contents->profile())) |
148 omnibox_search_hint_.reset(new OmniboxSearchHint(this)); | 148 omnibox_search_hint_.reset(new OmniboxSearchHint(this)); |
149 | 149 |
150 registrar_.Add(this, NotificationType::GOOGLE_URL_UPDATED, | 150 registrar_.Add(this, NotificationType::GOOGLE_URL_UPDATED, |
151 NotificationService::AllSources()); | 151 NotificationService::AllSources()); |
152 registrar_.Add(this, NotificationType::USER_STYLE_SHEET_UPDATED, | 152 registrar_.Add(this, NotificationType::USER_STYLE_SHEET_UPDATED, |
153 NotificationService::AllSources()); | 153 NotificationService::AllSources()); |
154 #if defined(OS_LINUX) | 154 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
155 registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, | 155 registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, |
156 NotificationService::AllSources()); | 156 NotificationService::AllSources()); |
157 #endif | 157 #endif |
158 | 158 |
159 // Register for notifications about all interested prefs change. | 159 // Register for notifications about all interested prefs change. |
160 PrefService* prefs = profile()->GetPrefs(); | 160 PrefService* prefs = profile()->GetPrefs(); |
161 pref_change_registrar_.Init(prefs); | 161 pref_change_registrar_.Init(prefs); |
162 if (prefs) { | 162 if (prefs) { |
163 for (int i = 0; i < kPrefsToObserveLength; ++i) | 163 for (int i = 0; i < kPrefsToObserveLength; ++i) |
164 pref_change_registrar_.Add(kPrefsToObserve[i], this); | 164 pref_change_registrar_.Add(kPrefsToObserve[i], this); |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 } | 406 } |
407 | 407 |
408 break; | 408 break; |
409 } | 409 } |
410 case NotificationType::GOOGLE_URL_UPDATED: | 410 case NotificationType::GOOGLE_URL_UPDATED: |
411 UpdateAlternateErrorPageURL(render_view_host()); | 411 UpdateAlternateErrorPageURL(render_view_host()); |
412 break; | 412 break; |
413 case NotificationType::USER_STYLE_SHEET_UPDATED: | 413 case NotificationType::USER_STYLE_SHEET_UPDATED: |
414 UpdateWebPreferences(); | 414 UpdateWebPreferences(); |
415 break; | 415 break; |
416 #if defined(OS_LINUX) | 416 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
417 case NotificationType::BROWSER_THEME_CHANGED: { | 417 case NotificationType::BROWSER_THEME_CHANGED: { |
418 UpdateRendererPreferences(); | 418 UpdateRendererPreferences(); |
419 break; | 419 break; |
420 } | 420 } |
421 #endif | 421 #endif |
422 case NotificationType::PREF_CHANGED: { | 422 case NotificationType::PREF_CHANGED: { |
423 std::string* pref_name_in = Details<std::string>(details).ptr(); | 423 std::string* pref_name_in = Details<std::string>(details).ptr(); |
424 DCHECK(Source<PrefService>(source).ptr() == profile()->GetPrefs()); | 424 DCHECK(Source<PrefService>(source).ptr() == profile()->GetPrefs()); |
425 if (*pref_name_in == prefs::kAlternateErrorPagesEnabled) { | 425 if (*pref_name_in == prefs::kAlternateErrorPagesEnabled) { |
426 UpdateAlternateErrorPageURL(render_view_host()); | 426 UpdateAlternateErrorPageURL(render_view_host()); |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 void TabContentsWrapper::UpdateWebPreferences() { | 591 void TabContentsWrapper::UpdateWebPreferences() { |
592 RenderViewHostDelegate* rvhd = tab_contents(); | 592 RenderViewHostDelegate* rvhd = tab_contents(); |
593 Send(new ViewMsg_UpdateWebPreferences(routing_id(), rvhd->GetWebkitPrefs())); | 593 Send(new ViewMsg_UpdateWebPreferences(routing_id(), rvhd->GetWebkitPrefs())); |
594 } | 594 } |
595 | 595 |
596 void TabContentsWrapper::UpdateRendererPreferences() { | 596 void TabContentsWrapper::UpdateRendererPreferences() { |
597 renderer_preferences_util::UpdateFromSystemSettings( | 597 renderer_preferences_util::UpdateFromSystemSettings( |
598 tab_contents()->GetMutableRendererPrefs(), profile()); | 598 tab_contents()->GetMutableRendererPrefs(), profile()); |
599 render_view_host()->SyncRendererPrefs(); | 599 render_view_host()->SyncRendererPrefs(); |
600 } | 600 } |
OLD | NEW |