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

Side by Side Diff: chrome/browser/tab_contents/tab_contents.cc

Issue 660349: First cut at custom user style sheets. (Closed)
Patch Set: compile Created 10 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/tab_contents/tab_contents.h" 5 #include "chrome/browser/tab_contents/tab_contents.h"
6 6
7 #include "app/gfx/text_elider.h" 7 #include "app/gfx/text_elider.h"
8 #include "app/l10n_util.h" 8 #include "app/l10n_util.h"
9 #include "app/resource_bundle.h" 9 #include "app/resource_bundle.h"
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 NotificationService::AllSources()); 312 NotificationService::AllSources());
313 registrar_.Add(this, NotificationType::BOOKMARK_MODEL_LOADED, 313 registrar_.Add(this, NotificationType::BOOKMARK_MODEL_LOADED,
314 NotificationService::AllSources()); 314 NotificationService::AllSources());
315 registrar_.Add(this, NotificationType::RENDER_WIDGET_HOST_DESTROYED, 315 registrar_.Add(this, NotificationType::RENDER_WIDGET_HOST_DESTROYED,
316 NotificationService::AllSources()); 316 NotificationService::AllSources());
317 #if defined(OS_LINUX) 317 #if defined(OS_LINUX)
318 registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, 318 registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED,
319 NotificationService::AllSources()); 319 NotificationService::AllSources());
320 #endif 320 #endif
321 321
322 registrar_.Add(this, NotificationType::USER_STYLE_SHEET_UPDATED,
323 NotificationService::AllSources());
324
322 // Register for notifications about content setting changes. 325 // Register for notifications about content setting changes.
323 registrar_.Add(this, NotificationType::CONTENT_SETTINGS_CHANGED, 326 registrar_.Add(this, NotificationType::CONTENT_SETTINGS_CHANGED,
324 NotificationService::AllSources()); 327 NotificationService::AllSources());
325 328
326 // Keep a global copy of the previous search string (if any). 329 // Keep a global copy of the previous search string (if any).
327 static string16 global_last_search = string16(); 330 static string16 global_last_search = string16();
328 last_search_prepopulate_text_ = &global_last_search; 331 last_search_prepopulate_text_ = &global_last_search;
329 332
330 // Set-up the showing of the omnibox search infobar if applicable. 333 // Set-up the showing of the omnibox search infobar if applicable.
331 if (OmniboxSearchHint::IsEnabled(profile)) 334 if (OmniboxSearchHint::IsEnabled(profile))
(...skipping 2222 matching lines...) Expand 10 before | Expand all | Expand 10 after
2554 DCHECK(prefs); 2557 DCHECK(prefs);
2555 if (prefs->GetBoolean(prefs::kAlternateErrorPagesEnabled)) { 2558 if (prefs->GetBoolean(prefs::kAlternateErrorPagesEnabled)) {
2556 url = google_util::AppendGoogleLocaleParam( 2559 url = google_util::AppendGoogleLocaleParam(
2557 GURL(google_util::kLinkDoctorBaseURL)); 2560 GURL(google_util::kLinkDoctorBaseURL));
2558 url = google_util::AppendGoogleTLDParam(url); 2561 url = google_util::AppendGoogleTLDParam(url);
2559 } 2562 }
2560 return url; 2563 return url;
2561 } 2564 }
2562 2565
2563 WebPreferences TabContents::GetWebkitPrefs() { 2566 WebPreferences TabContents::GetWebkitPrefs() {
2564 PrefService* prefs = render_view_host()->process()->profile()->GetPrefs(); 2567 Profile* profile = render_view_host()->process()->profile();
2565 bool is_dom_ui = false; 2568 bool is_dom_ui = false;
2566 return RenderViewHostDelegateHelper::GetWebkitPrefs(prefs, is_dom_ui); 2569 return RenderViewHostDelegateHelper::GetWebkitPrefs(profile, is_dom_ui);
2567 } 2570 }
2568 2571
2569 void TabContents::OnIgnoredUIEvent() { 2572 void TabContents::OnIgnoredUIEvent() {
2570 if (constrained_window_count()) { 2573 if (constrained_window_count()) {
2571 ConstrainedWindow* window = *constrained_window_begin(); 2574 ConstrainedWindow* window = *constrained_window_begin();
2572 window->FocusConstrainedWindow(); 2575 window->FocusConstrainedWindow();
2573 } 2576 }
2574 } 2577 }
2575 2578
2576 void TabContents::OnJSOutOfMemory() { 2579 void TabContents::OnJSOutOfMemory() {
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
2772 2775
2773 #if defined(OS_LINUX) 2776 #if defined(OS_LINUX)
2774 case NotificationType::BROWSER_THEME_CHANGED: { 2777 case NotificationType::BROWSER_THEME_CHANGED: {
2775 renderer_preferences_util::UpdateFromSystemSettings( 2778 renderer_preferences_util::UpdateFromSystemSettings(
2776 &renderer_preferences_, profile()); 2779 &renderer_preferences_, profile());
2777 render_view_host()->SyncRendererPrefs(); 2780 render_view_host()->SyncRendererPrefs();
2778 break; 2781 break;
2779 } 2782 }
2780 #endif 2783 #endif
2781 2784
2785 case NotificationType::USER_STYLE_SHEET_UPDATED:
2786 UpdateWebPreferences();
2787 break;
2788
2782 case NotificationType::CONTENT_SETTINGS_CHANGED: { 2789 case NotificationType::CONTENT_SETTINGS_CHANGED: {
2783 Details<HostContentSettingsMap::ContentSettingsDetails> 2790 Details<HostContentSettingsMap::ContentSettingsDetails>
2784 settings_details(details); 2791 settings_details(details);
2785 NavigationEntry* entry = controller_.GetActiveEntry(); 2792 NavigationEntry* entry = controller_.GetActiveEntry();
2786 GURL entry_url; 2793 GURL entry_url;
2787 std::string host; 2794 std::string host;
2788 if (entry) { 2795 if (entry) {
2789 entry_url = entry->url(); 2796 entry_url = entry->url();
2790 host = entry_url.host(); 2797 host = entry_url.host();
2791 } 2798 }
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
2851 render_view_host()->JavaScriptMessageBoxClosed(reply_msg, success, prompt); 2858 render_view_host()->JavaScriptMessageBoxClosed(reply_msg, success, prompt);
2852 } 2859 }
2853 2860
2854 void TabContents::SetSuppressMessageBoxes(bool suppress_message_boxes) { 2861 void TabContents::SetSuppressMessageBoxes(bool suppress_message_boxes) {
2855 set_suppress_javascript_messages(suppress_message_boxes); 2862 set_suppress_javascript_messages(suppress_message_boxes);
2856 } 2863 }
2857 2864
2858 void TabContents::set_encoding(const std::string& encoding) { 2865 void TabContents::set_encoding(const std::string& encoding) {
2859 encoding_ = CharacterEncoding::GetCanonicalEncodingNameByAliasName(encoding); 2866 encoding_ = CharacterEncoding::GetCanonicalEncodingNameByAliasName(encoding);
2860 } 2867 }
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/render_view_host_delegate_helper.cc ('k') | chrome/browser/user_style_sheet_watcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698